Options
All
  • Public
  • Public/Protected
  • All
Menu

The Document definition for a User. Defines the DataSchema and common behaviors for a User which are shared between both client and server.

mixes

UserData

memberof

documents

param data

Initial data from which to construct the User

param context

Construction context options

Hierarchy

Index

Constructors

Accessors

  • get isGM(): boolean
  • Test whether the User has a GAMEMASTER or ASSISTANT role in this World?

    Returns boolean

Methods

  • can(action: string): boolean
  • Test whether the User is able to perform a certain permission action. The provided permission string may pertain to an explicit permission setting or a named user role. Alternatively, Gamemaster users are assumed to be allowed to take all actions.

    Parameters

    • action: string

      The action to test

    Returns boolean

    Does the user have the ability to perform this action?

  • getUserLevel(user: any): number
  • Get the permission level that a specific User has over this Document, a value in CONST.DOCUMENT_OWNERSHIP_LEVELS.

    Parameters

    • user: any

      The User being tested

    Returns number

    A numeric permission level from CONST.DOCUMENT_OWNERSHIP_LEVELS or null

  • hasPermission(permission: string): boolean
  • Test whether the User has at least a specific permission

    Parameters

    • permission: string

      The permission name from USER_PERMISSIONS to test

    Returns boolean

    Does the user have at least this permission

  • hasRole(role: string | number, [exact]?: boolean): boolean
  • Test whether the User has at least the permission level of a certain role

    Parameters

    • role: string | number

      The role name from USER_ROLES to test

    • [exact]: boolean = {}

      Require the role match to be exact

    Returns boolean

    Does the user have at this role level (or greater)?

  • #validateHotbar(bar: any): boolean
  • Validate the structure of the User hotbar object

    Parameters

    • bar: any

      The attempted hotbar data

    Returns boolean

  • #validatePermissions(perms: any): boolean
  • Validate the structure of the User permissions object

    Parameters

    • perms: any

      The attempted permissions data

    Returns boolean

  • Is a user able to create an existing User?

    Parameters

    • user: BaseUser

      The user attempting the creation.

    • doc: BaseUser

      The User document being created.

    • data: any

      The supplied creation data.

    Returns boolean

  • Is a user able to update an existing User?

    Parameters

    • user: BaseUser

      The user attempting the update.

    • doc: BaseUser

      The User document being updated.

    • changes: any

      Proposed changes.

    Returns boolean

  • Is a user able to delete an existing User? Only Assistants and Gamemasters can delete users, and only if the target user has a lesser or equal role.

    Parameters

    • user: BaseUser

      The user attempting the deletion.

    • doc: BaseUser

      The User document being deleted.

    Returns boolean

Properties

metadata: any = ...

Default metadata which applies to each instance of this Document type.