Hi all,
We are using scriptrunner for Jira data center and we have just started to use issue security schemes for all projects and issue types, but we would like to "hide" the security level from normal users to eliminate confusion. (We'd only like it visible to Jira admin)
To be clear - we still want the security level to be applied to all requests, just the field not "visible" for normal users.
We've already tried to create a behavior for the "Security Level" field, that is mapped to "All Projects" and "All Issue Types".
Within the behavior:
- we've tried to use the "Hidden" toggle, with the condition "Except - When user is in group 'jira-administrators'." However, this doesn't work - everyone can still see the security level field.
- We've also tried to do this via code:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.groups.GroupManager
def groupManager = ComponentAccessor.getComponent(GroupManager)
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def securityLevelField = getFieldById("security")
// Is user in "jira-administrators" group?
if (!groupManager.isUserInGroup(currentUser, "jira-administrators")) {
// If not - hide the field
securityLevelField.setHidden(true)
} else {
// If so - show the field
securityLevelField.setHidden(false)
}
But neither way hides the field. Can someone tell us what we are doing wrong?
Thanks,
Mike