Provides a suite of utilities for looking up users and groups in the current domain.

See some common use cases in the developer guide.

Note that users and groups cannot (yet) be managed through this service. See the REST API for domain user and group management.

This service can be accessed using ConvergenceDomain.identity.

### Hierarchy

- IdentityService

## Index

### Methods

- group
- groups
- groupsForUser
- groupsForUsers
- profile
- search
- session
- user
- userExists
- users

## Methods

### group

- group(id: string): Promise<UserGroup>

- Looks up a single user group by ID. Rejects the promise if no group by the provided ID exists.

  #### Parameters

  - ##### id: string

    the user group's ID

  #### Returns Promise<UserGroup>

  a promise to be resolved if the group exists, otherwise a rejection

### groups

- groups(ids: string[]): Promise<UserGroup[]>

- Looks up one or more User Groups by their User Group Ids. Each returned User Group will contain the details of the User Group, including an array of users ids for those users that are members of the group.

  Note: that if any of the provided User Group Ids does not exist, the promise will be rejected.

  #### Parameters

  - ##### ids: string[]

    An array of UserGroup Id's for the groups to get.

  #### Returns Promise<UserGroup[]>

  A promise resolved with an array of UserGroups that positionally correspond to the supplied User Group Id's.

### groupsForUser

- groupsForUser(username: string): Promise<string[]>

- Looks up the groups to which the provided user belongs.

  #### Parameters

  - ##### username: string

    an existing user's username

  #### Returns Promise<string[]>

  a promise to be resolved with an array of group IDs to which the given user belongs

### groupsForUsers

- groupsForUsers(usernames: string[]): Promise<object>

- Looks up the groups to which the provided users belong.

  #### Parameters

  - ##### usernames: string[]

    an array of usernames

  #### Returns Promise<object>

  a promise to be resolved with an array of group IDs to which the given user belongs

### profile

- profile(): Promise<DomainUser>

- Returns a promise that resolves with some information about the current user.

  #### Returns Promise<DomainUser>

  a promise to be resolved with the current user's information

### search

- search(query: UserQuery): Promise<DomainUser[]>

- Searches for DomainUsers based on the provided query configuration.

  #### Parameters

  - ##### query: UserQuery

    a query configuration including the actual query and fields to search on

  #### Returns Promise<DomainUser[]>

  A promise to be resolved with an array of users, or an empty array if there are no matches

### session

- session(): ConvergenceSession

- The current session.

  #### Returns ConvergenceSession

### user

- user(userId: DomainUserIdentifier): Promise<DomainUser>

- Looks up a user by either a username or DomainUserId.

  #### Parameters

  - ##### userId: DomainUserIdentifier

    either a username string or DomainUserId

  #### Returns Promise<DomainUser>

  a promise which will be resolved with a DomainUser if one is found, otherwise `undefined`

### userExists

- userExists(userId: DomainUserId): Promise<boolean>

- #### Parameters

  - ##### userId: DomainUserId

  #### Returns Promise<boolean>

### users

- users(users: DomainUserIdentifier[]): Promise<DomainUser[]>

- Looks up multiple users at once by username or DomainUserId.

  #### Parameters

  - ##### users: DomainUserIdentifier[]

    an array of username strings, DomainUserIds, or any combination therein

  #### Returns Promise<DomainUser[]>

  a promise which will be resolved with an array of length equal to `users`, with a DomainUser or `undefined` for each user query