We have added a custom field for Developer Notes, but don't want this to be visible to anyone other than staff with the Developer role. How can we do this ?
Jira doesn't have field level security.
You can try to do it with a bit of javascript for yourself, but have a look at the field security plugin from quisapps or the behavours plugin.
if you want to do with javascript then you can try with following script
<script type="text/javascript">
jQuery(document).ready(function($) {
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {
hideFieldForGroup();
});
hideFieldForGroup();
function hideFieldForGroup(){
var user=getCurrentUserName();
var statusText=$('#status-val').text();
var status=$.trim(statusText);
if(isUserInGroup(user,'Developers') && status=='In Progress'){
$("#customfield_10571").closest('div.field-group').hide();
}else if(isUserInGroup(user,'Users') && status=='Open') {
AJS.$("#customfield_10571").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>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.