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) {
|
for (let section of sections) {
|
||||||
if (permissions[section].all) {
|
if (permissions[section].all) {
|
||||||
let types = permissions[section].all;
|
let types = permissions[section].all;
|
||||||
if (types == "*") {
|
if (types == "*" || types.length == permissionTypes.length) {
|
||||||
output.push(`${section}.*`);
|
output.push(`${section}.*`);
|
||||||
} else {
|
} else {
|
||||||
for (let type of types) {
|
for (let type of types) {
|
||||||
|
@ -114,7 +114,7 @@ export default class PermissionHelper {
|
||||||
let modules = Object.keys(permissions[section]) as Array<PermissionModule>;
|
let modules = Object.keys(permissions[section]) as Array<PermissionModule>;
|
||||||
for (let module of modules) {
|
for (let module of modules) {
|
||||||
let types = permissions[section][module];
|
let types = permissions[section][module];
|
||||||
if (types == "*") {
|
if (types == "*" || types.length == permissionTypes.length) {
|
||||||
output.push(`${section}.${module}.*`);
|
output.push(`${section}.${module}.*`);
|
||||||
} else {
|
} else {
|
||||||
for (let type of types) {
|
for (let type of types) {
|
||||||
|
@ -127,7 +127,11 @@ export default class PermissionHelper {
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
static getWhatToAdd() {}
|
static getWhatToAdd(before: Array<PermissionString>, after: Array<PermissionString>): Array<PermissionString> {
|
||||||
|
return after.filter((permission) => !before.includes(permission));
|
||||||
static getWhatToRemove() {}
|
}
|
||||||
|
|
||||||
|
static getWhatToRemove(before: Array<PermissionString>, after: Array<PermissionString>): Array<PermissionString> {
|
||||||
|
return before.filter((permission) => !after.includes(permission));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue