Table of Contents

Interface IScriptBuilder

The script builder used to create a script of commands to apply to the security store at the server.

public interface IScriptBuilder

Remarks

Each method call on the builder adds a line to the script and then the script may be built using the ToScript() method which produces a System.String script which may be sent to the server using UpdateStoreAsync(string).

This builder can be accessed with the Script property.

From Diffusion 6.5, script builders are no longer immutable. Each builder operation mutates this script builder and returns it.

Methods

Append(IScriptBuilder)

Appends all the operations of a given builder to the current builder.

IScriptBuilder Append(IScriptBuilder other)

Parameters

other IScriptBuilder

The builder to append to the current builder.

Returns

IScriptBuilder

A new copy of the current builder that also includes all operations of other.

DeisolatePath(string)

Re-instate inheritance of path permission assignments from parents of the given path.

IScriptBuilder DeisolatePath(string path)

Parameters

path string

The path to be deisolated.

Returns

IScriptBuilder

This builder, modified to re-instate the inheritance of path permission assignments from parents of the given path.

Remarks

Added in 6.5.

IsolatePath(string)

Set a path not to inherit path permissions from its parent paths or the default path permissions.

IScriptBuilder IsolatePath(string path)

Parameters

path string

The path to be isolated.

Returns

IScriptBuilder

This builder, modified to isolate the given path in the path hierarchy.

Remarks

By default, a path without specific path permission assignments inherits the permission assignments from the first parent path that has them. If neither the path nor any of its parent paths have permission assignments, the default path permissions are used.

Added in 6.5.

RemovePathPermissions(string, string)

Removes any previously assigned permissions to a particular topic for a given role.

IScriptBuilder RemovePathPermissions(string role, string path)

Parameters

role string

The role to remove path permissions from.

path string

The path for which permissions are to be removed.

Returns

IScriptBuilder

This builder, modified to remove the path permissions for the role at the given point in the topic hierarchy.

Remarks

This is different from setting no path permissions for the path and role. By removing permissions set for a particular branch of the path hierarchy, the permissions become inherited from assignments made against parent paths in the hierarchy or from the default path permissions.

SetDefaultPathPermissions(string, IEnumerable<PathPermission>)

Sets the default path permissions to be assigned to a named role.

IScriptBuilder SetDefaultPathPermissions(string role, IEnumerable<PathPermission> permissions)

Parameters

role string

The role.

permissions IEnumerable<PathPermission>

The default permissions to be assigned to the role.

Returns

IScriptBuilder

This builder, modified to set the permissions for the given role.

Remarks

The role will have the given permissions to all topics unless specifically overridden for named paths.

SetGlobalPermissions(string, IEnumerable<GlobalPermission>)

Sets the global permissions to be assigned to a named role.

IScriptBuilder SetGlobalPermissions(string role, IEnumerable<GlobalPermission> permissions)

Parameters

role string

The role.

permissions IEnumerable<GlobalPermission>

The global permissions to assign to the role.

Returns

IScriptBuilder

This builder, modified to set the permissions for the given role.

SetPathPermissions(string, string, IEnumerable<PathPermission>)

Sets specific path permissions to be assigned for a named role.

IScriptBuilder SetPathPermissions(string role, string topicPath, IEnumerable<PathPermission> permissions)

Parameters

role string

The role.

topicPath string

The point in the topic tree at which the permissions are to be applied for the named role.

permissions IEnumerable<PathPermission>

The permissions to assign to the role for the topic.

Returns

IScriptBuilder

This builder, modified to set the permissions for the role at the given point in the topic tree.

Remarks

When permissions are assigned to a role for a topic path they will apply to the topic and any topics below the specified topic in the topic tree. 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 client session has access to a permission for a topic, the server starts at that topic and searches up the tree to find the nearest permission assignment. The first assignment is the only one considered, even if the client has roles involved in assignments further up the topic tree.

SetRoleIncludes(string, IEnumerable<string>)

Sets the roles that are to be included within a specified role.

IScriptBuilder SetRoleIncludes(string role, IEnumerable<string> includedRoles)

Parameters

role string

The role.

includedRoles IEnumerable<string>

The roles to include.

Returns

IScriptBuilder

This builder, modified to set the given role relationship.

SetRoleLockedByPrincipal(string, string)

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

IScriptBuilder SetRoleLockedByPrincipal(string role, string lockingPrincipal)

Parameters

role string

The role.

lockingPrincipal string

The locking principal that is able to edit the role.

Returns

IScriptBuilder

This builder, modified to lock a role to a single principal that can edit it.

SetRolesForAnonymousSessions(IEnumerable<string>)

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

IScriptBuilder SetRolesForAnonymousSessions(IEnumerable<string> roles)

Parameters

roles IEnumerable<string>

The roles to be assigned to anonymous sessions.

Returns

IScriptBuilder

This builder, modified to set the given roles.

SetRolesForNamedSessions(IEnumerable<string>)

Sets the roles to be assigned by default to all named sessions.

IScriptBuilder SetRolesForNamedSessions(IEnumerable<string> roles)

Parameters

roles IEnumerable<string>

The roles to be assigned to all named sessions.

Returns

IScriptBuilder

This builder, modified to set the given roles.

ToScript()

Creates a new script.

string ToScript()

Returns

string

The script.