Deny /implement without execution environment
Also, fix a smaller typo in the locales
This commit is contained in:
@ -443,6 +443,7 @@ class ExercisesController < ApplicationController
|
||||
if current_user.admin? || current_user.teacher?
|
||||
redirect_to(@exercise, alert: t('exercises.implement.unpublished')) if @exercise.unpublished?
|
||||
redirect_to(@exercise, alert: t('exercises.implement.no_files')) unless @exercise.files.visible.exists?
|
||||
redirect_to(@exercise, alert: t('exercises.implement.no_execution_environment')) if @exercise.execution_environment.blank?
|
||||
else
|
||||
render_not_authorized
|
||||
end
|
||||
|
@ -31,7 +31,7 @@ class ExercisePolicy < AdminOrAuthorPolicy
|
||||
|
||||
%i[implement? working_times? intervention? search? reload?].each do |action|
|
||||
define_method(action) do
|
||||
return no_one unless @record.files.visible.exists?
|
||||
return no_one unless @record.files.visible.exists? && @record.execution_environment.present?
|
||||
|
||||
admin? || teacher_in_study_group? || author? || (everyone && !@record.unpublished?)
|
||||
end
|
||||
|
@ -451,6 +451,7 @@ de:
|
||||
not_graded: ohne Punkte
|
||||
hint: Hinweis
|
||||
no_files: Die Aufgabe umfasst noch keine sichtbaren Dateien.
|
||||
no_execution_environment: Für die Aufgabe wurde noch keine Ausführungsumgebung gewählt.
|
||||
no_output: Die letzte Code-Ausführung terminierte am %{timestamp} ohne Ausgabe.
|
||||
no_output_exit_successful: Die letzte Code-Ausführung terminierte am %{timestamp} ohne Ausgabe and wurde erfolgreich beendet (Statuscode %{exit_code}).
|
||||
no_output_exit_failure: Die letzte Code-Ausführung terminierte am %{timestamp} ohne Ausgabe und wurde mit einem Fehler beendet (Statuscode %{exit_code}).
|
||||
|
@ -451,6 +451,7 @@ en:
|
||||
not_graded: not graded
|
||||
hint: Hint
|
||||
no_files: The exercise does not comprise visible files yet.
|
||||
no_execution_environment: No execution environment has been selected for the exercise yet.
|
||||
no_output: The last code run finished on %{timestamp} without any output.
|
||||
no_output_exit_successful: The last code run finished on %{timestamp} without any output and exited successfully (status code %{exit_code}).
|
||||
no_output_exit_failure: The last code run finished on %{timestamp} without any output and exited with a failure (status code %{exit_code}).
|
||||
@ -464,7 +465,7 @@ en:
|
||||
results: Results
|
||||
start: Start Coding
|
||||
test_count: '<span class="number">%{count}</span> test files have been executed.'
|
||||
unpublished: The selected exercises has been deactivated. Hence, you cannot implement this exercise at the moment.
|
||||
unpublished: The selected exercise has been deactivated. Hence, you cannot implement this exercise at the moment.
|
||||
workspace: Workspace
|
||||
comment:
|
||||
a_comment: comment
|
||||
|
Reference in New Issue
Block a user