Refactor hasAccess method in auth.service.ts to improve readability and optimize authorization checking logic.
This commit is contained in:
parent
28fd05a656
commit
b16fab26e7
|
|
@ -106,7 +106,8 @@ export class AuthService {
|
|||
return claims?.authorizations || [];
|
||||
}
|
||||
|
||||
public hasAccess(authorization: string[]): boolean {
|
||||
return this.getUserAuthorizations().filter(entry => authorization.includes(entry)).length > 0;
|
||||
public hasAccess(requiredAuthorizations: string[]): boolean {
|
||||
const userAuthorizations = this.getUserAuthorizations();
|
||||
return requiredAuthorizations.some(auth => userAuthorizations.includes(auth));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user