Overview
By default, only the signoz-admin role can change the roles assigned to a member. In this tutorial you'll create a custom role that lets a team lead promote members from signoz-viewer to signoz-editor and demote them back, without giving the team lead the signoz-admin role.
What you'll do:
- Create a custom role that can assign and unassign only
signoz-viewerandsignoz-editor. - Assign the role to a team lead.
- Promote and demote members as the team lead, and validate that
signoz-adminstays out of reach.
Prerequisites
Before you start, make sure you have:
- An active SigNoz license.
- A role that can create custom roles and change the roles assigned to users, such as
signoz-admin. See the Transactions Reference for the detailed transactions required for each action.
Step 1: Create the scoped custom role
- Go to Settings > Roles and click Custom role.
- Enter the name
access-manager. - Configure the Transaction Groups below, then click Create role.
Assigning a role to a user is a compound transaction (user:attach and role:attach), and so is unassigning one (user:detach and role:detach). Scope role:attach and role:detach to the names of the roles the team lead may hand out, here signoz-viewer and signoz-editor. user:list and user:read let them find and open members, and role:list fills the role picker. In JSON mode, paste the following:
[
{
"objectGroup": {
"resource": { "kind": "user", "type": "user" },
"selectors": ["*"]
},
"relation": "list"
},
{
"objectGroup": {
"resource": { "kind": "user", "type": "user" },
"selectors": ["*"]
},
"relation": "read"
},
{
"objectGroup": {
"resource": { "kind": "user", "type": "user" },
"selectors": ["*"]
},
"relation": "attach"
},
{
"objectGroup": {
"resource": { "kind": "user", "type": "user" },
"selectors": ["*"]
},
"relation": "detach"
},
{
"objectGroup": {
"resource": { "kind": "role", "type": "role" },
"selectors": ["*"]
},
"relation": "list"
},
{
"objectGroup": {
"resource": { "kind": "role", "type": "role" },
"selectors": ["signoz-viewer", "signoz-editor"]
},
"relation": "attach"
},
{
"objectGroup": {
"resource": { "kind": "role", "type": "role" },
"selectors": ["signoz-viewer", "signoz-editor"]
},
"relation": "detach"
}
]The role lets its holders assign and unassign signoz-viewer and signoz-editor and nothing else. They cannot invite, rename, or delete members, create roles, or change anyone's signoz-admin role.
The * selector on user:attach and user:detach covers every member, including the team lead, so holders can give themselves signoz-editor. To limit the role to specific members, replace * with their user IDs. See User in the Transactions Reference for the selector format.
Step 2: Assign the role to the team lead
- Go to Settings > Members and open the team lead.
- In the Roles dropdown, add
access-manager. - Click Save Member Details.
Roles are additive, so the team lead keeps their current role and gains access-manager.
Step 3: Promote and demote a member
Sign in as the team lead. Each change below assigns the new role (user:attach and role:attach) and unassigns the old one (user:detach and role:detach).
Promote from signoz-viewer to signoz-editor
- Go to Settings > Members and open the member.
- In the Roles dropdown, add
signoz-editorand removesignoz-viewer. - Click Save Member Details.
Demote from signoz-editor to signoz-viewer
- Open the member.
- In the Roles dropdown, add
signoz-viewerand removesignoz-editor. - Click Save Member Details.
Because roles are additive, a member who keeps both signoz-viewer and signoz-editor has the union of the two. Remove the old role to complete the change.
Validate
- As the team lead, go to Settings > Members and open the member you promoted. The Roles dropdown shows
signoz-editorand no longer showssignoz-viewer. - In the same panel, add
signoz-adminin the Roles dropdown and click Save Member Details. The save reports an error forsignoz-admin, and the member does not receive the role.
Next Steps
- Roles: Create and manage managed and custom roles
- Transactions Reference: Look up the transactions for each resource
- Members: Invite members, change their roles, and reset passwords