Delete outdated search_policy.rb
This commit is contained in:

committed by
Sebastian Serth

parent
664110f8f1
commit
bf13cfc712
@ -1,31 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class SearchPolicy < AdminOrAuthorPolicy
|
|
||||||
def batch_update?
|
|
||||||
admin?
|
|
||||||
end
|
|
||||||
|
|
||||||
def show?
|
|
||||||
admin? || teacher?
|
|
||||||
end
|
|
||||||
|
|
||||||
%i[clone? destroy? edit? update?].each do |action|
|
|
||||||
define_method(action) { admin? || author? }
|
|
||||||
end
|
|
||||||
|
|
||||||
[:reload?].each do |action|
|
|
||||||
define_method(action) { everyone }
|
|
||||||
end
|
|
||||||
|
|
||||||
class Scope < Scope
|
|
||||||
def resolve
|
|
||||||
if @user.admin?
|
|
||||||
@scope.all
|
|
||||||
elsif @user.teacher?
|
|
||||||
@scope.where('user_id = ? OR public = TRUE', @user.id)
|
|
||||||
else
|
|
||||||
@scope.none
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
Reference in New Issue
Block a user