@@ -132,18 +132,20 @@ export class User extends Principal {
|
||||
* Resolves all permissions granted to this user through groups or directly to the string enum format.
|
||||
*/
|
||||
public get allPermissions(): string[] {
|
||||
let allPermissions = new Array<string>();
|
||||
for (let permission in this.permissions) {
|
||||
allPermissions.push(permission.toString());
|
||||
let returnPermissions: string[] = new Array<string>();
|
||||
|
||||
if (!this.permissions) { return returnPermissions; }
|
||||
for (let permission of this.permissions) {
|
||||
returnPermissions.push(permission.toString());
|
||||
}
|
||||
|
||||
if (!this.groups) { return returnPermissions; }
|
||||
for (let group of this.groups) {
|
||||
for (let permission in group.permissions) {
|
||||
allPermissions.push(permission.toString());
|
||||
for (let permission of group.permissions) {
|
||||
returnPermissions.push(permission.toString());
|
||||
}
|
||||
}
|
||||
console.log(allPermissions)
|
||||
return Array.from(new Set(allPermissions));
|
||||
return Array.from(new Set(returnPermissions));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -91,5 +91,6 @@ export class ResponseUser extends ResponsePrincipal {
|
||||
this.profilePic = user.profilePic;
|
||||
this.groups = user.groups;
|
||||
this.permissions = user.allPermissions;
|
||||
this.groups.forEach(function (g) { delete g.permissions });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user