further delete (db queries)

This commit is contained in:
yqbk
2016-07-04 17:40:01 +02:00
parent 2bb1362520
commit b962400fab
2 changed files with 1 additions and 17 deletions

View File

@ -25,8 +25,7 @@ class ExercisePolicy < AdminOrAuthorPolicy
if @user.admin?
@scope.all
elsif @user.internal_user?
#need to remove team query
@scope.where('user_id = ? OR public = TRUE OR (team_id IS NOT NULL AND team_id IN (SELECT t.id FROM teams t JOIN internal_users_teams iut ON t.id = iut.team_id WHERE iut.internal_user_id = ?))', @user.id, @user.id)
@scope.where('user_id = ? OR public = TRUE', @user.id, @user.id)
else
@scope.none
end