Restricting access to reports
It is possible to restrict access to JIRA reports based on pre-defined criteria, such as making the report visible only to a certain group of people, or showing the report only in certain projects, and so on. Let us quickly have a look at how to code permissions for a JIRA report.
Getting ready
Create the report plugin, as explained in the first recipe.
How to do it...
All we need to do here is to implement the showReport
method on the report. Let us assume we want to restrict the report only to JIRA Administrators. The following are the steps:
Override the
showReport
method in the report class we created in the previous recipes.Implement the logic to return
true
only if the condition is satisfied. In our example, the report should be visible only to JIRA Administrators, and hence we should returntrue
only if the current user is a JIRA Administrator:@Override public boolean showReport() { User user = ComponentManager.getInstance().getJiraAuthenticationContext...