Skip to content

Commit

Permalink
only use site rule if there is no individual rule
Browse files Browse the repository at this point in the history
That way the individual rule takes precedence over the site rule.
  • Loading branch information
jdub233 committed Nov 13, 2023
1 parent 2d485d7 commit 05ad576
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/authorizeRequest/authorizeRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ async function authorizeRequest(userRequest, siteRule) {
let isRootSite = indexOfRestricted ? indexOfRestricted < 5 : false;

// If there is a whole-site protection rule, the group name will be the value of the rule.
if (siteRule) {
// Unless there is a group name in the url, individual protections take precedence.
if (siteRule && !groupName) {
groupName = Object.values(siteRule)[0];
// If there's nothing after the domain, then this is a root site.
isRootSite = Object.keys(siteRule)[0] === domain;
Expand Down

0 comments on commit 05ad576

Please sign in to comment.