Interface User

Users are representations of people using the app.

Hierarchy

Properties

_metadata: Metadata

Contains the metadata of this managed object

createdAt?: null | Date

Date of the creation of the object

Name

createdAt

Member Of

Entity.prototype

inactive?: null | boolean

Indicates if the user is currently inactive, which disallow user login

updatedAt?: null | Date

Last update date of the object

Name

updatedAt

Member Of

Entity.prototype

username?: null | string

The users username or email address

Accessors

  • get acl(): Acl
  • The object read/write permissions

    Returns Acl

  • get id(): null | 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

    Returns null | string

  • set id(value: null | string): void
  • Parameters

    • value: null | string

    Returns void

  • get key(): null | 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.

    Returns null | string

  • set key(value: null | string): void
  • Parameters

    • value: null | string

    Returns void

  • get version(): null | number
  • The version of this object

    Returns null | number

Methods

  • Attach this object to the given db

    Returns

    Parameters

    • db: EntityManager

      The db which will be used for future crud operations

    Returns void

  • Returns void

  • Change the username of the current user

    Returns

    Parameters

    • newUsername: string

      New username for the current user

    • password: string

      The password of the current user

    • Optional doneCallback: any

      Called when the operation succeed.

    • Optional failCallback: any

      Called when the operation failed.

    Returns Promise<any>

  • Deletes an existing object

    Returns

    A Promise that will be fulfilled when the asynchronous operation completes.

    Method

    Parameters

    • Optional options: {
          depth?: number | boolean;
          force?: boolean;
      }

      The remove options

      • Optional depth?: number | boolean

        The object depth which will be removed. Depth 0 removes this object only, true removes objects by reachability.

      • Optional force?: boolean

        Force the remove operation, the version will not be validated.

    • Optional doneCallback: any

      Called when the operation succeed.

    • Optional failCallback: any

      Called when the operation failed.

    Returns Promise<model.User>

  • Get all objects which refer to this object

    Returns

    A promise resolving with an array of all referencing objects

    Method

    Parameters

    • Optional options: {
          classes: string[];
      }

      Some options to pass

      • classes: string[]

        An array of class names to filter for, null for no filter

    Returns Promise<Entity[]>

  • Inserts a new object. Inserts the object if it doesn't exists and raise an error if the object already exist.

    Returns

    A Promise that will be fulfilled when the asynchronous operation completes.

    Method

    Parameters

    • Optional options: {
          depth?: number | boolean;
          refresh?: boolean;
      }

      The insertion options

      • Optional depth?: number | boolean

        The object depth which will be inserted. Depth 0 insert this object only, true inserts objects by reachability.

      • Optional refresh?: boolean

        Refresh the local object state from remote.

    • Optional doneCallback: any

      Called when the operation succeed.

    • Optional failCallback: any

      Called when the operation failed.

    Returns Promise<model.User>

  • 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.

    Returns

    A Promise that will be fulfilled when the asynchronous operation completes.

    Method

    Parameters

    • Optional options: {
          depth?: number | boolean;
          refresh?: boolean;
      }

      The load options

      • Optional depth?: number | boolean

        The object depth which will be loaded. Depth set to true loads objects by reachability.

      • Optional refresh?: boolean

        Refresh the local object state from remote.

    • Optional doneCallback: any

      Called when the operation succeed.

    • Optional failCallback: any

      Called when the operation failed.

    Returns Promise<model.User>

  • Change the password of the given user

    Returns

    Parameters

    • currentPassword: string

      Current password of the user

    • password: string

      New password of the user

    • Optional doneCallback: any

      Called when the operation succeed.

    • Optional failCallback: any

      Called when the operation failed.

    Returns Promise<model.User>

  • 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.

    Returns

    A Promise that will be fulfilled when the asynchronous operation completes.

    Method

    Parameters

    • cb: ((entity: model.User, abort: (() => void)) => any)

      Will be called in each pass

        • (entity: model.User, abort: (() => void)): any
        • Parameters

          • entity: model.User
          • abort: (() => void)
              • (): void
              • Returns void

          Returns any

    • Optional doneCallback: any

      Called when the operation succeed.

    • Optional failCallback: any

      Called when the operation failed.

    Returns Promise<model.User>

  • Waits on the previously requested operation on this object completes operations on this object is completed.

    Returns

    A promise which completes successfully, when the previously requested operation completes

    Returns Promise<model.User>

  • Waits on the previously requested operation on this object completes

    Returns

    A promise which completes successfully, when the previously requested operation completes

    Type Parameters

    • R

    Parameters

    • doneCallback: ((entity: model.User) => R)

      The callback which will be invoked when the previously operations on this object is completed.

    Returns Promise<R>

  • Requests a perpetual token for the user

    Only users with the admin role are allowed to request an API token.

    Returns

    Parameters

    • Optional doneCallback: any

      Called when the operation succeed.

    • Optional failCallback: any

      Called when the operation failed.

    Returns Promise<JsonMap>

  • Saves the object. Inserts the object if it doesn't exists and updates the object if the object exist.

    Returns

    A Promise that will be fulfilled when the asynchronous operation completes.

    Parameters

    • Optional options: {
          depth?: number | boolean;
          force?: boolean;
          refresh?: boolean;
      }

      The save options

      • Optional depth?: number | boolean

        The object depth which will be saved. Depth 0 save this object only, true saves the objects by reachability.

      • Optional force?: boolean

        Force the save operation, the version will not be validated.

      • Optional refresh?: boolean

        Refresh the local object state from remote.

    • Optional doneCallback: any

      Called when the operation succeed.

    • Optional failCallback: any

      Called when the operation failed.

    Returns Promise<model.User>

  • Converts the object to an JSON-Object

    Returns

    JSON-Object

    Method

    Parameters

    • Optional options: boolean | {
          depth?: number | boolean;
          excludeMetadata?: boolean;
      }

      to json options by default excludes the metadata

    Returns Json

  • Returns this object identifier or the baqend type of this object

    Returns

    the object id or type whatever is available

    Returns string

  • Updates an existing object

    Updates the object if it exists and raise an error if the object doesn't exist.

    Returns

    A Promise that will be fulfilled when the asynchronous operation completes.

    Method

    Parameters

    • Optional options: {
          depth?: number | boolean;
          force?: boolean;
          refresh?: boolean;
      }

      The update options

      • Optional depth?: number | boolean

        The object depth which will be updated. Depth 0 updates this object only, true updates objects by reachability.

      • Optional force?: boolean

        Force the update operation, the version will not be validated, only existence will be checked.

      • Optional refresh?: boolean

        Refresh the local object state from remote.

    • Optional doneCallback: any

      Called when the operation succeed.

    • Optional failCallback: any

      Called when the operation failed.

    Returns Promise<model.User>

  • Validates the entity by using the validation code of the entity type

    Returns

    Contains the result of the Validation

    Method

    Returns ValidationResult

Generated using TypeDoc