Unified Roles
To create a new built-in role, it is necessary to:
- Create role in Reva
- Update Reva in oCIS
- Add newly created role to oCIS
In the Reva repository, add the role into the /pkg/conversions/role.go
file:
- Add a role name constant for this role. See the existing ones for how this is setup
- Add a new function to create a new role struct with the role name constant and desired permissions
- Add the role to the
RoleFromName
function - In
/pkg/conversions/role_test.go
, extend unit tests to cover the new role
After adding the role to Reva and updating the Reva in oCIS, it is necessary to add the role to oCIS as well:
- Generate UUID for the role
- In
/services/graph/pkg/unifiedrole/roles.go
, add the role ID generated in the first step as a constant - In
/services/graph/pkg/unifiedrole/roles.go
, add translatable role display name and description variables - In
/services/graph/pkg/unifiedrole/roles.go
, add role variable with a function to create the role
The function should first create the role struct using the function from Reva and return theUnifiedRoleDefinition
struct. - In
/services/graph/pkg/unifiedrole/filter.go
, add the role into thebuildInRoles
function - In
/services/graph/pkg/config/defaults/defaultconfig.go
, if the role is not intended to be enabled by default, add the role ID into the_disabledByDefaultUnifiedRoleRoleIDs
constant - In
/services/graph/pkg/unifiedrole/export_test.go
, add the role variable - In
/services/graph/pkg/unifiedrole/roles_test.go
, extend unit tests to cover the new role - In
/services/web/pkg/theme/theme.go
, add the role into thecommon.shareRoles
- In
/services/graph/README.md
, add the role to the list of built-in roles