Chatwoot/app/policies/category_policy.rb

31 lines
576 B
Ruby

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