From ce55e489dafe826e5283c077fac34de03ef8b753 Mon Sep 17 00:00:00 2001 From: Yashwin Poojary Date: Fri, 7 Feb 2025 16:52:01 +0530 Subject: [PATCH] A4A > Partner Directory: Fix access control (#99452) --- client/a8c-for-agencies/controller.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/a8c-for-agencies/controller.tsx b/client/a8c-for-agencies/controller.tsx index a764ba7942d280..f4b7c9d44696b2 100644 --- a/client/a8c-for-agencies/controller.tsx +++ b/client/a8c-for-agencies/controller.tsx @@ -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 @@ -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 } ) @@ -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 = ;