@@ -128,6 +128,24 @@ export class User extends Principal {
|
||||
@OneToMany(() => UserAction, action => action.user, { nullable: true })
|
||||
actions: UserAction[]
|
||||
|
||||
/**
|
||||
* 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());
|
||||
}
|
||||
|
||||
for (let group of this.groups) {
|
||||
for (let permission in group.permissions) {
|
||||
allPermissions.push(permission.toString());
|
||||
}
|
||||
}
|
||||
console.log(allPermissions)
|
||||
return Array.from(new Set(allPermissions));
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns this entity into it's response class.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user