About Custom Roles
By default, Userfront has a list of roles that are applicable across a variety of use cases.
However, there may be instances where you want to use roles that are tailored specifically to your application, or whose names correspond to specific resources in your system.
In these instances, you can create custom roles via the Userfront dashboard or API.
See also Role-Based Access Control (RBAC)
Custom Role Requirements
Role names can be any string of characters from 1 to 100 characters in length and cannot begin or end with a whitespace. There are no other restrictions on custom role names.
Attribute
Requirement
When creating a role, the casing of each character is preserved. For example, creating an “Administrator” role will cause all authorization
objects created by Userfront to contain roles: ["Administrator"]
with the uppercase “A” preserved.
Role names cannot be edited once they have been created.
{
"email": "bgates@example.com",
...
"authorization": {
"wbmxvmvn": {
"tenantId": "wbmxvmvn",
"name": "Organization A",
"roles": ["Administrator", "custom_role-name 33"]
}
}
}
Custom Role Handling
Once created, custom roles are handled the same way as other roles on Userfront.
The Roles page allows for direct creation and deletion of roles in the Userfront dashboard, either at the global application level, or for individual tenants within your workspace.
You can also assign roles to an existing user, or create or invite a user to join your application with the roles that you provide.
Custom Role Documentation
Custom role API endpoints
- Create and manage roles
- Assign a global role to a user
- Assign a role to a user (tenant-level)
- Invite a user to a global role
- Invite a user to a role (tenant-level)
- Search for users by role