As we saw in the previous recipes, adding a web fragment is pretty easy. However, the job doesn't stop with that always. In many cases, we would want to limit the web item based on a set of conditions.
For example, an Edit Issue link should only appear for people with edit permission on an issue. An admin link should appear only if the user is a JIRA Administrator. In this recipe, let us look at how we can implement conditions for displaying web fragments.
It is possible to add one or more conditions to a web section or a web item. In the latter case, the conditions
element is used, in this case, a collection of condition/conditions
elements and a type
attribute. The type attribute is either the logical AND
or OR
.
For example, the following condition specifies that the user should have either the admin
permission or use
permission in a project before he/she can see the web fragment that has the following condition:
<conditions type="OR">...