permission object builder fix
This commit is contained in:
parent
723f05bfca
commit
c543d4e4ed
2 changed files with 23 additions and 12 deletions
|
@ -109,7 +109,12 @@ export default class PermissionHelper {
|
|||
}
|
||||
const permissionIndex = permissionTypes.indexOf(split[1] as PermissionType);
|
||||
const appliedPermissions = permissionTypes.slice(0, permissionIndex + 1);
|
||||
output[split[0]].all = appliedPermissions;
|
||||
|
||||
if (output[split[0]].all != "*") {
|
||||
output[split[0]].all = [
|
||||
...new Set([...output[split[0]].all, ...appliedPermissions]),
|
||||
] as Array<PermissionType>;
|
||||
}
|
||||
} else {
|
||||
if (split[2] == "*" || output[split[0]][split[1] as PermissionModule] == "*") {
|
||||
output[split[0]][split[1] as PermissionModule] = "*";
|
||||
|
@ -123,6 +128,11 @@ export default class PermissionHelper {
|
|||
const permissionIndex = permissionTypes.indexOf(split[2] as PermissionType);
|
||||
const appliedPermissions = permissionTypes.slice(0, permissionIndex + 1);
|
||||
output[split[0]][split[1] as PermissionModule] = appliedPermissions;
|
||||
if (output[split[0]][split[1] as PermissionModule] != "*") {
|
||||
output[split[0]][split[1] as PermissionModule] = [
|
||||
...new Set([...output[split[0]][split[1] as PermissionModule], ...appliedPermissions]),
|
||||
] as Array<PermissionType>;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -145,8 +155,10 @@ export default class PermissionHelper {
|
|||
output.push(`${section}.${type}`);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let modules = Object.keys(permissions[section]) as Array<PermissionModule>;
|
||||
}
|
||||
let modules = Object.keys(permissions[section]).filter((m: PermissionModule) =>
|
||||
permissionModules.includes(m)
|
||||
) as Array<PermissionModule>;
|
||||
for (let module of modules) {
|
||||
let types = permissions[section][module];
|
||||
if (types == "*" || types.length == permissionTypes.length) {
|
||||
|
@ -158,7 +170,6 @@ export default class PermissionHelper {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,6 @@ export default abstract class CommunicationService {
|
|||
static getAvailableColumnsForCommunication(): Array<string> {
|
||||
let metadata = dataSource.getMetadata(communication);
|
||||
let columns = metadata.columns.map((c) => c.propertyName);
|
||||
return columns.filter((c) => !["id", "preffered", "type"].includes(c));
|
||||
return columns.filter((c) => !["id", "preffered", "type", "member"].includes(c));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue