Chatwoot/app/policies/portal_policy.rb

36 lines
554 B
Ruby
Raw Normal View History

class PortalPolicy < ApplicationPolicy
def index?
@account_user.administrator? || @account.users.include?(@user)
end
def update?
@account_user.administrator?
end
def show?
@account_user.administrator? || portal_member?
end
def edit?
@account_user.administrator?
end
def create?
@account_user.administrator?
end
def destroy?
@account_user.administrator?
end
def add_members?
@account_user.administrator?
end
private
def portal_member?
@record.first.members.include?(@user)
end
end