@acceleratxr/core_sdk / UserUtils
Class: UserUtils#
Utilities for working with authenticated user objects. An user object is expected to have the following properties.
uid- Universally unique identifier for the useremail- Unique e-mail address for the userroles- A list of unique names indicating the permissions of the user.verified- Indicates if the user’s e-mail address has been verified.
author Jean-Philippe Steinmetz info@acceleratxr.com
Hierarchy#
UserUtils
Index#
Methods#
Methods#
getExternalId#
▸ StaticgetExternalId(user: any, type: string): string | undefined
Defined in src/utils/UserUtils.ts:96
Returns the unique identifier of the specified type associated with the given user.
parm user The user to retrieve the external id from.
Parameters:#
Name |
Type |
Description |
|---|---|---|
|
any |
- |
|
string |
The type of external provider to retrieve. |
Returns: string | undefined
The unique id of the external provider for the given type if found, otherwise undefined.
hasOrganization#
▸ StatichasOrganization(user: any, organizationUid: string): boolean
Defined in src/utils/UserUtils.ts:22
Returns true if the given user object is a member of the organization with the specified uid, otherwise returns false.
Parameters:#
Name |
Type |
Description |
|---|---|---|
|
any |
The user object to inspect. |
|
string |
The universally unique identifier of the persona to search for. |
Returns: boolean
hasOrganizations#
▸ StatichasOrganizations(user: any, organizationUids: string[]): boolean
Defined in src/utils/UserUtils.ts:39
Returns true if the given user object contains is a member of an organization matching one of the uids in the specified list, otherwise returns false.
Parameters:#
Name |
Type |
Description |
|---|---|---|
|
any |
The user object to inspect. |
|
string[] |
The list of universally unique identifiers to search for. |
Returns: boolean
hasPersona#
▸ StatichasPersona(user: any, personaUid: string): boolean
Defined in src/utils/UserUtils.ts:58
Returns true if the given user object contains a Persona object with the specified uid, otherwise returns false.
Parameters:#
Name |
Type |
Description |
|---|---|---|
|
any |
The user object to inspect. |
|
string |
The universally unique identifier of the persona to search for. |
Returns: boolean
hasPersonas#
▸ StatichasPersonas(user: any, personaUids: string[]): boolean
Defined in src/utils/UserUtils.ts:75
Returns true if the given user object contains a Persona object matching one of the uids in the specified list, otherwise returns false.
Parameters:#
Name |
Type |
Description |
|---|---|---|
|
any |
The user object to inspect. |
|
string[] |
- |
Returns: boolean
hasRole#
▸ StatichasRole(user: any, role: string, orgUid?: undefined | string): boolean
Defined in src/utils/UserUtils.ts:118
Returns true if the given user object has a role with the specified name, otherwise returns false.
Parameters:#
Name |
Type |
Description |
|---|---|---|
|
any |
The user object to inspect. |
|
string |
The unique name of the role to search for. |
|
undefined | string |
The unique identifier of an organization whose role will be verified. |
Returns: boolean
hasRoles#
▸ StatichasRoles(user: any, roles: string[], orgUid?: undefined | string): boolean
Defined in src/utils/UserUtils.ts:143
Returns true if the given user object has at least one role from the specified list of names, otherwise returns false.
Parameters:#
Name |
Type |
Description |
|---|---|---|
|
any |
The user object to inspect. |
|
string[] |
A list of unique names of the roles to search for. |
|
undefined | string |
The unique identifier of an organization whose role will be verified. |
Returns: boolean