A user data model.

Written by Hunter Perrin for SciActive.

Author

Hunter Perrin [email protected]

Copyright

SciActive Inc

See

http://nymph.io/

Hierarchy

Constructors

Properties

$allowlistData?: string[] = ...
$allowlistTags?: string[] = []
$clientEnabledMethods: string[] = ...
$data: UserData
$dataHandler: Object
$dataStore: UserData
$descendantGroups?: (Group & GroupData)[]

The user's group descendants.

$gatekeeperCache?: {
    [k: string]: true;
}

Gatekeeper ability cache.

Gatekeeper will cache the user's abilities that it calculates, so it can check faster if that user has been checked before.

Type declaration

  • [k: string]: true
$isASleepingReference: boolean
$nymph: default
$originalEmail?: string

Used to save the current email address to send verification if it changes from the frontend.

If you are changing a user's email address and want to bypass email verification, don't set this.

$privateData: string[] = ...
$protectedData: string[]
$protectedTags: string[]
$sdata: SerializedEntityData
$skipAcWhenSaving: boolean = false

This is explicitly used only during the registration proccess.

$sleepingReference: null | EntityReference
cdate: null | number
guid: null | string
mdate: null | number
tags: string[]
DEFAULT_ALLOWLIST_DATA: string[] = []
DEFAULT_CLIENT_ENABLED_METHODS: string[] = ...
DEFAULT_PRIVATE_DATA: string[] = ...
ETYPE: string = 'tilmeld_user'

The instance of Tilmeld to use for queries.

afterLoginCallbacks: TilmeldAfterLoginCallback[] = []
afterLogoutCallbacks: TilmeldAfterLogoutCallback[] = []
afterRegisterCallbacks: TilmeldAfterRegisterCallback[] = []
beforeLoginCallbacks: TilmeldBeforeLoginCallback[] = []
beforeLogoutCallbacks: TilmeldBeforeLogoutCallback[] = []
beforeRegisterCallbacks: TilmeldBeforeRegisterCallback[] = []
checkUsernameCallbacks: TilmeldCheckUsernameCallback[] = []
class: string = 'User'
clientEnabledStaticMethods: string[] = ...
nymph: default
pubSubEnabled: boolean
restEnabled: boolean
searchRestrictedData: string[] = ...

