Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 4.2.3.1 Configure roles

OpenCRVS has a pre-configured set of user roles with various scopes, but you can change them to have any combination of scopes that you need. You can also create completely new roles. All of these roles are defined in the `roles.ts` file in the `src/data-seeding/roles` directory of the opencrvs-countryconfig repository. This particular file has a `roles` array that contains all the roles that will be available in your OpenCRVS instance. Now let's take a look at how we can define a new role:

```typescript
{
id: 'DATA_ENTRY_CLERK',
label: {
defaultMessage: 'Data entry clerk',
description: 'Name for user role data entry clerk',
id: 'userRole.dataEntryClerk'
},
scopes: [
SCOPES.RECORD_DECLARE_BIRTH,
SCOPES.RECORD_DECLARE_DEATH,
SCOPES.RECORD_DECLARE_MARRIAGE,
SCOPES.RECORD_SUBMIT_INCOMPLETE,
SCOPES.RECORD_SUBMIT_FOR_REVIEW,
SCOPES.SEARCH_BIRTH,
SCOPES.SEARCH_DEATH,
SCOPES.SEARCH_MARRIAGE
]
}
```

* The `id` field is the unique identifier for the role.
* The `label` field can be used to configure how the role would show up in the application. A corresponding entry in the `client.csv` file for the id `userRole.dataEntryClerk` would need to be created to provide translations for the label.
* The `scopes` field is an array of scopes that the role has access to. The `SCOPES` constant has all the available scopes that can be used in the system. More details on each scope is added in the next section.

Adding this entry to the `roles` array in the `roles.ts` file will make the role available in the OpenCRVS instance.

{% hint style="danger" %}
If you are upgrading from a previous version of OpenCRVS, **Do not modify the existing roles** in the `roles.ts` file to make the upgrade backward compatible. Instead, add new roles if needed.
{% endhint %}

This file was deleted.

Loading