Skip to main content
Python SDK provides support for creating and managing roles in the peaq network’s Role-Based Access Control (RBAC) system.

create_role(role_name, role_id)

Creates a new role in the peaq network’s Role-Based Access Control (RBAC) system. The role will be owned by the address derived from the seed (if provided) or must be signed externally.

Create Role Code Examples

fetch_role(owner, role_id)

Fetches a specific role by its ID and owner address from the peaq network’s RBAC system.

Fetch Role Code Examples

fetch_roles(owner)

Fetches all roles associated with the specified owner address from the peaq network’s RBAC system.

Fetch Roles Code Examples

update_role(role_id, role_name)

Updates the name of an existing role in the peaq network’s RBAC system.

Update Role Code Examples

disable_role(role_id)

Disables a role in the peaq network’s RBAC system, making it inactive while preserving its data.

Disable Role Code Examples

assign_role_to_user(role_id, user_id)

Assigns a specific role to a user in the peaq network’s RBAC system.

Assign Role to User Code Examples

fetch_user_roles(owner, user_id)

Fetches all roles assigned to a specific user in the peaq network’s RBAC system.

Fetch User Roles Code Examples

unassign_role_to_user(role_id, user_id)

Removes a role assignment from a user in the peaq network’s RBAC system.

Unassign Role from User Code Examples