Chatwoot/app/policies/inbox_policy.rb
Pranav Raj S 5ddc46c474 Refactor: Inbox store, remove inboxes from sidebar (#387)
* Refactor: Inbox store, remove inboxes from sidebar

* Add a new page for inbox settings

* Show inboxes on sidebar

* Add inbox_members API

* Disable similar-code check

* Fix codeclimate scss issues

* Add widget_color update API and actions

* Add specs for inbox store

* Fix Facebook auth flow

* Fix agent loading, inbox name
2019-12-28 21:56:42 +05:30

34 lines
478 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 create?
@user.administrator?
end
def update?
@user.administrator?
end
def destroy?
@user.administrator?
end
end