Developers/Workflow/View As Role Switching

From wiki.storlye.com
Revision as of 13:43, 15 June 2026 by Wikistorlye admin (talk | contribs) (Document View as role switching for superadmin)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

View As Role Switching

Objective

Allow a logged superadmin to navigate the app as another role while keeping the View as control always available.

Scope

- Frontend: avatar popup menu in main page header. - Roles available in View as: superadmin, admin, moderator, user. - Applies only when the authenticated account has role code superadmin.

Behavior

- A new section "View as" is shown in the user avatar menu. - Each role option shows a marker on the left:

 - "√" for the active effective role.
 - blank marker for inactive options.

- Default state for superadmin login:

 - superadmin starts selected with "√".

- On selection:

 - superadmin -> opens Super Admin panel.
 - admin -> opens Admin panel.
 - moderator -> opens Moderator panel.
 - user -> navigates to Home.

- The "View as" section remains visible after switching, allowing back-and-forth role simulation without logging out.

Access Model

- Authentication roles from backend remain unchanged. - View as creates an effective role in frontend navigation only. - Panel access checks use the effective role for navigation guards.

UX Notes

- This is role simulation for navigation and UI surface. - Logged identity/session remains the same authenticated superadmin user.

Technical Notes

- Primary implementation file: App.tsx - Added i18n keys for menu labels:

 - actionViewAs
 - actionUser