Skip to content

Role

A Role object represents a role definition within a realm. Roles define the permission level (admin, manager, user) and are assigned to people through the Identity module. One role per realm can be designated as the default, which is automatically assigned to new accounts.

Sample Object

{
  "id": "rol_abc123def456",
  "name": "customer-support",
  "type": "MANAGER",
  "realm_id": "rlm_abc123def456",
  "default": false
}

Fields

FieldTypeDescription
idstringUnique identifier for the Role.
namestringHuman-readable name of the role.
typeenumRole type. One of ADMIN, MANAGER, USER.
realm_idstringUnique identifier of the Realm this role belongs to.
defaultbooleanWhether this role is the default role for new accounts in its realm.

Actions

Creating a role

Create a new role definition within a realm. The role type must be one of ADMIN, MANAGER, or USER.

obx app auth:roles init
| SUCCESS: Role initialized
| Edit the initialized role file ./app/auth-roles/init.json

After editing the template file:

obx app auth:roles push init
| SUCCESS: Role created
| The role has been successfully created on the platform.
| Local copy of the record is saved in ./app/auth-roles/rol_abc123def456.json

Getting a role

Retrieve a single role by its ID.

obx app auth:roles pull rol_abc123def456
| SUCCESS: Role pulled
| The role data has been saved to ./app/auth-roles/rol_abc123def456.json

Listing all roles

Retrieve all roles in the project.

obx app auth:roles list
| SUCCESS: Roles listed
| All roles have been listed successfully.

Updating a role

Update a role’s name, type, or realm assignment by its ID.

Edit the local file ./app/auth-roles/rol_abc123def456.json and run:

obx app auth:roles push rol_abc123def456
| SUCCESS: Role updated
| The role has been updated successfully.

Deleting a role

Delete a role by its ID. A role with assigned people cannot be deleted.

obx app auth:roles delete rol_abc123def456
| SUCCESS: Role deleted
| The role has been deleted successfully.

Setting the default role

Set a role as the default role for its realm. The default role is automatically assigned to new accounts created through the registration endpoint.

No CLI command available. Use the REST or SDK methods.

Getting the default role

Retrieve the default role for the project. Returns the role that is assigned to new accounts.

No CLI command available. Use the REST or SDK methods.