We are using the xray test repository for managing the manual test in our company, the problem with that is there is onle one role that addressed who can create or delete the repo/ folder tree. This is causing the huge chaos as users are mistakenly deleting the root folder rather than the one child they don't need. Can anyone help me with the script to hide the UI 'delete' option ? I'm fairly new to script runner it does not seems very easy to do so.
Any help is very much appreciated.
<script type="text/javascript">
var user = getCurrentUserName();
hideDeleteOption(user)
function getCurrentUserName()
{
var user;
AJS.$.ajax({
type: 'get',
dataType: 'json',
url: "<<Url>>/rest/auth/latest/session",
async: false,
success: function(data) {
user = data.name;
}
});
return user;
}
function getGroups(user)
{
var groups;
AJS.$.ajax({
url: "<<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 hideDeleteOption(user){
var groups = getGroups(user);
for (i = 0; i < groups.length; i++){
var group = groups[i].name
var index1 = group.lastIndexOf('_')
var index2 = group.indexOf('_')
var role = group.substring(index1+1)
var project = group.substring(index2+1,index1)
if(role == 'user' || role == 'scrum' || role == 'readonly' || role == 'stakeholder'){
if(window.location.href.indexOf("entityKey="+project) > -1){
setTimeout(() => {
$("#raven-folder-delete").css("pointer-events", "none");
},4000);
}
}
}
}
</script>
Adding above script on announcement banner it'll hide delete button depending on project role.
I strongly recomend this KB https://docs.getxray.app/display/ON/Configuring+Permissions
but it do not remove the delete folder option just retrict to create and edit too.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.