chore: test out agent permissions
This commit is contained in:
@@ -49,6 +49,14 @@ class AccountUser < ApplicationRecord
|
||||
::Agents::DestroyJob.perform_later(account, user)
|
||||
end
|
||||
|
||||
def permissions
|
||||
if administrator?
|
||||
GlobalConfigService.load('CHATWOOT_ADMIN_PERMISSIONS', 'account_manage').split(',')
|
||||
else
|
||||
GlobalConfigService.load('CHATWOOT_AGENT_PERMISSIONS', 'conversation_manage').split(',')
|
||||
end
|
||||
end
|
||||
|
||||
def push_event_data
|
||||
{
|
||||
id: id,
|
||||
|
||||
@@ -24,6 +24,7 @@ json.accounts do
|
||||
json.status account_user.account.status
|
||||
json.active_at account_user.active_at
|
||||
json.role account_user.role
|
||||
json.permissions account_user.permissions
|
||||
# the actual availability user has configured
|
||||
json.availability account_user.availability
|
||||
# availability derived from presence
|
||||
|
||||
@@ -163,6 +163,14 @@
|
||||
value:
|
||||
display_title: 'Clearbit API Key'
|
||||
description: 'This API key is used for onboarding the users, to pre-fill account data.'
|
||||
- name: CHATWOOT_ADMIN_PERMISSIONS
|
||||
value:
|
||||
display_title: Chatwoot Admin Permissions
|
||||
description: 'Comma separated list of permissions for a Chatwoot admin'
|
||||
- name: CHATWOOT_AGENT_PERMISSIONS
|
||||
value:
|
||||
display_title: Chatwoot Agent Permissions
|
||||
description: 'Comma separated list of permissions for a Chatwoot agent'
|
||||
# ------- End of Chatwoot Internal Config for Cloud ----#
|
||||
|
||||
# ------- Chatwoot Internal Config for Self Hosted ----#
|
||||
|
||||
@@ -30,6 +30,6 @@ module Enterprise::SuperAdmin::AppConfigsController
|
||||
end
|
||||
|
||||
def internal_config_options
|
||||
%w[CHATWOOT_INBOX_TOKEN CHATWOOT_INBOX_HMAC_KEY ANALYTICS_TOKEN CLEARBIT_API_KEY]
|
||||
%w[CHATWOOT_INBOX_TOKEN CHATWOOT_INBOX_HMAC_KEY ANALYTICS_TOKEN CLEARBIT_API_KEY CHATWOOT_ADMIN_PERMISSIONS CHATWOOT_AGENT_PERMISSIONS]
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user