27 lines
386 B
Ruby
27 lines
386 B
Ruby
|
class InboxPolicy < ApplicationPolicy
|
||
|
class Scope
|
||
|
attr_reader :user, :scope
|
||
|
|
||
|
def initialize(user, scope)
|
||
|
@user = user
|
||
|
@scope = scope
|
||
|
end
|
||
|
|
||
|
def resolve
|
||
|
if user.administrator?
|
||
|
scope.all
|
||
|
elsif user.agent?
|
||
|
user.assigned_inboxes
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def index?
|
||
|
true
|
||
|
end
|
||
|
|
||
|
def destroy?
|
||
|
@user.administrator?
|
||
|
end
|
||
|
end
|