Created
May 7, 2012 19:04
-
-
Save jechlin/2629735 to your computer and use it in GitHub Desktop.
prevent non admins editing the dashboard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($){ | |
$(function(){ | |
$.get(AJS.params.baseURL + "/rest/auth/1/session", function (data) { | |
userName = data.name; | |
// check groups | |
$.get(AJS.params.baseURL + "/rest/api/2.0.alpha1/user", {username: userName, expand: "groups"}, function (data) { | |
var groups = data.groups; | |
var groupItems = jQuery.map(groups.items, function (val, j) {return val.name}); | |
// modify group(s) allowed to edit dashboard in the line below | |
if (jQuery.inArray("jira-administrators", groupItems) < 0) { | |
$("#dash-options").hide(); | |
$('ul#dashboard_link_manage').hide(); | |
} | |
}); | |
}); | |
}); | |
})(AJS.$); | |
HEy @jechlin @OlivierAlbertini - thanks for that awesome script.
It works fine exept for one constellation. There is still the "Create New Dashboards" button in the manage dashboards view.
Did you found a solution to prevent this button too? Or any other solution that "not admins" can create new dashboards?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you need to change to this /rest/api/2/user for checking groups.