2.0 KiB
2.0 KiB
Permission Module
The Permission module provides frontend permission checks and gates. It also corresponds to the backend permission endpoint and permission discovery service used by AccessControl.
Source Map
| Area | Path |
|---|---|
| Frontend module | apps/admin/src/core/Permission/ |
| Frontend gates | apps/admin/src/core/Permission/view/gates/ |
| Frontend hook | apps/admin/src/core/Permission/hooks/usePermissions.ts |
| Frontend types | apps/admin/src/core/Permission/entities/permission.ts |
| Backend module | backend/app/base_modules/Permission/ |
| Backend permission service | backend/app/services/permission_service.ts |
Documentation
| Page | Purpose |
|---|---|
| Frontend | Permission types, hook, gates, and usage rules. |
| Backend | Permission endpoint, permission discovery, and permission configs. |
Main Capabilities
- Check whether current user has required permission slugs.
- Support
allandanymatching modes. - Render or hide UI actions through
PermissionGate. - Protect full pages through
PermissionPageGate. - Treat super admin as an all-permissions user.
High-Level Flow
AuthProvider current user
-> AuthUser.permissions
-> usePermissions()
-> hasPermission()
-> PermissionGate or PermissionPageGate
Ownership Rules
- Permission frontend owns permission checks and gate components.
- Auth owns loading current user permissions.
- AccessControl owns managing roles and assigning permissions.
- Backend modules own their own permission definitions in
config/permissions.ts.