Interface Role

Roles are aggregations of multiple Users with a given purpose.

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

name: null | string = null

The name of the role

updatedAt?: null | Date

Last update date of the object

Name

updatedAt

Member Of

Entity.prototype

users: null | Set<model.User> = null

A set of users which have this role

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

  • Add the given user to this role

    Parameters

    Returns void

  • 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

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

  • 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[]>

  • Test if the given user has this role

    Returns

    true if the given user has this role, otherwise false

    Parameters

    Returns boolean

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

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

  • 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.Role, abort: (() => void)) => any)

      Will be called in each pass

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

          • entity: model.Role
          • 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.Role>

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

  • 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.Role) => R)

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

    Returns Promise<R>

  • Remove the given user from this role

    Parameters

    Returns void

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

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

  • 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