@refinio/one.models
    Preparing search index...

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

    Index

    Constructors

    Properties

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

    Methods

    • Returns the role names that are available.

      Returns string[]

      The role names that are available.

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

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

      The roles that are available for the given person.

    • 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

      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

      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 | default | (string | default)[]

        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 | default | (string | default)[]

        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 | default | (string | default)[]

        The role to check.

      Returns Promise<boolean>

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