Devizur
All insightsEngineering

Authorization for Admin, POS and Site Applications: Roles, Permissions and API Enforcement

How to keep menu visibility, roles, permissions and backend enforcement aligned when one business platform serves several applications.

Soud Al Raihan6 August 20263 min read
RolePermissionsReact MenusASP.NET Core Policies

History and context

Early applications
Many systems began with coarse administrator/user role checks.
Enterprise RBAC
Role-based access control made permissions easier to administer at organisational scale.
Modern multi-app platforms
One user may have different roles, active contexts or permissions across shops, tenants and applications.
Current practice
UI visibility is derived from permissions, while APIs remain the authoritative enforcement boundary.

Roles are management; permissions are capability

A role such as SHOP_ADMIN is a convenient bundle. The actual application decision is usually a permission such as PRODUCT_UPDATE or ORDER_REFUND.

UserActive RolePermissionsMenus + APIs
Roles aggregate permissions; permissions drive capability checks.

A simple relational model

SQL
s_role
s_permission
s_role_permission
app_menu
app_menu_permission

A menu can require one or more permissions. The backend should also expose the user's effective permissions for the active operating context.

What belongs in the token?

Stable identity and coarse claims may fit naturally in an access token. Large, rapidly changing permission sets can make tokens stale and oversized. Many systems therefore keep access tokens relatively compact and resolve effective permissions through a short-lived cache or dedicated authorization service.

Frontend menu matching

TypeScript
const canAccessMenu = (
  requiredPermissions: string[],
  userPermissions: Set<string>
) =>
  requiredPermissions.length > 0 &&
  requiredPermissions.every(p => userPermissions.has(p));
Important
If a menu has no permission mapping and your security model is deny-by-default, it should not automatically become accessible.

Backend enforcement

C#
[Authorize(Policy = "PRODUCT_UPDATE")]
[HttpPut("products/{id:long}")]
public async Task<IActionResult> Update(
    long id,
    UpdateProductRequest request)
{
    await service.UpdateAsync(id, request);
    return NoContent();
}

One active role can simplify business context

If the application intentionally operates with one active role or site context at a time, resolve that context during login or context selection and calculate effective permissions for it. This is often easier to reason about than mixing permissions from unrelated roles across locations.

Business value and practical considerations

Strengths

  • Central permission vocabulary
  • Consistent menu behaviour
  • Server-side security
  • Reusable across web/POS/admin

Considerations

  • Permission lifecycle management
  • Token/cache freshness
  • Multi-tenant context
  • Nested menu inheritance rules
SA
Soud Al RaihanSecurity and application architecture · Devizur

References

Primary documentation used for terminology and current platform guidance: