Technical document

Keep role-based navigation aligned with permission design.

When displaying different menus for each role in the administration screen, we organize how to align screen display, API permissions, routing, and testing.
Frontend / Permissions~10 minPublication Date September 22, 2026Update date September 22, 2026
Keep role-based navigation aligned with permission design.

Summary

Key points of this document

  • Where are the design challenges?
  • How to define boundaries?
  • Details that matter in implementation

Overview

Role-based menu display is an intuitive feature, but hiding a menu is different from prohibiting access. Navigation and API permissions must be handled from the same model. Role-based navigation is not an implementation that hides menus, but a design that aligns API permissions with the user's flow.

Where are the design challenges?

In the administration screen, menus visible to each role may vary. However, if a screen can be opened by directly entering a URL, or an API can be called directly, the permission design is insufficient.

The frontend can control menus to improve user experience, but code on the browser is visible to users. The final decision on permissions must be made on the server side.

In React screens, it's easy to display different menus based on roles. However, merely hiding the display does not protect the API. Furthermore, situations where a user has permission but no navigation path, or a navigation path but is rejected by the API, lead to user confusion.

How to define boundaries?

Define required permissions for routes, menus, and API operations, and refer to the same role model. In React Router, unauthorized screens are handled by route guards, and APIs check permissions for each request.

In design, permissions are treated as capabilities, not as UI if-statements. The screen side receives a list of capabilities and uses them for navigation, buttons, and route guards. The API side determines execution feasibility from the same capabilities or role definitions.

Details that matter in implementation

Permission definitions are managed as TypeScript constants and used for menu generation and route guards. If available permissions are returned in API responses, ensure they align with server-side permission definitions. Buttons on the screen are also displayed based on operation permissions.

In React Router, user capabilities are obtained via a loader, and navigation definitions are given required capabilities. Display policies are separated for each state, such as hiding, disabling, displaying with explanations, or redirecting to another screen.

  • Give menu definitions a requiredCapability and avoid writing role names directly.
  • The API side must always perform permission checks on the server and not depend on screen display.
  • Update sessions and caches to prevent old navigation from persisting after permission changes.

Observe how it breaks

During verification, we check if menus appear correctly for each role, if unauthorized screens cannot be accessed by direct URL input, and if direct API calls are rejected. To prevent missed tests when adding permissions, the role table is used as test cases.

During verification, we check not only the display for each role, but also direct URL access, direct API calls, and screen updates immediately after permission changes. Running major user flows for each role with Playwright can detect discrepancies between user flows and permissions.

Discarded options and tradeoffs

Over-commonizing permission definitions strengthens the coupling between frontend and backend. A safer design is to pass only permission names that are safe to expose to the frontend, keeping the core of the decision logic within the API.

Completely hiding features for which a user has no permission makes the screen cleaner, but it can be unclear why they cannot be used. Displaying them as disabled makes it easier to explain, but complicates the screen. A balance is needed between necessary business awareness and information exposure.

Decision criteria to leave for the team

Role-based navigation is merely the visual aspect of permission management. By validating menus, routes, and APIs with the same approach, both usability and security can be achieved.

Role-based navigation is not merely a visual conditional branch. By creating the permission model and user flows from the same definition, it becomes easier to maintain consistency between the screen and the API.

Technical documents

We will continue to increase technical documentation.

We will continue to organize our thoughts on AI, cloud, business app development, requirements definition, and operational design into documents.

Go to technical documentation list