Chatwoot/app/policies/category_policy.rb

32 lines
576 B
Ruby
Raw Permalink Normal View History

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