Merge pull request #16194 from overleaf/bg-group-sso-fix-default-permission-check

fix default permission check for group sso

GitOrigin-RevId: b78c3dd26d852822f06c44c2aef79daea36fc2bd
This commit is contained in:
Brian Gough
2023-12-14 09:03:16 +00:00
committed by Copybot
parent dfcdf8f266
commit ec923c2144
2 changed files with 34 additions and 14 deletions
@@ -272,8 +272,8 @@ function hasPermission(groupPolicy, capability) {
const results = getEnforcedPolicyNames(groupPolicy).map(userPolicyName =>
getCapabilityValueFromPolicy(userPolicyName, capability)
)
// if there are no results, return the default permission
if (results.length === 0) {
// if there are no results, or none of the policies apply, return the default permission
if (results.length === 0 || results.every(result => result === undefined)) {
return getDefaultPermission(capability)
}
// only allow the permission if all the results are true, otherwise deny it