You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/en/guide/in-depth/access.md
+39-1Lines changed: 39 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,10 +4,11 @@ outline: deep
4
4
5
5
# Access Control
6
6
7
-
The framework has built-in two types of access control methods:
7
+
The framework has built-in three types of access control methods:
8
8
9
9
- Determining whether a menu or button can be accessed based on user roles
10
10
- Determining whether a menu or button can be accessed through an API
11
+
- Using a mixed mode that combines both frontend role-based and backend API-based access control
11
12
12
13
## Frontend Access Control
13
14
@@ -151,6 +152,43 @@ const dashboardMenus = [
151
152
152
153
At this point, the configuration is complete. You need to ensure that after logging in, the format of the menu returned by the interface is correct; otherwise, access will not be possible.
153
154
155
+
156
+
## Mixed Access Control
157
+
158
+
**Implementation Principle**: The mixed mode combines both frontend and backend access control methods, merging the route tables generated from frontend static routes and backend dynamic routes. This approach ensures both the stability of basic routes and the flexibility of permission control. The system simultaneously filters frontend routes based on roles and retrieves dynamic routes from the backend, ultimately combining these two parts to generate a complete route table.
159
+
160
+
**Advantage**: It offers the benefits of both frontend and backend control. Core fixed routes can be maintained in the frontend, while business-related dynamic routes are controlled by the backend, enabling a more flexible permission management solution.
161
+
162
+
**Application Scenario**: Suitable for application systems that have both fixed system function modules and business modules requiring flexible configuration.
163
+
164
+
### Steps
165
+
166
+
- Ensure the current mode is set to mixed access control
167
+
168
+
Adjust `preferences.ts` in the corresponding application directory to ensure `accessMode='mixed'`.
- Configure frontend route permissions (same as frontend access control)
182
+
183
+
- Ensure the roles returned by the interface match the permissions in the frontend route table (same as frontend access control)
184
+
185
+
- Ensure the structure of the menu data returned by the interface is correct (same as backend access control)
186
+
187
+
You need to ensure that user roles match the permission settings in the frontend routes, and that the menu data structure returned by the backend is also correct.
188
+
189
+
At this point, the mixed mode configuration is complete. The system will process both frontend static routes and backend dynamic routes, merging them to generate the final route table and menu.
190
+
191
+
154
192
## Fine-grained Control of Buttons
155
193
156
194
In some cases, we need to control the display of buttons with fine granularity. We can control the display of buttons through interfaces or roles.
0 commit comments