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?
|
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.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_files')) unless @exercise.files.visible.exists?
|
||||||
|
redirect_to(@exercise, alert: t('exercises.implement.no_execution_environment')) if @exercise.execution_environment.blank?
|
||||||
else
|
else
|
||||||
render_not_authorized
|
render_not_authorized
|
||||||
end
|
end
|
||||||
|
@ -31,7 +31,7 @@ class ExercisePolicy < AdminOrAuthorPolicy
|
|||||||
|
|
||||||
%i[implement? working_times? intervention? search? reload?].each do |action|
|
%i[implement? working_times? intervention? search? reload?].each do |action|
|
||||||
define_method(action) do
|
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?)
|
admin? || teacher_in_study_group? || author? || (everyone && !@record.unpublished?)
|
||||||
end
|
end
|
||||||
|
@ -451,6 +451,7 @@ de:
|
|||||||
not_graded: ohne Punkte
|
not_graded: ohne Punkte
|
||||||
hint: Hinweis
|
hint: Hinweis
|
||||||
no_files: Die Aufgabe umfasst noch keine sichtbaren Dateien.
|
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: 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_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}).
|
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
|
not_graded: not graded
|
||||||
hint: Hint
|
hint: Hint
|
||||||
no_files: The exercise does not comprise visible files yet.
|
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: 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_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}).
|
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
|
results: Results
|
||||||
start: Start Coding
|
start: Start Coding
|
||||||
test_count: '<span class="number">%{count}</span> test files have been executed.'
|
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
|
workspace: Workspace
|
||||||
comment:
|
comment:
|
||||||
a_comment: comment
|
a_comment: comment
|
||||||
|
Reference in New Issue
Block a user