feat: allow role based filtering on the frontend (#11246)
This pull request introduces frontend role filtering to allStatusChat getter. The key changes include the addition of a new helper function to get the user's role, updates to the conversation filtering logic to incorporate role and permissions, and the addition of unit tests for the new filtering logic. --------- Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
This commit is contained in:
@@ -16,6 +16,15 @@ export const getUserPermissions = (user, accountId) => {
|
||||
return currentAccount.permissions || [];
|
||||
};
|
||||
|
||||
export const getUserRole = (user, accountId) => {
|
||||
const currentAccount = getCurrentAccount(user, accountId) || {};
|
||||
if (currentAccount.custom_role_id) {
|
||||
return 'custom_role';
|
||||
}
|
||||
|
||||
return currentAccount.role || 'agent';
|
||||
};
|
||||
|
||||
const isPermissionsPresentInRoute = route =>
|
||||
route.meta && route.meta.permissions;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user