Methods

  • Parameters

    • Rest ...tags: string[]

    Returns void

  • Parameters

    • array: any[]
    • Optional strict: boolean

    Returns number

  • A frontend accessible method to change the user's password.

    Parameters

    • data: {
          currentPassword: string;
          newPassword: string;
          revokeCurrentTokens?: boolean;
      }

      The input data from the client.

      • currentPassword: string
      • newPassword: string
      • Optional revokeCurrentTokens?: boolean

    Returns Promise<{
        message: string;
        result: boolean;
    }>

    An object with a boolean 'result' entry and a 'message' entry.

  • Check that an email is unique.

    Returns Promise<{
        message: string;
        result: boolean;
    }>

    An object with a boolean 'result' entry and a 'message' entry.

  • Check the given password against the user's.

    Parameters

    • password: string

      The password in question.

    Returns boolean

    True if the passwords match, otherwise false.

  • Check that a phone number is unique.

    Returns Promise<{
        message: string;
        result: boolean;
    }>

    An object with a boolean 'result' entry and a 'message' entry.

  • Check the given code against the user's TOTP secret.

    Parameters

    • code: string

      The code in question.

    Returns boolean

    True if the code is valid, otherwise false.

  • Check that a username is valid.

    Returns Promise<{
        message: string;
        result: boolean;
    }>

    An object with a boolean 'result' entry and a 'message' entry.

  • Parameters

    • object: any

    Returns boolean

  • Check to see if a user has an ability.

    This function will check both user and group abilities, if the user is marked to inherit the abilities of its group.

    If ability is undefined, it will check to see if the user is currently logged in.

    If the user has the "system/admin" ability, this function will return true.

    Parameters

    • Optional ability: string

      The ability.

    Returns boolean

    True or false.

  • Parameters

    • Optional includeSData: boolean

    Returns any

  • A frontend accessible method to generate a new TOTP secret.

    Returns Promise<{
        qrcode: string;
        secret: string;
        uri: string;
    }>

    An object with 'uri', 'qrcode', and 'secret'.

  • Returns ACProperties

  • Returns SerializedEntityData

  • Returns string[]

  • Parameters

    • Rest ...tags: string[]

    Returns boolean

  • Parameters

    • array: any[]
    • Optional strict: boolean

    Returns boolean

  • Check whether the user is in a (primary or secondary) group.

    Parameters

    Returns boolean

    True or false.

  • Parameters

    • object: any

    Returns boolean

  • Parameters

    • data: {
          additionalData?: {
              [k: string]: any;
          };
          code?: string;
          password: string;
          username: string;
      }
      • Optional additionalData?: {
            [k: string]: any;
        }
        • [k: string]: any
      • Optional code?: string
      • password: string
      • username: string

    Returns Promise<{
        message: string;
        needTOTP: boolean;
        result: boolean;
    } | {
        message: any;
        needTOTP?: undefined;
        result: boolean;
    }>

  • Log a user out of the system.

    Returns Promise<{
        message: any;
        result: boolean;
    }>

    An object with a boolean 'result' entry and a 'message' entry.

  • Change the user's password.

    Parameters

    • password: string

      The new password.

    Returns string

    The resulting password or hash which is stored in the entity.

  • Parameters

    • reference: EntityReference

    Returns void

  • Returns boolean

  • Returns Promise<boolean | 0>

  • Parameters

    • data: {
          additionalData?: {
              [k: string]: any;
          };
          password: string;
      }
      • Optional additionalData?: {
            [k: string]: any;
        }
        • [k: string]: any
      • password: string

    Returns Promise<{
        loggedin: boolean;
        message: string;
        result: boolean;
    }>

  • A frontend accessible method to remove the TOTP secret from the user's account.

    Parameters

    • data: {
          code: string;
          password: string;
      }

      The input data from the client.

      • code: string
      • password: string

    Returns Promise<{
        message: string;
        result: boolean;
    }>

    An object with a boolean 'result' entry and a 'message' entry.

  • Parameters

    • Rest ...tags: string[]

    Returns void

  • A frontend accessible method to revoke all currently issued tokens.

    Parameters

    • data: {
          password: string;
      }

      The input data from the client.

      • password: string

    Returns Promise<{
        message: string;
        result: boolean;
    }>

    An object with a boolean 'result' entry and a 'message' entry.

  • A frontend accessible method to save a TOTP secret into the user's account.

    Parameters

    • data: {
          code: string;
          password: string;
          secret: string;
      }

      The input data from the client.

      • code: string
      • password: string
      • secret: string

    Returns Promise<{
        message: string;
        result: boolean;
    }>

    An object with a boolean 'result' entry and a 'message' entry.

  • Send the user email verification/change/cancellation links.

    Returns Promise<boolean>

    True on success, false on failure.

  • Parameters

    • Optional data: {
          additionalData?: {
              [k: string]: any;
          };
      }
      • Optional additionalData?: {
            [k: string]: any;
        }
        • [k: string]: any

    Returns Promise<{
        message: any;
        result: boolean;
    }>

  • Returns User | EntityReference

  • Update the data protection arrays for a user.

    Parameters

    • Optional givenUser: User & UserData

      User to update protection for. If undefined, will use the currently logged in user.

    Returns void

  • Parameters

    • skipAc: boolean

    Returns void

  • Returns null | EntityJson | EntityReference

  • Returns {
        allowRegistration: boolean;
        allowUsernameChange: boolean;
        emailUsernames: boolean;
        pwRecovery: boolean;
        regFields: string[];
        unverifiedAccess: boolean;
        userFields: string[];
        verifyEmail: boolean;
    }

    • allowRegistration: boolean
    • allowUsernameChange: boolean
    • emailUsernames: boolean
    • pwRecovery: boolean
    • regFields: string[]
    • unverifiedAccess: boolean
    • userFields: string[]
    • verifyEmail: boolean
  • Parameters

    • data: {
          additionalData?: {
              [k: string]: any;
          };
          code?: string;
          password: string;
          username: string;
      }
      • Optional additionalData?: {
            [k: string]: any;
        }
        • [k: string]: any
      • Optional code?: string
      • password: string
      • username: string

    Returns Promise<{
        message: string;
        result: boolean;
        user?: User & UserData;
    }>

  • Recover account details.

    Parameters

    • data: {
          password: string;
          secret: string;
          username: string;
      }

      The input data from the client.

      • password: string
      • secret: string
      • username: string

    Returns Promise<{
        message: string;
        result: boolean;
    }>

    An object with a boolean 'result' entry and a 'message' entry.

  • Send an account recovery link.

    Parameters

    • data: {
          account: string;
          recoveryType: "password" | "username";
      }

      The input data from the client.

      • account: string
      • recoveryType: "password" | "username"

    Returns Promise<{
        message: string;
        result: boolean;
    }>

    An object with a boolean 'result' entry and a 'message' entry.

Generated using TypeDoc