Skip to content

PRD: Policy definition, permission catalog & grants

ModulePermissionsPRD IDPRD-PERM-001
StatusReady to devFEATPERM · BANA-1435
EpicPlaneBANA-1549
Date2026-05-28Versionv1.0
Packages@nx/identityURDPERM
SurfaceBO · OpsClient · Owner/Mgr
OwnerPhát Nguyễn

What policy definition, permission catalog & grants is

The operations team (in the back office) and merchant owners (in the team module) get a management surface for BANA's authorization model: maintain the permission catalog and manage the policy definition. BANA's authorization model - priority-based RBAC with per-merchant authorization (now enabled) - already stores a permission catalog and policy grants, and the underlying grant/revoke/effective-permission logic already existed before this. What is missing is a usable surface to drive them: the operations team cannot browse the permission catalog, attach or detach permissions, or inspect which roles, users, and merchants a policy applies to without touching the data directly.

Structured by target

This PRD builds that management surface on top of the existing authorization logic: a permission catalog screen (list / create / edit) and a policy-definition screen organised into target sections - each section is a two-panel layout (subject list on the left, the selected subject's grant tabs on the right) with its own grant dialog. The same surface is cloned into the merchant-facing team module so an owner can manage policy within their own merchant scope, backed by a bilingual English/Vietnamese labelling pass.

The permission catalog is managed through three screens - list, create, edit - each permission carries a system-wide unique code, subject, action, and scope. Policy definition is split into per-target sections: pick a user, a role, or a merchant, then grant/revoke permissions through tabbed tables and dialogs. Assigning a role to a person works from three entry points - the Permissions tab in the employee form on the Client app, the by-person tab and the by-role tab in policy definition - all three write into the same grant set.

The easiest place to get it wrong

Idempotent means skipped and counted, not an error

Re-granting an already-granted item is skipped and counted, never duplicated - and never raises an error either. Assigning a role to a user can carry an optional domain that limits where the role takes effect - leave it empty and it applies globally.

Owners manage policy within their own merchant scope through a clone of this surface inside the team module - the same per-target logic, not a separate fork.

Proprietary and Confidential. Unauthorized copying, distribution, or use of this software is strictly prohibited.