Customising interface based on user's role

Sometimes it is useful to remove certain elements from JIRA's user interface if the user does not belong to a certain group. Most of the time this can be achieved by editing certain JSP / Velocity files. The JSP files are easy to edit as they are text files, and one does not need access to JIRA's source code.

In velocity, you can hide certain elements from the UI by surrounding the relevant code with:

#if ($authcontext.user.inGroup('jira-administrators'))
...
#end

So to hide the security level you need to edit the file WEB-INF\classes\templates\jira\issue\field\comment-edit.vm and end up with something like this.

#if ($authcontext.user.inGroup('jira-administrators'))
    #if ($commentLevels && !$commentLevels.isEmpty())
        #controlHeader ($action 'commentLevel' $i18n.getText('comment.viewable') false $displayParameters.get('noHeader'))
        ...
        #controlFooter ($action '' $displayParameters.get('noHeader'))
    #end
#end

You need to update both places in the file and then restart JIRA.

If you make changes such as this, you will need to remember to port them to a new version of JIRA when you upgrade

Was this page helpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport