Custom permissions
With Keycloak authentication, by default, users have access to all pages and components. However, you might want to limit the access to specific pages or components to certain users. We can achieve this by taking advantage of Keycloak roles.
-
On Keycloack, you will need to create groups and assign users to these groups.
-
Inside the
trial-monitor-apiclient, on the Roles tab, create new roles according to your needs. -
On the
auth.jsonfile, assign the roles to the correct groups.
{
// ...
"groups": {
"admin": [
"read-activity",
"read-sensitive-info"
],
"user": [
"read-activity",
]
}
}
- And finally, on the page config file, define the
requiredPermissionsproperty with a list of roles that have permissions to access the page or component.
title: Example Page
requiredPermissions:
- read-activity
- read-sensitive-info
components:
- type: table
title: Table
requiredPermissions:
- read-activity
query:
# ...
With this configuration, only users who are part of a group with these roles will be able to access the page/component.