Some checks failed
Allow Captain FAQ management through the existing knowledge_base_manage custom role while keeping plain agents read-only for FAQ actions.
30 lines
437 B
Ruby
30 lines
437 B
Ruby
class Captain::AssistantResponsePolicy < ApplicationPolicy
|
|
def index?
|
|
@account_user.administrator? || @account_user.agent?
|
|
end
|
|
|
|
def show?
|
|
index?
|
|
end
|
|
|
|
def create?
|
|
manage?
|
|
end
|
|
|
|
def update?
|
|
manage?
|
|
end
|
|
|
|
def destroy?
|
|
manage?
|
|
end
|
|
|
|
private
|
|
|
|
def manage?
|
|
return true if @account_user.administrator?
|
|
|
|
@account_user.custom_role&.permissions&.include?('knowledge_base_manage') || false
|
|
end
|
|
end
|