Community moderators have prevented the ability to post new answers.
Hi Mizan,
Is above script works in createissue-start.jsp file ?
IF the script is stored in the announcement banner it will run on every page in JIRA
I am not sure if it works on the create issue pop up but there are ways you can make it work on the create issue screen .
refer this post , people have encountered this issue and there are a few workarounds/solution available for this on Answers forum .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It should be /rest/prototype/1/session, but the groups information is not in there.
Perhaps you can get it from the SOAP API, if confluence has the json/soap bridge.
It was enough for me to check whether the user was a confluence admin, which I did via (bit hacky):
if (AJS.$("#administration-link").length > 0) {...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have a Javascript taken from JTRICKS tutorials , its for JIRA maybe you can modify it according to Confluence REST APi and make it work .
<script type="text/javascript"> 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; } var user = getCurrentUserName(); if (isUserInGroup(user, 'jira-administrators')){ AJS.$(function(){ alert("i am an administrator")) }); } </script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.