permission Handler get differences
This commit is contained in:
parent
1d2b5ea420
commit
d77c3ca1a5
1 changed files with 8 additions and 4 deletions
|
@ -103,7 +103,7 @@ export default class PermissionHelper {
|
|||
for (let section of sections) {
|
||||
if (permissions[section].all) {
|
||||
let types = permissions[section].all;
|
||||
if (types == "*") {
|
||||
if (types == "*" || types.length == permissionTypes.length) {
|
||||
output.push(`${section}.*`);
|
||||
} else {
|
||||
for (let type of types) {
|
||||
|
@ -114,7 +114,7 @@ export default class PermissionHelper {
|
|||
let modules = Object.keys(permissions[section]) as Array<PermissionModule>;
|
||||
for (let module of modules) {
|
||||
let types = permissions[section][module];
|
||||
if (types == "*") {
|
||||
if (types == "*" || types.length == permissionTypes.length) {
|
||||
output.push(`${section}.${module}.*`);
|
||||
} else {
|
||||
for (let type of types) {
|
||||
|
@ -127,7 +127,11 @@ export default class PermissionHelper {
|
|||
return output;
|
||||
}
|
||||
|
||||
static getWhatToAdd() {}
|
||||
|
||||
static getWhatToRemove() {}
|
||||
static getWhatToAdd(before: Array<PermissionString>, after: Array<PermissionString>): Array<PermissionString> {
|
||||
return after.filter((permission) => !before.includes(permission));
|
||||
}
|
||||
|
||||
static getWhatToRemove(before: Array<PermissionString>, after: Array<PermissionString>): Array<PermissionString> {
|
||||
return before.filter((permission) => !after.includes(permission));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue