Copy
Ask AI
from peaq_robot import PeaqRobot
sdk = PeaqRobot()
# Create a role
r1 = sdk.access.create_role("ROBOT_OPERATOR", "Advanced Robot Operator")
print("create_role:", r1)
# Grant the role to a user identifier
gr = sdk.access.grant_role("ROBOT_OPERATOR", "USER_001")
print("grant_role:", gr)
# Read back role details
rr = sdk.access.read_role("ROBOT_OPERATOR")
print(rr)
Copy
Ask AI
create_role: 0x394fcf222b439369...
grant_role: 0x7f6c67dba35ae5fc...
{'role_name': 'ROBOT_OPERATOR', 'role_id': '0x524f424f545f4f50455241544f5230303030303030303030303030303030', 'data': {'id': 'ROBOT_OPERATOR000000000000000000', 'name': 'Advanced Robot Operator', 'enabled': True}, 'exists': True, 'read_status': 'success'}