Can we enable jira fields based role?

Need to disable fix version field for role jira-users only in few projects. Is it possible?

2 answers

0 vote

Yes, you can limit the "Resolve Issue" project permission to prevent people from setting the fix version field.

https://confluence.atlassian.com/display/JIRA/Managing+Project+Permissions

This is for Resolve Issue permission but how can this restrict users from changing the fix version field?

you can try with this using javascript something like this, here i am showing fixversion field to jira users group, you need to modify as per your requirement

<script type="text/javascript">  
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {
hideTab();    
})
function hideTab(){
        var user=getCurrentUserName();		
		if(isUserInGroup(user,'jira-users') ){
			//to hide fixversion field
			$("#fixVersions-multi-select").closest('div.field-group').hide(); 
		}else {
			$("#fixVersions-multi-select").closest('div.field-group').show(); 
		}

}
function getCurrentUserName()
{
var user;
     AJS.$.ajax({
        url: "/rest/gadget/1.0/currentUser",
        type: 'get',
        dataType: 'json',
        async: false,
        success: function(data) {
            user = data.username;
        }
     });
     return user;
}
  
  
function getGroups(user)
{
var groups;
     AJS.$.ajax({
        url: "/rest/api/2/user?username="+user+"&expand=groups",
        type: 'get',
        dataType: 'json',
        async: false,
        success: function(data) {
            groups = data.groups.items;
        }
     });
     return groups;
}
function isUserInGroup(user, group){
    var groups = getGroups(user);
    for (i = 0; i < groups.length; i++){
         if (groups[i].name == group){
              return true;
         }
    }
    return false;
}
  

</script>

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

187 views 1 17
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you