Publish current project state
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import {
|
||||
ROLE_AGENT,
|
||||
ROLE_ADMINISTRATOR,
|
||||
} from 'dashboard/constants/permissions.js';
|
||||
|
||||
const roleMapping = {
|
||||
0: 'agent',
|
||||
1: 'administrator',
|
||||
0: ROLE_AGENT,
|
||||
1: ROLE_ADMINISTRATOR,
|
||||
};
|
||||
|
||||
const availabilityMapping = {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { ROLE_AGENT, ROLE_CUSTOM } from 'dashboard/constants/permissions.js';
|
||||
|
||||
export const hasPermissions = (
|
||||
requiredPermissions = [],
|
||||
availablePermissions = []
|
||||
@@ -19,10 +21,10 @@ export const getUserPermissions = (user, accountId) => {
|
||||
export const getUserRole = (user, accountId) => {
|
||||
const currentAccount = getCurrentAccount(user, accountId) || {};
|
||||
if (currentAccount.custom_role_id) {
|
||||
return 'custom_role';
|
||||
return ROLE_CUSTOM;
|
||||
}
|
||||
|
||||
return currentAccount.role || 'agent';
|
||||
return currentAccount.role || ROLE_AGENT;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
CONTACT_PERMISSIONS,
|
||||
REPORTS_PERMISSIONS,
|
||||
PORTAL_PERMISSIONS,
|
||||
ROLE_CUSTOM,
|
||||
} from 'dashboard/constants/permissions.js';
|
||||
import { isSuperAdminUser } from '../routes/dashboard/settings/captain/utils';
|
||||
|
||||
@@ -35,7 +36,7 @@ export const defaultRedirectPage = (to, permissions) => {
|
||||
);
|
||||
|
||||
if (route) return `accounts/${accountId}/${route.path}`;
|
||||
if (permissions.includes('custom_role')) {
|
||||
if (permissions.includes(ROLE_CUSTOM)) {
|
||||
return `accounts/${accountId}/profile/settings`;
|
||||
}
|
||||
return `accounts/${accountId}/dashboard`;
|
||||
|
||||
Reference in New Issue
Block a user