fix codeharbor_export policies, add specs

This commit is contained in:
Karol
2020-10-29 18:06:14 +01:00
parent 9cd8ca2013
commit 517886ea0b
2 changed files with 60 additions and 2 deletions

View File

@ -19,10 +19,14 @@ class ExercisePolicy < AdminOrAuthorPolicy
admin?
end
[:clone?, :destroy?, :edit?, :update?, :export_external_check?, :export_external_confirm?].each do |action|
[:clone?, :destroy?, :edit?, :update?].each do |action|
define_method(action) { admin? || teacher_in_study_group? || author? }
end
[:export_external_check?, :export_external_confirm?].each do |action|
define_method(action) { (admin? || teacher_in_study_group? || author?) && @user.codeharbor_link }
end
[:implement?, :working_times?, :intervention?, :search?, :submit?, :reload?].each do |action|
define_method(action) { everyone }
end