RED-3800 fixed permissions to be generic
This commit is contained in:
parent
d1fbfd78c9
commit
2c7fb90f8c
@ -18,7 +18,7 @@ import { IqserPermissionsService, IqserRolesService } from '../../permissions';
|
||||
|
||||
interface IToken {
|
||||
sub: string;
|
||||
resource_access: { account: { roles: List }; redaction: { roles: List } };
|
||||
resource_access: { account: { roles: List }; [key: string]: { roles: List } };
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
@ -85,7 +85,8 @@ export abstract class IqserUserService<
|
||||
const token = await this._keycloakService.getToken();
|
||||
const decoded: IToken = jwt_decode(token);
|
||||
const userId = decoded.sub;
|
||||
this._permissionsService.load(decoded.resource_access.redaction.roles);
|
||||
const rolesField = this._keycloakService.getKeycloakInstance().realm || '';
|
||||
this._permissionsService.load(decoded.resource_access[rolesField].roles);
|
||||
|
||||
const roles = this._keycloakService.getUserRoles(true).filter(role => this._rolesFilter(role));
|
||||
this._rolesService.load(roles);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user