Initial Commit
Co-authored-by: Subin <subinthattaparambil@gmail.com> Co-authored-by: Manoj <manojmj92@gmail.com> Co-authored-by: Nithin <webofnithin@gmail.com>
This commit is contained in:
26
app/policies/inbox_policy.rb
Normal file
26
app/policies/inbox_policy.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
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
|
||||
Reference in New Issue
Block a user