Back to Nocobase

Role Union

docs/docs/en/users-permissions/acl/union.md

2.0.494.5 KB
Original Source

Role Union

Role Union is a permission management mode. According to system settings, system developers can choose to use Independent roles, Allow roles union, or Roles union only, to meet different permission requirements.

Independent roles

By default, the system uses independent roles. Users must switch between the roles they possess individually.

Allow roles union

System developers can enable Allow roles union, allowing users to simultaneously have permissions of all assigned roles while still permitting users to switch roles individually.

Roles union only

Users are enforced to only use Role Union and cannot switch roles individually.

Rules for Role Union

Role union grants the maximum permissions across all roles. Below are the explanations for resolving permission conflicts when roles have different settings on the same permission.

Operation Permission Merge

Example:
Role1 is configured to Allows to configure interface and Role2 is configured to Allows to install, activate, disable plugins

When logging in with the Full Permissions role, the user will have both permissions simultaneously.

Data Scope Merge

Data Rows

Scenario 1: Multiple roles setting conditions on the same field

Role A filter: Age < 30

UserIDNameAge
1Jack23
2Lily29

Role B filter: Age > 25

UserIDNameAge
2Lily29
3Sam32

After merging:

UserIDNameAge
1Jack23
2Lily29
3Sam32

Scenario 2: Different roles setting conditions on different fields

Role A filter: Age < 30

UserIDNameAge
1Jack23
2Lily29

Role B filter: Name contains "Ja"

UserIDNameAge
1Jack23
3Jasmin27

After merging:

UserIDNameAge
1Jack23
2Lily29
3Jasmin27

Data Columns

Role A visible columns: Name, Age

UserIDNameAge
1Jack23
2Lily29

Role B visible columns: Name, Sex

UserIDNameSex
1JackMan
2LilyWoman

After merging:

UserIDNameAgeSex
1Jack23Man
2Lily29Woman

Mixed Rows and Columns

Role A filter: Age < 30, columns Name, Age

UserIDNameAge
1Jack23
2Lily29

Role B filter: Name contains "Ja", columns Name, Sex

UserIDNameSex
3JadeWoman
4JamesMan

After merging:

UserIDNameAgeSex
1Jack23<span style="background-color:#FFDDDD">Man</span>
2Lily29<span style="background-color:#FFDDDD">Woman</span>
3Jade<span style="background-color:#FFDDDD">27</span>Woman
4James<span style="background-color:#FFDDDD">31</span>Man

Note: Cells with red background indicate data invisible in individual roles but visible in the merged role.

Summary

Role merging data-scope rules:

  1. Between rows, if any condition is satisfied, the row has permissions.
  2. Between columns, fields are combined.
  3. When rows and columns are both configured, rows and columns are merged separately, not by row-column combinations.