Skip to content

Commit

Permalink
fix: make sure all users have $everyone in their roles, even if they …
Browse files Browse the repository at this point in the history
…have nothing else

affects: tymly
  • Loading branch information
jezhiggins committed May 25, 2018
1 parent c970e94 commit 77f1a03
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/plugin/components/services/rbac/find-user-roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ async function findUserRoles (userId, roleMembershipModel, rbac) {

const applicableRoles = []
for (const roleId of roleIds) {
const roles = rbac.inherits[roleId] || [roleId, '$everyone']
const roles = rbac.inherits[roleId] || [roleId]

applicableRoles.push(...roles)
}
applicableRoles.push('$everyone')

return [...new Set(applicableRoles)] // uniqify
} // findUserRoles
Expand Down
5 changes: 5 additions & 0 deletions test/rbac-service-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,11 @@ describe('RBAC service tests', function () {
'molly',
['tymlyTest_developer'],
['tymlyTest_developer', '$everyone']
],
[
'just-some-dude',
null,
['$everyone']
]
]

Expand Down

0 comments on commit 77f1a03

Please sign in to comment.