Skip to content

Commit

Permalink
A4A > Partner Directory: Fix access control (#99452)
Browse files Browse the repository at this point in the history
  • Loading branch information
yashwin authored Feb 7, 2025
1 parent 285be1a commit ce55e48
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions client/a8c-for-agencies/controller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ const handleMultiUserSupport = ( agency: Agency, pathname: string, next: () => v
export const requireAccessContext: Callback = ( context, next ) => {
const state = context.store.getState();
const agency = getActiveAgency( state );
const { pathname, search, hash } = window.location;
const { search, hash } = window.location;
const pathname = context.pathname;

if ( agency ) {
// If multi-user support is enabled, we need to check if the user has access to the current path
Expand All @@ -61,7 +62,8 @@ export const requireClientAccessContext: Callback = ( context, next ) => {
return;
}

const { pathname, search, hash } = window.location;
const { search, hash } = window.location;
const pathname = context.pathname;
const args = getQueryArgs( window.location.href );
page.redirect(
addQueryArgs( A4A_CLIENT_LANDING_LINK, { ...args, return: pathname + search + hash } )
Expand All @@ -71,7 +73,7 @@ export const requireClientAccessContext: Callback = ( context, next ) => {
export const requireTierAccessContext: Callback = ( context, next ) => {
const state = context.store.getState();
const agency = getActiveAgency( state );
const { pathname } = window.location;
const pathname = context.pathname;

if ( isEnabled( 'a8c-for-agencies-agency-tier' ) && ! isPathAllowedForTier( pathname, agency ) ) {
context.primary = <TierPermissionError section={ context.section.name } />;
Expand Down

0 comments on commit ce55e48

Please sign in to comment.