Dashboard: fix/updates (WIP)

Hide dahboard in menu when user doesn't have permission
This commit is contained in:
phil 2024-03-24 12:08:42 +05:30
parent 31165ce3d5
commit 89eae25604
19 changed files with 166 additions and 127 deletions

View file

@ -128,6 +128,7 @@ export class AuthenticationService {
isAuthorized(roles: string[]): Observable<boolean> {
// Return true if at least one role in given list matches one role of the authenticated user
if (roles.length == 0) return of(true)
if (roles.every(role => role == undefined)) return of(true)
// return this.roles.filter(value => -1 !== roles.indexOf(value.name)).length > 0
return this.configService.conf.pipe(map(
conf => conf.bsData?.user?.roles?.filter(value => -1 !== roles.indexOf(value.name)).length > 0