Menu Permissions
This page shows a Spring Boot example that uses jCasbin for menu-based access control. The same pattern (policy + role assignments + menu hierarchy) can be applied in other languages supported by Casbin.
1. Configuration
Define role–menu permissions, user–role assignments, and menu hierarchy in policy.csv. Full example: jCasbin menu permission.
1.1 Обзор
The policy file defines: (1) which roles can access which menu items, (2) which users have which roles, and (3) parent–child relationships between menu items. Together this gives role-based, hierarchical menu visibility.
1.2 Permission rules (p)
Lines starting with p define whether a role (sub) may perform an action (act) on a menu item (obj). The effect (eft) is allow or deny.
Примеры:
p, ROLE_ROOT, SystemMenu, read, allowgrantsROLE_ROOTread access toSystemMenu.p, ROLE_ROOT, UserMenu, read, denydeniesROLE_ROOTread access toUserMenu.