Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions lib/jira.js
Original file line number Diff line number Diff line change
Expand Up @@ -1916,5 +1916,69 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
callback(response.statusCode + ': Error while retrieving backlog');
});
};
// ## Get de users of a group ##
// ### Takes ###
// * group: group name
// * callback: for when it's done
//
// ### Returns ###
// * error string
// * users object
/*
Users item is in the format:
{
"name": "jira-developers",
"self": "https://localhost:8443/rest/api/2/group?groupname=jira-developers",
"users": {
"size": 1,
"items": [
{
"self": "https://localhost:8443/rest/api/2/user?username=someone",
"name": "someone",
"emailAddress": "someone@localhost.com",
"avatarUrls": {
"48x48": "https://localhost:8443/secure/useravatar?ownerId=someone&avatarId=10302",
"24x24": "https://localhost:8443/secure/useravatar?size=small&ownerId=someone&avatarId=10302",
"16x16": "https://localhost:8443/secure/useravatar?size=xsmall&ownerId=someone&avatarId=10302",
"32x32": "https://localhost:8443/secure/useravatar?size=medium&ownerId=someone&avatarId=10302"
},
"displayName": "Someone People",
"active": true
}
],
"max-results": 50,
"start-index": 0,
"end-index": 0
},
"expand": "users"
}
*/
this.getGroupMembers = function(group,maxResults,startIndex,endIndex, callback) {
startIndex = (startIndex !== undefined) ? startIndex : 0;
endIndex = (endIndex !== undefined) ? endIndex : 50
maxResults = (maxResults !== undefined) ? maxResults : 50;
var options = {
rejectUnauthorized: this.strictSSL,
uri: this.makeUri('/group?groupname='+group
+'&expand=users['+startIndex+':'+endIndex+']'
+'&maxResults='+maxResults),
method: 'GET',
json: true
};
console.log(options);
this.doRequest(options, function(error, response) {
if (error) {
callback(error, null);
return;
}

if (response.statusCode === 200) {
callback(null, response.body);

return;
}

callback(response.statusCode + ': Error while retrieving users');
});
};
}).call(JiraApi.prototype);