Skip to content

fix: surface "Not Permitted" banner on 403 and survive cross-tab sign-out#961

Open
chrischrischris wants to merge 7 commits into
mainfrom
authflow
Open

fix: surface "Not Permitted" banner on 403 and survive cross-tab sign-out#961
chrischrischris wants to merge 7 commits into
mainfrom
authflow

Conversation

@chrischrischris

Copy link
Copy Markdown
Contributor

Editor previously errored (permissions.some on undefined) when opening a file the user lacks access to. Now edit.js intercepts the 403 from getDoc, tears down the speculative WS, and shows a non-modal "Not Permitted" auth banner with da-content and the collab actions wrapper marked inert.

The shared da-auth-banner gains title/message/buttonLabel/modal options and switches its action to sign-out so users can switch orgs. da-dialog gains a reflected modal property; non-modal mode uses native .show() and adopts a small inner stylesheet (new da-dialog-non-modal.css) into sl-dialog's shadow root so the native drops out of UA absolute positioning and the host's fixed/flex centering takes effect.

Cross-tab sign-out: attachAuthMonitor now also flips nx-profile's cached _signedIn so the gnav avatar collapses to "Sign in" in tabs that didn't initiate the logout. daFetch's 401 handler treats a missing nx-ims as "already signed out" and falls through to the banner instead of bouncing to /not-found (which was itself bouncing to the IMS sign-in screen).

@aem-code-sync

aem-code-sync Bot commented May 22, 2026

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-sync branch
Commits

…-out

Editor previously crashed (permissions.some on undefined) when opening a
file the user lacks access to. Now edit.js intercepts the 403 from getDoc,
tears down the speculative WS, and shows a non-modal "Not Permitted"
auth banner with da-content and the collab actions wrapper marked inert.

The shared da-auth-banner gains title/message/buttonLabel/modal options
and switches its action to sign-out so users can switch orgs. da-dialog
gains a reflected modal property; non-modal mode uses native .show() and
adopts a small inner stylesheet (new da-dialog-non-modal.css) into
sl-dialog's shadow root so the native <dialog> drops out of UA absolute
positioning and the host's fixed/flex centering takes effect.

Cross-tab sign-out: attachAuthMonitor now also flips nx-profile's cached
_signedIn so the gnav avatar collapses to "Sign in" in tabs that didn't
initiate the logout. daFetch's 401 handler treats a missing nx-ims as
"already signed out" and falls through to the banner instead of bouncing
to /not-found (which was itself bouncing to the IMS sign-in screen).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Gate the sign-in/Not-Permitted modal to Browse and Edit views and leave
Home and /apps/ untouched so long-running app tasks survive an org change
or cross-tab sign-in while the IMS token is still valid.

- Add getAuthView()/isModalView() helpers to classify the current page.
- Cross-tab sign-out still collapses the gnav and drops the WS in every
  tab, but only Browse/Edit get the blocking modal.
- Detect in-place token rotation (e.g. an org switch) and re-validate
  permissions only in Browse/Edit via a non-destructive probe; a 200 is a
  no-op and a 403 surfaces the Not-Permitted banner.
- Skip the cross-tab sign-in reload under /apps/.
- Gate the reactive daFetch 401 modal behind isModalView().

Co-authored-by: Cursor <cursoragent@cursor.com>
- Observe in-tab localStorage writes (not just cross-tab storage events) so
  an org switch on the current page surfaces the Not-Permitted modal there
  too, without polling.
- In Edit, reload when access is restored (200) while the auth banner is
  showing, so switching back to a permitted org reopens the editor.
- Mark da-browse inert under the banner and dim it via :host([inert]),
  mirroring da-content.

Co-authored-by: Cursor <cursoragent@cursor.com>
The Edit re-check already reloaded once access returned while the auth
banner was showing; mirror that in Browse so switching back to a permitted
org clears the Not-Permitted modal instead of leaving the listing stuck
behind it.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant