Skip to content

NodePermissions

Canonical path: o6.server.NodePermissions

Root shortcut: o6.NodePermissions

NodePermissions

The RolePermissions of one node, reached as node._permissions.

The leading underscore is part of the name: unprefixed attribute access on a node handle browses to child nodes, so node.permissions = ... would silently create an ordinary Python attribute and change nothing.

Assigning a mapping to node._permissions is shorthand for set. Every operation here takes recursive=True to apply to the whole subtree, and each raises StatusCodeError if the node is gone.

See Role-based access control.

Functions

__init__

__init__(server, nodeId)

Bind to one node's permissions. Reach this through node._permissions.

Parameters:

Name Type Description Default
server Server

The server that owns the node.

required
nodeId NodeId

NodeId of the node.

required

get

get()

Return the permissions set explicitly on this node.

Namespace defaults are not included, so an empty result means the node falls back to its namespace default.

set

set(permissions, *, recursive=False)

Replace this node's permissions with the given mapping.

Parameters:

Name Type Description Default
permissions Mapping[Role | NodeId, Permission]

Role to Permission mask. Roles may be given as Role objects or role NodeIds.

required
recursive bool

Apply to this node's whole subtree.

False

grant

grant(
    role, permissions, *, overwrite=False, recursive=False
)

Add permissions for one role, keeping the other roles' entries.

Parameters:

Name Type Description Default
role Role | NodeId

The role to grant to.

required
permissions Permission

The Permission bits to add.

required
overwrite bool

Replace the role's existing mask instead of adding to it.

False
recursive bool

Apply to this node's whole subtree.

False

revoke

revoke(role, permissions, *, recursive=False)

Remove permissions from one role, keeping its remaining bits.

Parameters:

Name Type Description Default
role Role | NodeId

The role to revoke from.

required
permissions Permission

The Permission bits to remove.

required
recursive bool

Apply to this node's whole subtree.

False

clear

clear(*, recursive=False)

Remove every explicit permission, so the namespace default applies.

Parameters:

Name Type Description Default
recursive bool

Apply to this node's whole subtree.

False