diff --git a/src/helpers/permissionHelper.ts b/src/helpers/permissionHelper.ts index e4af4ba..2eb4def 100644 --- a/src/helpers/permissionHelper.ts +++ b/src/helpers/permissionHelper.ts @@ -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; + } } 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; + } } } } @@ -145,16 +155,17 @@ export default class PermissionHelper { output.push(`${section}.${type}`); } } - } else { - let modules = Object.keys(permissions[section]) as Array; - for (let module of modules) { - let types = permissions[section][module]; - if (types == "*" || types.length == permissionTypes.length) { - output.push(`${section}.${module}.*`); - } else { - for (let type of types) { - output.push(`${section}.${module}.${type}`); - } + } + let modules = Object.keys(permissions[section]).filter((m: PermissionModule) => + permissionModules.includes(m) + ) as Array; + for (let module of modules) { + let types = permissions[section][module]; + if (types == "*" || types.length == permissionTypes.length) { + output.push(`${section}.${module}.*`); + } else { + for (let type of types) { + output.push(`${section}.${module}.${type}`); } } } diff --git a/src/service/communicationService.ts b/src/service/communicationService.ts index 09221dd..38f4917 100644 --- a/src/service/communicationService.ts +++ b/src/service/communicationService.ts @@ -29,6 +29,6 @@ export default abstract class CommunicationService { static getAvailableColumnsForCommunication(): Array { 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)); } }