[AAE-8748] - Auth guards call api when access is not in JWT (#7662)

* [AAE-8748] - Auth guards call api when access is not in JWT

* [ci:force] fix unit tests

* Remove fdescribe

* Add documentation and unit tests for the user access service

* Rename mocks, make e2e independent

* Fix login e2e

* Move forbidden access e2e under cloud
This commit is contained in:
Ardit Domi
2022-06-07 09:21:54 +01:00
committed by GitHub
parent c95ff1a839
commit d8a4b5bcdb
12 changed files with 464 additions and 82 deletions

View File

@@ -0,0 +1,27 @@
---
Title: User access service
Added: v1.0.0
Status: Active
Last reviewed: 2022-06-05
---
# [User access service](../../../lib/core/services/user-access.service.ts "Defined in user-access.service.ts")
Checks the global and application access of a user
## Class members
### Methods
- **fetchUserAccess**()<br/>
Fetches the global and application access of the user
- **hasApplicationAccess**(appName: `string`, rolesToCheck: string[]): `boolean`<br/>
Checks if the user has at least one of the roles to check for a given app.
- appName: `string` - The name of the app
- rolesToCheck: `string[]` - The roles to check
- **Returns** `boolean` - True if it contains at least one of the given roles to check for the given app, false otherwise
- **hasGlobalAccess**(rolesToCheck: string[]): `boolean`<br/>
Checks if the user has at least one of the given roles to check in the global roles.
- rolesToCheck: `string[]` - The roles to check
- **Returns** `boolean` - True if it contains at least one of the given roles to check, false otherwise
- **resetAccess**() <br>
Resets the cached access of the user