Use admin? or teacher? for permission check instead of internal_user?

This commit is contained in:
Sebastian Serth
2018-11-22 18:55:54 +01:00
parent 71fd3b9b07
commit 4b251599ff
11 changed files with 22 additions and 22 deletions

View File

@ -9,7 +9,7 @@ class ExercisePolicy < AdminOrAuthorPolicy
end
def show?
@user.internal_user?
admin? || teacher?
end
[:clone?, :destroy?, :edit?, :statistics?, :update?, :feedback?].each do |action|
@ -24,7 +24,7 @@ class ExercisePolicy < AdminOrAuthorPolicy
def resolve
if @user.admin?
@scope.all
elsif @user.internal_user?
elsif @user.teacher?
@scope.where('user_id = ? OR public = TRUE', @user.id)
else
@scope.none