Setting Up a Request: Only Assigned Person or System Administrator Can Move Requests by the Route
The task is to set up request's workflow in such a way that only the assigned person or a system administrator can move requests by the route.
To solve this task, you need to configure routes of a request type adding a custom condition to required routes.
Open the route of the request type. On the form in the Conditions field, you can specify conditions that need to be met in order to move request by this route.
By default, the "AND" logical operator is used in the Conditions field, which means that all these conditions must be met before transition of the request. In our case, you need the system to use only one of the conditions (logical "OR"): either the user is assigned to this request, or he is an administrator. This can be easily implemented using custom conditions.
You need to do the following steps:
Create a first condition to check if request is assigned to the current user (this is one of the default conditions, you can skip this step).
Create a second condition to check if the current user is a Super User (a user with admin right
Create the third condition (based on the group of conditions) that will pass if one of the previously created conditions are met (with the "OR" logical operator).
Configure the required Routes using the third condition.
You can create custom conditions by selecting Create and Edit in the Conditions drop-down list on the Route form.
You can also create custom conditions from the Rules -> Generic Conditions menu.
To create a new condition, click Create.
The Assigned to current user condition is available by default. It applies to the current user (Type: Current user) and checks if the user is written in the Assigned to field (User Field: Assigned to).
To check if the user is an administrator, you can either use the Current user type of condition, or the Expression.
The Current user condition type allows you to perform different checks related to the current user. For our example, you can select the One of check type. It allows you to specify users and check if the current user is one of them.
The second option is to use the Expression type. This type allows you to describe a condition using Python code.
- If you have only one user with the rights of administrator, you can write the following expression:
uid == 1
user.id == 1
- for multiple users with admin rights, you can write the following expression:
uid in [1, 5, 12]
where "[1, 5, 12]" is a list of user ids (not necessarily with admin rights) that are allowed to move request by the route. To view the id of a specific user, you can open Settings -> Users -> Required User. You can see the required id in the address line:
Created condition should looks like the following
The third condition is a group of previously created conditions (Type: Condition group).
Specify the "OR" operator to use one of the provided conditions.
In the Condition (condition group) field, select the required conditions.
You can also test created conditions by clicking the Test button at the top-right. More info about this and about conditions in general you can read in the Generic Condition documentation.
The final step is to specify created condition in the settings of the required routes.
This will finalize the configuration and allow to move requests of this type only by administrator or users that are assigned to the current request.