BaseUser

documents. BaseUser

The base User model definition which defines common behavior of an User document between both client and server.

Constructor

new BaseUser()

Properties:
Name Type Description
data data.UserData

The constructed data object for the document.

Extends

  • Document

Members

(static) metadata

(static) schema

isGM :boolean

Test whether the User has a GAMEMASTER or ASSISTANT role in this World?

Type:
  • boolean

Methods

can(action) → {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:
Name Type Description
action string

The action to test

Returns:

Does the user have the ability to perform this action?

Type
boolean

getUserLevel()

hasPermission(permission) → {boolean}

Test whether the User has at least a specific permission

Parameters:
Name Type Description
permission string

The permission name from USER_PERMISSIONS to test

Returns:

Does the user have at least this permission

Type
boolean

hasRole(role, exactopt) → {boolean}

Test whether the User has at least the permission level of a certain role

Parameters:
Name Type Attributes Description
role string | number

The role name from USER_ROLES to test

exact boolean <optional>

Require the role match to be exact

Returns:

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

Type
boolean