new User()
- Source:
Extends
Members
(readonly) acl :Acl
The object read/write permissions
Type:
- Inherited From:
- Source:
(readonly) createdAt :Date
Date of the creation of the object
Type:
- Date
- Inherited From:
- Source:
id :string
The unique id of this object
Sets the unique id of this object, if the id is not formatted as an valid id,
it will be used as the key component of the id has the same affect as setting the key
Type:
- string
- Inherited From:
- Source:
inactive :boolean
Indicates if the user is currently inactive, which disallow user login
Type:
- boolean
- Source:
key :string
The unique key part of the id
When the key of the unique id is set an error will be thrown if an id is already set.
Type:
- string
- Inherited From:
- Source:
(readonly) updatedAt :Date
Last update date of the object
Type:
- Date
- Inherited From:
- Source:
username :string
The users username or email address
Type:
- string
- Source:
(readonly) version :number
The version of this object
Type:
- number
- Inherited From:
- Source:
Methods
attach(db) → {void}
Attach this object to the given db
Parameters:
Name | Type | Description |
---|---|---|
db |
EntityManager | The db which will be used for future crud operations |
- Inherited From:
- Source:
Returns:
- Type
- void
changeUsername(newUsername, password, doneCallbackopt, failCallbackopt) → {Promise.<*>}
Change the username of the current user
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
newUsername |
string | New username for the current user |
|
password |
string | The password of the current user |
|
doneCallback |
binding.Entity~doneCallback |
<optional> |
Called when the operation succeed. |
failCallback |
binding.Entity~failCallback |
<optional> |
Called when the operation failed. |
- Source:
Returns:
- Type
- Promise.<*>
delete(optionsopt, doneCallbackopt, failCallbackopt) → {Promise.<this>}
Deletes an existing object
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
The remove options |
|||||||||||||||
Properties
|
||||||||||||||||||
doneCallback |
binding.Entity~doneCallback |
<optional> |
Called when the operation succeed. |
|||||||||||||||
failCallback |
binding.Entity~failCallback |
<optional> |
Called when the operation failed. |
- Inherited From:
- Source:
Returns:
A Promise that will be fulfilled when the asynchronous operation completes.
- Type
- Promise.<this>
getReferencing(optionsopt) → {Promise.<binding.Entity>}
Get all objects which refer to this object
Parameters:
Name | Type | Attributes | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
Some options to pass |
||||||||
Properties
|
- Inherited From:
- Source:
Returns:
A promise resolving with an array of all referencing objects
- Type
- Promise.<binding.Entity>
insert(optionsopt, doneCallbackopt, failCallbackopt) → {Promise.<this>}
Inserts a new object. Inserts the object if it doesn't exists and raise an error if the object already exist.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
The insertion options |
|||||||||||||||
Properties
|
||||||||||||||||||
doneCallback |
binding.Entity~doneCallback |
<optional> |
Called when the operation succeed. |
|||||||||||||||
failCallback |
binding.Entity~failCallback |
<optional> |
Called when the operation failed. |
- Inherited From:
- Source:
Returns:
A Promise that will be fulfilled when the asynchronous operation completes.
- Type
- Promise.<this>
load(optionsopt, doneCallbackopt, failCallbackopt) → {Promise.<this>}
Resolves the referenced object in the specified depth
Only unresolved objects will be loaded unless the refresh option is specified.
Removed objects will be marked as removed.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
The load options |
|||||||||||||||
Properties
|
||||||||||||||||||
doneCallback |
binding.Entity~doneCallback |
<optional> |
Called when the operation succeed. |
|||||||||||||||
failCallback |
binding.Entity~failCallback |
<optional> |
Called when the operation failed. |
- Inherited From:
- Source:
Returns:
A Promise that will be fulfilled when the asynchronous operation completes.
- Type
- Promise.<this>
newPassword(currentPassword, password, doneCallbackopt, failCallbackopt) → {Promise.<model.User>}
Change the password of the given user
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
currentPassword |
string | Current password of the user |
|
password |
string | New password of the user |
|
doneCallback |
binding.Entity~doneCallback |
<optional> |
Called when the operation succeed. |
failCallback |
binding.Entity~failCallback |
<optional> |
Called when the operation failed. |
- Source:
Returns:
- Type
- Promise.<model.User>
optimisticSave(cb, doneCallbackopt, failCallbackopt) → {Promise.<this>}
Saves the object and repeats the operation if the object is out of date
In each pass the callback will be called. Ths first parameter of the callback is the entity and the second one
is a function to abort the process.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
cb |
function | Will be called in each pass |
|
doneCallback |
binding.Entity~doneCallback |
<optional> |
Called when the operation succeed. |
failCallback |
binding.Entity~failCallback |
<optional> |
Called when the operation failed. |
- Inherited From:
- Source:
Returns:
A Promise that will be fulfilled when the asynchronous operation completes.
- Type
- Promise.<this>
partialUpdate(operationsopt) → {partialupdate.EntityPartialUpdateBuilder.<this>}
Starts a partial update on this entity
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
operations |
json |
<optional> |
- Inherited From:
- Source:
Returns:
ready(doneCallbackopt) → {Promise.<this>}
Waits on the previously requested operation on this object completes
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
doneCallback |
binding.Entity~doneCallback |
<optional> |
The callback which will be invoked when the previously |
- Inherited From:
- Source:
Returns:
A promise which completes successfully, when the previously requested
operation completes
- Type
- Promise.<this>
requestAPIToken(doneCallbackopt, failCallbackopt) → {Promise.<*>}
Requests a perpetual token for the user
Only users with the admin role are allowed to request an API token.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
doneCallback |
binding.Entity~doneCallback |
<optional> |
Called when the operation succeed. |
failCallback |
binding.Entity~failCallback |
<optional> |
Called when the operation failed. |
- Source:
Returns:
- Type
- Promise.<*>
save(optionsopt, doneCallbackopt, failCallbackopt) → {Promise.<this>}
Saves the object. Inserts the object if it doesn't exists and updates the object if the object exist.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
The save options |
||||||||||||||||||||
Properties
|
|||||||||||||||||||||||
doneCallback |
binding.Entity~doneCallback |
<optional> |
Called when the operation succeed. |
||||||||||||||||||||
failCallback |
binding.Entity~failCallback |
<optional> |
Called when the operation failed. |
- Inherited From:
- Source:
Returns:
A Promise that will be fulfilled when the asynchronous operation completes.
- Type
- Promise.<this>
toJSON(optionsopt) → {json}
Converts the object to an JSON-Object
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | boolean |
<optional> |
false | to json options by default excludes the metadata |
||||||||||||||
Properties
|
- Inherited From:
- Source:
Returns:
JSON-Object
- Type
- json
update(optionsopt, doneCallbackopt, failCallbackopt) → {Promise.<this>}
Updates an existing object
Updates the object if it exists and raise an error if the object doesn't exist.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
The update options |
||||||||||||||||||||
Properties
|
|||||||||||||||||||||||
doneCallback |
binding.Entity~doneCallback |
<optional> |
Called when the operation succeed. |
||||||||||||||||||||
failCallback |
binding.Entity~failCallback |
<optional> |
Called when the operation failed. |
- Inherited From:
- Source:
Returns:
A Promise that will be fulfilled when the asynchronous operation completes.
- Type
- Promise.<this>
validate() → {util.ValidationResult}
Validates the entity by using the validation code of the entity type
- Inherited From:
- Source:
Returns:
Contains the result of the Validation