Skip to content

Commit

Permalink
fix: don't throw if default group does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
targos committed Dec 8, 2016
1 parent a2aeef5 commit 9e3aa62
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/couch/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ async function getDefaultGroups(db, user, listOnly) {
if (listOnly) {
return Array.from(toGet);
} else {
return Promise.all(Array.from(toGet).map(group => getGroup(db, group)));
const groups = await Promise.all(Array.from(toGet).map(group => getGroup(db, group)));
return groups.filter((group) => group !== null);
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/data/noRights.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function populate(db) {
prom.push(insertDocument(db, {
_id: 'defaultGroups',
$type: 'db',
anonymous: ['defaultAnonymousRead'],
anonymous: ['defaultAnonymousRead', 'inexistantGroup'],
anyuser: ['defaultAnyuserRead']
}));

Expand Down

0 comments on commit 9e3aa62

Please sign in to comment.