Skip to content

Commit

Permalink
Fixes #1762 - GeoStore API compatibility
Browse files Browse the repository at this point in the history
Il the user has only one group, GeoStore does not emit an Array, but a single Object
  • Loading branch information
Gnafu committed May 12, 2017
1 parent 4ce1460 commit c4112e5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion web/client/api/GeoStoreDAO.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ let parseAdminGroups = (groupsObj) => {
};

let parseUserGroups = (groupsObj) => {
if (!groupsObj || !groupsObj.User || !groupsObj.User.groups || !groupsObj.User.groups.group || !_.isArray(groupsObj.User.groups.group)) return [];
if (!groupsObj || !groupsObj.User || !groupsObj.User.groups || !groupsObj.User.groups.group || !_.isArray(groupsObj.User.groups.group)) {
if (_.has(groupsObj.User.groups.group, "id", "groupName")) {
return [groupsObj.User.groups.group];
}
return [];
}
return groupsObj.User.groups.group.filter(obj => !!obj.id).map((obj) => _.pick(obj, ["id", "groupName", "description"]));
};

Expand Down

0 comments on commit c4112e5

Please sign in to comment.