new User(setup)
Creates a new instance of the User class.
Parameters:
| Name | Type | Description |
|---|---|---|
setup |
Object | The setup object containing user details. |
- Source:
Throws:
-
If setup parameters are missing or invalid.
- Type
- Error.Log
Members
auth
Gets the AuthBucket instance associated with this user.
- Source:
authService
Gets the AuthService instance associated with this user.
- Source:
collectionName
The collection name for this user.
Properties:
| Type | Description |
|---|---|
| string |
- Source:
currentUser
Gets the current user session.
- Source:
displayName
The display name of the user.
Properties:
| Type | Description |
|---|---|
| string |
- Source:
The email address of the user.
Properties:
| Type | Description |
|---|---|
| string |
- Source:
firstName
The first name of the user.
Properties:
| Type | Description |
|---|---|
| string |
- Source:
frontURL
The front-end URL associated with this user.
Properties:
| Type | Description |
|---|---|
| string |
- Source:
fullName
Gets the full name of the user.
- Source:
lastName
The last name of the user.
Properties:
| Type | Description |
|---|---|
| string |
- Source:
phone
The phone number of the user.
Properties:
| Type | Description |
|---|---|
| string |
- Source:
token
Gets the user token associated with this user.
- Source:
userName
The username associated with this user.
Properties:
| Type | Description |
|---|---|
| string |
- Source:
userSession
Gets the session information for this user.
- Source:
Methods
(async) signOut() → {Promise}
Signs out the user.
- Source:
Throws:
-
If there is an error during the sign-out process.
- Type
- Error.Log
Returns:
- A promise resolving to the sign-out status.
- Type
- Promise
toPublic(append) → {Object}
Converts the user information to a public object, excluding sensitive data.
Parameters:
| Name | Type | Description |
|---|---|---|
append |
Object | Additional data to append to the public object. |
- Source:
Returns:
- The public object representing the user information.
- Type
- Object
toSession() → {Object}
Converts the user information to a session object.
- Source:
Returns:
- The session object representing the user information.
- Type
- Object
(async, static) create(setup, options) → {Promise}
Static method to create a new user.
Parameters:
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
setup |
Object | The user setup object containing necessary details. |
||||||
options |
Object | Additional options for user creation. Properties
|
- Source:
Throws:
-
If there is an error during user creation.
- Type
- Error.Log
Returns:
- A promise resolving to the user creation status.
- Type
- Promise
(static) currentUser() → {Object}
Static method to retrieve the current user session information.
- Source:
Returns:
- The current user session information.
- Type
- Object
(async, static) getMyUser(filter) → {Promise.<User>}
Static method to retrieve the current user's information.
Parameters:
| Name | Type | Description |
|---|---|---|
filter |
Object | The filter object to use for user retrieval. |
- Source:
Throws:
-
If there is an error during user retrieval.
- Type
- Error.Log
Returns:
- A promise resolving to the user object.
- Type
- Promise.<User>
(async, static) getUser(filter) → {Promise.<User>}
Static method to retrieve user information based on the provided filter.
Parameters:
| Name | Type | Description |
|---|---|---|
filter |
Object | The filter object to use for user retrieval. |
- Source:
Throws:
-
If there is an error during user retrieval.
- Type
- Error.Log
Returns:
- A promise resolving to the user object.
- Type
- Promise.<User>
(async, static) isExist(userName, returnUID) → {Promise.<(boolean|string)>}
Static method to check if a user with the given username exists.
Parameters:
| Name | Type | Description |
|---|---|---|
userName |
string | The username to check for existence. |
returnUID |
boolean | Indicates whether to return the user ID if the user exists. |
- Source:
Throws:
-
If there is an error during the existence check.
- Type
- Error.Log
Returns:
- A promise resolving to
trueif the user exists, or the user ID ifreturnUIDistrue.
- Type
- Promise.<(boolean|string)>
(async, static) signIn(userName, password) → {Promise.<(User|Error.Log)>}
Static method to sign in a user.
Parameters:
| Name | Type | Description |
|---|---|---|
userName |
string | The username of the user to sign in. |
password |
string | The user's password. |
- Source:
Throws:
-
If there is an error during sign-in.
- Type
- Error.Log
Returns:
- A promise resolving to the signed-in user object, or an error object if sign-in fails.
- Type
- Promise.<(User|Error.Log)>
(static) userSession() → {Object}
Static method to retrieve user session information.
- Source:
Returns:
- The user session information.
- Type
- Object