Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface SecurityScriptBuilder

A builder that can be used to create scripts for use with updateSecurityStore.

Facilitates producing scripts that control the assignment of permissions to roles.

Hierarchy

  • SecurityScriptBuilder

Index

Methods

build

  • build(): string
  • Create the script string.

    Returns string

    the script

removeTopicPermissions

  • Remove any previously assigned permissions from a particular topic for a given role.

    This is different from setting no permissions to a topic. By removing permissions set for a topic, permissions will be inherited from the nearest set of permissions that have been assigned higher in the topic path hierarchy or from the default topic permissions if no more specific permissions are found.

    Parameters

    • role: string

      the role to remove topic permissions from.

    • path: string

      the topic path to remove permissions from.

    Returns SecurityScriptBuilder

    the builder to allow chaining

setDefaultTopicPermissions

  • Set the default permissions that a particular role will have for topics.

    Parameters

    • role: string

      the role to set topic permissions for.

    • Optional permissions: string[]

      the topic permissions to assign for the role, default = [].

    Returns SecurityScriptBuilder

    the builder to allow chaining

setGlobalPermissions

  • Set the global permissions assigned to a particular role.

    Parameters

    • role: string

      the role to set global permissions for.

    • Optional permissions: string[]

      the permissions to assign globally for a role, default = [].

    Returns SecurityScriptBuilder

    the builder to allow chaining

setRoleIncludes

  • Specify a set of a roles that another role should inherit permissions from.

    Parameters

    • role: string

      the role

    • roles: string[]

      the set of roles to inherit from.

    Returns SecurityScriptBuilder

    the builder to allow chaining

setRoleLockedByPrincipal

  • Restrict a role so it can only be edited by a specific principal.

    since

    6.4

    Parameters

    • role: string

      the role

    • lockingPrincipal: string

      the locking principal

    Returns SecurityScriptBuilder

    a new builder for scripts that also locks a role to a single principal that can edit it

setRolesForAnonymousSessions

  • Sets the roles to be assigned by default to all anonymous sessions.

    Parameters

    • Optional roles: string[]

    Returns SecurityScriptBuilder

    the builder to allow chaining

setRolesForNamedSessions

  • Sets the roles to be assigned by default to all sessions that authenticate with a principal.

    Parameters

    • Optional roles: string[]

      the roles to be assigned. Any empty array (the default), or no argument, will result in named sessions being assigned no roles by default.

    Returns SecurityScriptBuilder

    the builder to allow chaining

setTopicPermissions

  • Sets specific topic permissions for a named role.

    When permissions are assigned to a role for a topic path they will apply to the topic and any topics below the specified path. Topic-scoped permissions are assigned to roles for specific topic paths. The permission assignment applies to all descendant topics, unless there is a more specific assignment.

    To evaluate whether a session has permission for a topic, the server starts at that topic and searches up the tree to find the nearest permissions assignment. The first assignment is the only one considered, even if the session has roles involved in assignments further up the hierarchy.

    Parameters

    • role: string

      the role to assign permissions for.

    • path: string

      the topic path to assign permissions.

    • Optional permissions: string[]

      the permissions to assign to the role for the specified path. Any empty array (the default) or no argument would specify that the role has no permissions at this path, which differs from there being no permissions assigned for that path (see SecurityScriptBuilder.removeTopicPermissions).

    Returns SecurityScriptBuilder

    the builder to allow chaining