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.Parameter | Type | EVM | Substrate | Description |
---|---|---|---|---|
role_name | string | Required | Required | Name of the role to be created. |
role_id | string | Optional | Optional | Unique identifier for the role (32 characters). If not provided, one will be auto-generated. |
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.Parameter | Type | EVM | Substrate | Description |
---|---|---|---|---|
owner | string | Required | Required | Address representing the owner of the role. |
role_id | string | Required | Required | Unique identifier of the role to fetch (32 characters). |
Fetch Role Code Examples
fetch_roles(owner)
Fetches all roles associated with the specified owner address from the peaq network’s RBAC system.Parameter | Type | EVM | Substrate | Description |
---|---|---|---|---|
owner | string | Required | Required | Address that represents the owner of all the fetched roles. |
Fetch Roles Code Examples
update_role(role_id, role_name)
Updates the name of an existing role in the peaq network’s RBAC system.Parameter | Type | EVM | Substrate | Description |
---|---|---|---|---|
role_id | str | Required | Required | Unique identifier of the role to update (32 characters). |
role_name | str | Required | Required | New name to assign to the role. |
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.Parameter | Type | EVM | Substrate | Description |
---|---|---|---|---|
role_id | str | Required | Required | Unique identifier of the role to disable (32 characters). |
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.Parameter | Type | EVM | Substrate | Description |
---|---|---|---|---|
role_id | str | Required | Required | Unique identifier of the role to assign (32 characters). |
user_id | str | Required | Required | Unique identifier of the user to assign the role to (32 characters). |
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.Parameter | Type | EVM | Substrate | Description |
---|---|---|---|---|
owner | str | Required | Required | Address representing the owner of the roles. |
user_id | str | Required | Required | Unique identifier of the user to fetch roles for (32 characters). |
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.Parameter | Type | EVM | Substrate | Description |
---|---|---|---|---|
role_id | str | Required | Required | Unique identifier of the role to unassign (32 characters). |
user_id | str | Required | Required | Unique identifier of the user to remove the role from (32 characters). |