Wiki

Clone wiki

runner / Custom Rest EndPoint

Groovy

import com.atlassian.jira.security.groups.GroupManager
import com.atlassian.jira.component.ComponentAccessor;
import javax.ws.rs.core.Response

String GROUP_NAME = "jira-software-users"


GroupManager groupManager = ComponentAccessor.getGroupManager()

// Retrieve all users in "jira-software-users" group.
return Response
    .ok([
        users: groupManager.getUsersInGroup(GROUP_NAME).collect{[ key: it.key, displayName: it.displayName ]}
    ])
    .build()

PHP

import com.atlassian.jira.security.groups.GroupManager;
import com.atlassian.jira.component.ComponentAccessor;
import javax.ws.rs.core.Response;

$GROUP_NAME = "jira-software-users";

$groupManager = ComponentAccessor::getGroupManager();
$res = $groupManager->getUsersInGroup($GROUP_NAME);

$output = array();
foreach ($res as $row) {
  $output[] = $row->name . ':' . $row->displayName;
}

return json_encode($output);

Updated