chore: Custom Roles to manage permissions [ UI ] (#9865)
In admin settings, this Pr will add the UI for managing custom roles ( ref: https://github.com/chatwoot/chatwoot/pull/9995 ). It also handles the routing logic changes to accommodate fine-tuned permissions. --------- Co-authored-by: Pranav <pranavrajs@gmail.com> Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Co-authored-by: iamsivin <iamsivin@gmail.com> Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
This commit is contained in:
53
app/javascript/dashboard/constants/permissions.js
Normal file
53
app/javascript/dashboard/constants/permissions.js
Normal file
@@ -0,0 +1,53 @@
|
||||
export const AVAILABLE_CUSTOM_ROLE_PERMISSIONS = [
|
||||
'conversation_manage',
|
||||
'conversation_unassigned_manage',
|
||||
'conversation_participating_manage',
|
||||
'contact_manage',
|
||||
'report_manage',
|
||||
'knowledge_base_manage',
|
||||
];
|
||||
|
||||
export const ROLES = ['agent', 'administrator'];
|
||||
|
||||
export const CONVERSATION_PERMISSIONS = [
|
||||
'conversation_manage',
|
||||
'conversation_unassigned_manage',
|
||||
'conversation_participating_manage',
|
||||
];
|
||||
|
||||
export const MANAGE_ALL_CONVERSATION_PERMISSIONS = 'conversation_manage';
|
||||
|
||||
export const CONVERSATION_UNASSIGNED_PERMISSIONS =
|
||||
'conversation_unassigned_manage';
|
||||
|
||||
export const CONVERSATION_PARTICIPATING_PERMISSIONS =
|
||||
'conversation_participating_manage';
|
||||
|
||||
export const CONTACT_PERMISSIONS = 'contact_manage';
|
||||
|
||||
export const REPORTS_PERMISSIONS = 'report_manage';
|
||||
|
||||
export const PORTAL_PERMISSIONS = 'knowledge_base_manage';
|
||||
|
||||
export const ASSIGNEE_TYPE_TAB_PERMISSIONS = {
|
||||
me: {
|
||||
count: 'mineCount',
|
||||
permissions: [...ROLES, ...CONVERSATION_PERMISSIONS],
|
||||
},
|
||||
unassigned: {
|
||||
count: 'unAssignedCount',
|
||||
permissions: [
|
||||
...ROLES,
|
||||
MANAGE_ALL_CONVERSATION_PERMISSIONS,
|
||||
CONVERSATION_UNASSIGNED_PERMISSIONS,
|
||||
],
|
||||
},
|
||||
all: {
|
||||
count: 'allCount',
|
||||
permissions: [
|
||||
...ROLES,
|
||||
MANAGE_ALL_CONVERSATION_PERMISSIONS,
|
||||
CONVERSATION_PARTICIPATING_PERMISSIONS,
|
||||
],
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user