Pull requests

#1 Merged
Repository
febbraro febbraro
Branch
master
Repository
knecht_andreas knecht_andreas
Branch
master

Fixed the path to the group name

Author
  1. Frank Febbraro avatarFrank Febbraro
Reviewers
Description

Thanks for the feedback. Updated the PR to support both JIRA and Crowd.

Comments (3)

  1. Andreas Knecht repo owner

    Thanks for the pull request!

    Well so this is a bit annoying. If you use this against JIRA (with JIRA setups as a 'User Server') then its REST api returns this:

    {
        "expand": "group",
        "groups": [{
            "GroupEntity": {
                "link": {
                    "href": "http://localhost:2990/jira/rest/usermanagement/latest/group?groupname=jira-administrators",
                    "rel": "self"
                },
                "name": "jira-administrators"
            }
        }, {
            "GroupEntity": {
                "link": {
                    "href": "http://localhost:2990/jira/rest/usermanagement/latest/group?groupname=jira-developers",
                    "rel": "self"
                },
                "name": "jira-developers"
            }
        }, {
            "GroupEntity": {
                "link": {
                    "href": "http://localhost:2990/jira/rest/usermanagement/latest/group?groupname=jira-users",
                    "rel": "self"
                },
                "name": "jira-users"
            }
        }]
    }
    

    Latest version of Crowd however returns this:

    {
        "expand": "group",
        "groups": [{
            "link": {
                "href": "http://localhost:8095/crowd/rest/usermanagement/latest/group?groupname=crowd-administrators",
                "rel": "self"
            },
            "name": "crowd-administrators"
        }]
    }
    

    They both share the same library to make this Crowd REST api available, but looks like the REST api has evolved a bit in Crowd and JIRA isn't bundling the latest version yet. I think we should support both in order to stay backwards compatible with older versions as well.

    Can you change this to be something like this (after testing in your environment to make sure it works for you), and I'll merge in the pull request and deploy a new release of the library to NPM:

    if(group.GroupEntity) {
        groups.push(group.GroupEntity.name);
    } else {
        groups.push(group.name);
    }
    
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.