alfresco-ng2-components/docs/core/identity-user.service.md

3.4 KiB

Title, Added, Status, Last reviewed
Title Added Status Last reviewed
Identity user service v3.0.0 Active 2019-01-09

Identity user service

Gets OAuth2 personal details and roles for users.

Class members

Methods

  • getCurrentUserInfo(): IdentityUserModel
    Gets the name and other basic details of the current user.
  • getUserRoles(userId: string): Observable<IdentityRoleModel[]>
    Gets a list of roles for a user.
  • getUsers(): Observable<IdentityUserModel[]>
    Gets details for all users.
  • getUsersByRolesWithCurrentUser(roleNames: string[]): Promise<IdentityUserModel[]>
    Gets an array of users (including the current user) who have any of the roles in the supplied list.
    • roleNames: string[] - List of role names to look for
    • Returns Promise<IdentityUserModel[]> - Array of user info objects
  • getUsersByRolesWithoutCurrentUser(roleNames: string[]): Promise<IdentityUserModel[]>
    Gets an array of users (not including the current user) who have any of the roles in the supplied list.
    • roleNames: string[] - List of role names to look for
    • Returns Promise<IdentityUserModel[]> - Array of user info objects
  • getValueFromToken(key: string)
    Gets a named value from the user access token.
    • key: string - Key name of the field to retrieve

Details

OAuth2 defines an access token (used when authenticating a user) and a number of authentication roles that the user can participate in (see this page for an introduction to OAuth2 and a description of the roles). You can use the Identity user service to access this information for users, including the current user.

See also