Hide actions that are not available to teachers

This commit is contained in:
Maximilian Grundke
2016-03-02 11:55:26 +01:00
parent da3339ecbb
commit 7dee100665
4 changed files with 21 additions and 15 deletions

View File

@ -8,7 +8,11 @@ class ExercisePolicy < AdminOrAuthorPolicy
admin?
end
[:clone?, :destroy?, :edit?, :show?, :statistics?, :update?].each do |action|
def show?
@user.internal_user?
end
[:clone?, :destroy?, :edit?, :statistics?, :update?].each do |action|
define_method(action) { admin? || author? || team_member? }
end