Files
alfresco-ng2-components/docs/core/services/user-access.service.md
Maurizio Vitale 28a47e83d2 Fetch the userInfo once loggedIn and expose the capability of admin (#7682)
* Fetch the userInfo once loggedIn and expose the cabilibility of admin

* Rollback method

* Return same use if defined

* Use the same pepleContent service for UserInfoCOmpnent

* Remove useless import

* Use interface

* Use angular resolver instead of guard

* Remove fdescribe

* Fix linting

* Regenerate doc

* Improve doc

* Fix optional

* Fix the unit test

* Fix comment

* Fix lint

* Fix unit

* Add fetch user as part of the ssoGuard

* Fix unit test after fetch

* Add additional unit

* Fix await
2022-06-27 12:02:01 +01:00

30 lines
1.2 KiB
Markdown

---
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**(): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<void>`<br/>
Fetches the global and application access of the user
- **Returns** [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<void>` -
- **hasApplicationAccess**(appName: `string`, rolesToCheck: `string[]`): `boolean`<br/>
Checks for global roles access.
- _appName:_ `string` - The app name
- _rolesToCheck:_ `string[]` - List of the roles to check
- **Returns** `boolean` - True if it contains at least one of the given roles, false otherwise
- **hasGlobalAccess**(rolesToCheck: `string[]`): `boolean`<br/>
Checks for global roles access.
- _rolesToCheck:_ `string[]` - List of the roles to check
- **Returns** `boolean` - True if it contains at least one of the given roles, false otherwise
- **resetAccess**()<br/>
Resets the cached user access