hi,
I would like to prevent some user groups from creating/managing/modifying dashboard. But i cannot find it in the global permissions. Where could i manage these permissions please?
Thanks,
Vincent
How about doing it with some javascript... would not stop direct url access but you can remove the links to configure the dashboard.
Here is a complete example. The only thing not shown is the <script> tags if you choose to put this in the announcement banner.
(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.$);
(https://gist.github.com/2629735)
There's no functionality for stopping people from customising their dashboards. I think there's a global hack in code which would let you stop everyone, but even that isn't group-aware, it's everyone or nobody.
uuuurg, thanks for the answer. This will be a problem
i'll try to see with the devs what they can do with it.
See this enhancement request:
https://jira.atlassian.com/browse/JRA-8689
I like your solution, thanks
upvote then, please!
Hi JamieI like this solution too as a simple option, is there any chance of a more complete script as not very good with Javascript or REST?ThanksAdam
@Nic BroughI dont suppose you know what this hack is or a link to it?
Did anyone get this to work in the announcement banner? Manually running this works fine..
Regards
Darren
Hi DarrenI managed to get it to work using this...
<script type="text/javascript"> (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.operations a#create_page').hide(); } }); }); }); })(AJS.$); </script>
Hope that helps
Adam
Hi Adam,
Thanks for your reply, Did you add this into the anouncement banner? Or will be editing a file sat within the installation of JIRA?
I have placed it within the A.Banner section and used a non admin account to test and the options are still visible.
I'm assuming I'm doing something else incorrect?
Do I need any developer apps installed within JIRA in the way of addons?
Hi DarrenThe script above was placed in the annoucement banner as we wanted to do the same as you and hide creating a dashboard from our non-admin users as i prefer to create the dashboards and then share them with the users that need access to them.We were running JIRA 4.4 when we tried this originally and to be honest i havent tried this since we upgrade through 5.0.6 to 5.1 as the plugins we use got updated.I dont think it requires any addons and that the jQuery library is built into JIRA by default as that is what it uses to do the hiding.
*UPDATE*
I have checked on JIRA 5.1 and it seems to hide the Add Gadget links and Edit Layout links, i am assuming the other options have had their CSS tags changed so the script would require some editing to hide those but you should be able to find those using your web browser and or an addon for your browser and then just add those along with the othersAdam
Thanks Adam,
I would so prefer non admins to create dashboards.
I'm fairly new to fiddling with code, in the script were advises to edit the groups/users. On which part of the code would i edit these?
I have just tried and now I have a blank JIRA qnd cannot edit the announcement banner through JIRA itself.
Now I'm re-installing and restoring from a back up. Luckily it's DEV
Many thanks
Hi DarrenTo edit the groups that the hiding applies to you need to edit where it says:
if (jQuery.inArray("jira-administrators", groupItems) < 0) {
Just change jira-administrators to the group you want to apply this to and to change the page elements that hide just add these to the following lines
$("#dash-options").hide(); $('ul.operations a#create_page').hide();
<br>
On Adam's JS you need to modify user REST url as follows:
/rest/api/2/user
Hi Guys..
I can get this Script working very well in the 5.2.6, but i have a doubt.
How can I use more than one group? I would like insert multiple groups to create/manage the Dashboard.
Anyone can help me please?
Thx
Alexandre
is there a possibility for 6.2?
All,
The solution I used was slightly different. I didn't like the fact that the element showed up for a split second. So, by default I hide the element in CSS first, then I just the JQuery to display it when the user HAS permission to view it.
<style> /** Get rid of the dashboard link by default **/ #home_link {display: none;} </style> <script type="text/javascript"> (function($){ $(function(){ $.get(AJS.params.baseURL + "/rest/auth/1/session", function (data) { userName = data.name; // check groups $.get(AJS.params.baseURL + "/rest/api/2/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("THE-GROUP-YOU-WANT-TO-VIEW-DASHBOARDS", groupItems) > 0) { $("#home_link").show(); } }); }); }); })(AJS.$); </script>
It looks like you're new here. Sign in or register to get started.