Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

SIL Users in role

Dennis Henrik Kristensen October 25, 2018

Hi there,

I need to get all users from a specific role on a project via SIL. For this i am using the routine:
usersInRole(project, role)
Returns the users that correspond to a certain role on the specified project.

For my specific case i use this script:
string[] users = usersInRole("PP", "Administrators");
return users;

It's "works" and outputs users with "|" as a delimiter. What is confusing is that is also returns old users aka, deleted. 
We use Crowd but i have looking both in Jira User Management and Crowd management for the user(s) names that it outputs and they do not exits there (at least not popping up form search). 

Any one have an idea of what could course this behavior?

 

Kind Regards

1 answer

0 votes
Jonathan Muse _Appfire_
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.
October 25, 2018

Hi Dennis, the "|" is the delimiter for array variables in SIL. The old user issue is a very odd behavior. I am assuming that these users must be in a database table somewhere even if they are not active and don't show up in Crowd. I think it is something that should be fixed so I have opened a support ticket. However, in the meantime, there is a workaround that will eliminate the invalid users:

string [] allUsersInRole = usersInRole("PP", "Administrators");
string [] currentUsers;

for(string user in allUsersInRole) {
if(hasPermission(1, user) == true) {
currentUsers += user;
}
}

return currentUsers;

This uses the hasPermissions() routine to make sure each user has the "Jira User" global permission.

Dennis Henrik Kristensen October 26, 2018

Hi Jonathan,

Thanks for creating the ticket. Could I get you to add me to it, so I can post directly to that?

The script you have provided seems to give the same results, so I think providing more information about the environment i use it in might help. 

Suggest an answer

Log in or Sign up to answer