The RoleManager class is responsible for managing the roles of the current main identity.

Constructors

Properties

onCurrentPersonRoleChange: OEvent<((roles: Role[]) => void)>
onRoleFound: OEvent<(() => void)>

Methods

  • Returns the role names that are available.

    Returns string[]

    The role names that are available.

  • Returns the creatable roles for the current main identity.

    Returns Role[]

    The creatable roles for the current main identity.

  • Returns the role names that are currently available for the current main identity.

    Returns string[]

    The role names that are currently available for the current main identity.

  • Returns

    • The roles that are currently available for the current main identity.
    • Undefined if the roles are not initialised yet.

    Returns undefined | Role[]

  • Returns the roles that can be created for the given person.

    Parameters

    • person: SHA256IdHash<Person>

      The person to check.

    Returns Promise<default[]>

    The roles that can be created for the given person.

  • Returns the role names that are available for the given person.

    Parameters

    • person: SHA256IdHash<Person>

      The person to check.

    Returns Promise<string[]>

    The role names that are available for the given person.

  • Returns the roles that are available for the given person.

    Parameters

    • person: SHA256IdHash<Person>

      The person to check.

    Returns Promise<Role[]>

    The roles that are available for the given person.

  • Returns the role that is available.

    Type Parameters

    Parameters

    • role: string

      The role to get.

    Returns undefined | T

    The role that is available.

  • Initializes the role manager.

    Returns Promise<void>

    A promise that resolves when the role manager is initialised.

  • Returns true if the given role can be created.

    Parameters

    • role: string | Role | (string | Role)[]

      The role to check.

    Returns boolean

    True if the given role can be created, false otherwise.

  • Returns true if the current main identity can create the given role.

    Parameters

    • role: string | Role | (string | Role)[]

      The role to check.

    Returns boolean

    True if the current main identity can create the given role, false otherwise.

  • Returns true if the current main identity has the role.

    Parameters

    • role: string | Role | (string | Role)[]

      The role, role name or array of those to check.

    Returns boolean

    True if the current main identity has the role, false otherwise.

  • Returns true if the given person can create the given role.

    Parameters

    • person: SHA256IdHash<Person>

      The person to check.

    • role: string | Role | (string | Role)[]

      The role to check.

    Returns Promise<boolean>

    True if the given person can create the given role, false otherwise.

  • Returns true if the given person has the given role.

    Parameters

    • person: SHA256IdHash<Person>

      The person to check.

    • role: string | Role | (string | Role)[]

      The role to check.

    Returns Promise<boolean>

    True if the given person has the given role, false otherwise.