Core · Using plugins · Permissions and data access

Permission management

Capabilities

@nocobase/app-plugin-authorization provides permission sets, page and settings access, business actions, and database field, record and relation policies.

The application declares resources and management UI; the plugin supplies authorization decisions and data policies.

Configure access

ObjectControls
Permission setGrants assigned to users or other subjects
pageOpening a page
settingsReading or changing an administration surface
compositeA business action and its underlying data operations
database.collectionPolicies for a Collection registered with authorization

Resources and actions must be declared. A table's existence does not register its Collection with the permission model.

The configured root permission set is unrestricted and should be distinct from ordinary business roles. Current account creation assigns Member explicitly; it is not an unavoidable implicit permission for every signed-in user.

Scenarios and examples

Example: viewing and editing orders

  1. Declare view and edit capabilities, including fields and record selections.
  2. Grant support staff view access and responsible users the required edit access.
  3. Use route authz and useCan for navigation and buttons; check the operation again in the API.
  4. Apply record and field policies through public methods such as authz.database.policyFor(...) or authorizeRepository(...).
  5. Verify lists, details, relations and direct API calls with different roles.

An operation check followed by an unrestricted query loses record and field restrictions. Hiding navigation is not server authorization.

Development prompt (for a Coding Agent working in the application directory):

Plain text
Use Authorization to add order view and edit access. Declare pages and business
actions, reuse existing roles, and do not add root or unrestricted grants.
Control UI actions and enforce server-side operation, record and field policies.
Test lists, details, relations and direct API calls as read-only, editing and denied users.

Done whenRead-only users can read allowed orders but cannot edit; other records and restricted fields stay inaccessible.

Key principles and implementation

These are the integration areas and expected interface changes for this example. They describe development work; use the actual file layout of your application.

Integration areaCode or configuration changeUI and behavior change
Authorization config and resource declarationsRegister Collections, actions and field dependenciesManagement choices reflect business capabilities
Business services and Repository queriesApply returned authorization policiesLists, details and writes enforce the same boundaries
Page routes and controlsUse authz and useCan, retaining API enforcementUI access reflects the role

Integration and entry points

Register Client and Server plugins after Authentication, then apply migrations and seeds. Compose configuration in server/config/authorization.ts; resolve authorizationToken from /server for trusted server integration.

The plugin exposes /api/authorization, AuthorizationClient and hooks such as useCan. The application builds its permission management pages and declares grantable business capabilities.

Record-access extensions

None grants an action. Management UI grouping also has no authorization effect. See Manage plugins for installation.

AI development constraints and verification

Plugin-specific development constraints

  • Declare capabilities before granting them; database queries outside the permission model are not protected by those grants.
  • Check pages, actions, fields, records and relations, not just a boolean can result followed by unrestricted queries.
  • Use ordinary roles and direct API requests; review role seed changes for unintended expansion of existing access.

These are acceptance requirements for your integration, not claims of completed live verification. Ask the Agent to report actual changes, executed checks and unverified items. See Continue developing your app and Testing for project guidance, Skills and shared checks.

Source: public plugin entries and implementation.

NocoBase docs assistant

Ask anything about NocoBase…

Each question is answered independently, without earlier questions or answers. Include all relevant context.