When new operations are created, it is often a requirement to hide them or show them, based on the permissions or state of the issue or something similar. JIRA allows conditions to be added while defining the web items, and the web item won't show up when the conditions are not satisfied.
In this recipe, let us lock down the new issue operation, created in the previous recipe, to a specific user named admin.
Following are the steps to add a new condition to an issue operation's web item:
Create the
condition
class. Since the issue operation is a web item, the easiest thing to do is to extend thecom.atlassian.jira.plugin.webfragment.conditions.AbstractWebCondition
class.While extendingAbstractWebCondition
, we will have to implement theshouldDisplay
method, as shown here:@Override public boolean shouldDisplay(ApplicationUser user...