It’s not possible in JIRA to create an Issue Security Scheme by issue type. For instance, you may want that defects should default to Private, and enhancements should default to public (or none). You might expect that issue type security scheme would be a mapping of issue types to issue security schemes (in the same way as Field Configuration Schemes), but unfortunately not.
There are two ways to get round this, one using Javascript, one with a post-function.
Javascript
The Javascript method has the advantages that it only sets the default for the issue type, the user is free to override it. And you don’t need any plugins.
First of all you will need a field configuration, and field configuration scheme for the project. Next, in the field configuration, edit the description for the Security Level field.
loading http://blogs.onresolve.com/jechlin/74A/SetSecLevel.js…
Hopefully the comments are explanation enough. To get the IDs, go the relevant page, and float your mouse over the issue type or security levels – the IDs you see in the URL are the IDs to use in the script. Make sure the security level is displayed on the Create screen.
There’s a bit of dicking around to be done here – you cannot call document.getElementById(“security”) until the page is fully loaded, otherwise you will get an error. So the code here adds an additional event handler to the window.onload() method. Reference.
Alternatively, you might also try putting the function in a tag like:
<javascript for="window" event="onload">
Groovy Post-Function
The other alternative is writing a post-function. For a one-off like this, I prefer to do it as a groovy script rather than write a java plugin. The advantage of this approach is that the user cannot override the security level, however you will need the Groovy Runner.
Create a new post-function which runs a script containing the following code, and put it on the Create event.
Leave a Reply
You must be logged in to post a comment.
