Permissions can be defined and managed at different levels such as process groups, individual processes or users.
## Setting up Admin in Config (YAML)
In order to initiate the creation of a process model, it is necessary to configure the terraform_deployed_environment.yml file by including at least one Admin user.
The "uri" field defines the target resource for these permissions, which is set to "/*". This indicates that the permissions apply to all resources within the system.
```
### Groups
The "groups" section defines a group called "admin." This group is intended for users who have administrative privileges within the system.
In this example, the "admin" group consists of a single user with the associated email address. Multiple groups can be added.
### Permissions
The "permissions" section specifies the permissions and access control rules for the "admin" group.
The "admin" permission set allows members of the "admin" group to perform actions such as create, read, update, start and delete or all.
The "allowed_permissions" field lists the specific actions that are permitted for the "admin" group.
**Permissions allowed:**
- create
- read
- update
- delete
- start
- all
## Site Administration
Once the basic configuration setup is completed, specifying admin rights, you generally won't require additional permissions for designing processes and using the site. However, there might be certain situations that call for access control beyond the site or group level. In such cases, you have the flexibility to define and tailor admin requirements in a more detailed manner to fulfill specific needs.
### Step 1: Create Process Group
From the main menu select 'Procesess' and click on the 'Add a process group' button.
- Notification Addresses: Enter the addresses or destinations where notifications should be sent in the event that a process instance encounters an error. You do not need to worry about setting these values unless you are interested in custom {ref}`process_error_handling`.
- Metadata Extraction Path: You can provide one or more metadata extractions to uplift data from your process instances to provide quick access in searches and perspectives. Specify the key and path/location where metadata extraction should occur within the process model. For example, if you have a script task that runs the statement `great_color = "blue"`, then you would set extraction path to `great_color`. You would probably also set extraction key to `great_color`. But if you wanted to, you could just call it `color`, assuming you wanted that to be the name used in reports, etc.
All the required workflows can be downloaded from [Github - set-permissions](https://github.com/sartography/sample-process-models/tree/sample-models-1/site-administration/set-permissions)
Select to upload all downloaded files to the newly created Process model.
Assess the roles and responsibilities of users within your organization or system. Look for common patterns or similarities in their job functions and tasks related to specific processes or process groups.
Add a user email under the users 'column' and the group name under 'groups' and dont forget to add double quotes.
```{admonition} Note
Based on DMN functionality, leaving the "*" column empty means that all rules ('When') will be triggered without specifyin a condition. Read more about DMN tables to understand how the rules engine can be utilized for many different scenarios.
```
![user_to_groups](images/user_to_groups.png)
#### Group Permission
Now that the groups have been identified their permissions can be set by adding the group name under the "permissions_group" column.
- To determine a user's capabilities within the permissible scope, you can define specific permissions. These permissions can be combined in a sequence if multiple apply to a particular rule. For instance, ["read", "start"] indicates that the user can perform both reading and starting actions. Alternatively, [All] can be employed to grant unrestricted access.
- The hit policy is set to "Collect" which means that all conditions that are true will be applied. [Read more about DMN tables and hit policies here.](../Building_Diagrams/dmn.md)
- The permission URL can be configured to define the user's access privileges. Our objective is to streamline the process by minimizing the necessity of being familiar with the complete set of permission URLs. In most instances, utilizing BASIC and ELEVATED permissions, as well as PM/PG, should be sufficient. However, it is also feasible to directly incorporate any API URL into the permissions.
In truth what you are doing is writing an expression. In this case it would read that if the variable 'permissions_group' type string is equal to 'permissions' variable of type string then set the 'permission_url' equal to the associated value.
```{admonition} Note
If you find coding more familiar and preferable to constructing DMN tables, you may notice similarities between this DMN table and the shared permission configuration file. This similarity can help clarify or make it easier for you to understand the DMN table structure and its relation to the permission configuration.
```
![group_permission](images/group_permission.png)
### Step 5: Start Process
To ensure that User Groups and Permissions take effect, it is necessary to run the process at least once. Whenever changes are made to any of these diagrams, like adding a user group or permission, the process should be started and completed successfully in order for the changes to be applied.