Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A4A > Partner Directory: Fix access control #99452

Merged
merged 1 commit into from
Feb 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading