Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to use jira scriptrunner to create a rest endpoint for project admin do user management

Qi Jiang July 11, 2017

As only admin able to manage user group, I am wondering if I can create a rest end point in scriptrunner, which allow project admin to manage user group by using an generic admin ID and password. 

2 comments

Comment

Log in or Sign up to comment
Daniel Yelamos [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 12, 2017

Yes you could.

I imagine that what you want to do is create a list of functions accessed by a login params that project admins could acess so that they could:

1. Add users to groups

2. Remove users to groups

3. Grant permissions. 

and many more. It might be a bit too much work though.

Do give more information if you need anything more specific, this question is a bit thin on that.

Cheers!

Dyelamos

Qi Jiang July 12, 2017

Daniel,

I have script as below, 

import com.atlassian.jira.component.ComponentAccessor
def uu = ComponentAccessor.getUserUtil()
def user = uu.getUserByName("boris.georgiev")
def group = uu.getGroupObject("jira-developers")
uu.addUserToGroup(group, user.getDirectoryUser())

but got error, Could you help me take a look? 

Daniel Yelamos [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 13, 2017

Qi, I cannot help you if I don't know what the error is.

Please provide me with the exception that you are getting and I'll look into it.

Cheers

Dyelamos

Qi Jiang July 12, 2017

Is there any way I can create usergroup?

Daniel Yelamos [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 13, 2017

Take a look at this.

You can get that component by:

ComponentAccessor.getGroupManager()

Hope this helps.

Cheers!

Dyelamos

 

TAGS
AUG Leaders

Atlassian Community Events