-
Notifications
You must be signed in to change notification settings - Fork 8.4k
feat: 添加混合权限访问控制模式支持 #6294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 添加混合权限访问控制模式支持 #6294
Conversation
|
WalkthroughA "mixed" access control mode was introduced, combining frontend and backend access control mechanisms. Documentation was updated to describe this new mode, and the type definition for access mode was extended to include "mixed." The route generation logic was modified to merge frontend and backend routes when in mixed mode. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant App
participant FrontendAccess
participant BackendAccess
User->>App: Request Access (mixed mode)
App->>FrontendAccess: Generate Frontend Routes
App->>BackendAccess: Generate Backend Routes
FrontendAccess-->>App: Frontend Routes
BackendAccess-->>App: Backend Routes
App->>App: Merge Routes
App-->>User: Combined Accessible Routes
Suggested reviewers
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/effects/access/src/accessible.ts (1)
99-107: Consider potential route conflicts in mixed mode.The implementation correctly uses
Promise.allfor concurrent execution and merges the results. However, consider these scenarios:
- Route name/path conflicts: What happens if frontend and backend generate routes with identical names or paths?
- Route precedence: Frontend routes are placed first in the merged array - is this the intended behavior?
Consider adding conflict detection or a merge strategy:
case 'mixed': { const [frontend_resultRoutes, backend_resultRoutes] = await Promise.all([ generateRoutesByFrontend(routes, roles || [], forbiddenComponent), generateRoutesByBackend(options), ]); + // Optional: Add conflict detection + const frontendNames = new Set(frontend_resultRoutes.map(r => r.name)); + const conflicts = backend_resultRoutes.filter(r => frontendNames.has(r.name)); + if (conflicts.length > 0) { + console.warn('Route name conflicts detected in mixed mode:', conflicts.map(r => r.name)); + } resultRoutes = [...frontend_resultRoutes, ...backend_resultRoutes]; break; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
docs/src/en/guide/in-depth/access.md(2 hunks)docs/src/guide/in-depth/access.md(2 hunks)packages/@core/base/typings/src/app.d.ts(1 hunks)packages/effects/access/src/accessible.ts(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Check (windows-latest)
- GitHub Check: Test (windows-latest)
- GitHub Check: post-update (windows-latest)
- GitHub Check: post-update (ubuntu-latest)
🔇 Additional comments (5)
packages/@core/base/typings/src/app.d.ts (1)
63-65: LGTM! Clean type definition extension.The addition of the 'mixed' access mode to the type system is well-documented and follows the existing pattern. The comment clearly explains the purpose of the mixed mode.
docs/src/guide/in-depth/access.md (2)
7-11: Excellent documentation update for mixed mode introduction.The update correctly reflects the new count of access control methods and provides a clear overview of the mixed mode capability.
163-199: Comprehensive mixed mode documentation.The new section provides excellent coverage of the mixed access control mode:
- Clear implementation principle explanation
- Well-defined advantages
- Step-by-step configuration instructions
- Proper cross-references to existing sections
The documentation will help users understand and implement the mixed mode effectively.
docs/src/en/guide/in-depth/access.md (2)
7-11: Consistent English documentation update.The English version correctly mirrors the Chinese documentation updates, maintaining consistency across both language versions.
155-191: Well-structured English mixed mode documentation.The English documentation provides the same comprehensive coverage as the Chinese version:
- Clear technical explanations
- Proper translation of concepts
- Complete configuration guidance
- Consistent formatting and structure
This ensures users can access the mixed mode documentation in their preferred language.
…into web * 'main' of https://github.com/baohaojie123/vue-vben-admin: types: 扩展user-dropdown组件的menus类型,支持iconify (vbenjs#6283) fix: resolve onClosed method failure in connectedComponent of useVbenModal (vbenjs#6309) fix: 修复使用useVbenVxeGrid配置hasEmptyText、hasEmptyRender不生效的问题 (vbenjs#6310) fix: When defaultHomePage is inconsistent with user.homePath, the pa… (vbenjs#6299) docs(settings): 完善'生产环境动态配置'步骤 (vbenjs#6297) fix: alert width fixed in small screen (vbenjs#6312) style: fix lint error (vbenjs#6298) feat: support for hybrid permission access control mode (vbenjs#6294) fix: fix table-title slot not work (vbenjs#6295) # Conflicts: # docs/src/en/guide/in-depth/access.md
* 'main' of https://github.com/baohaojie123/vue-vben-admin: (35 commits) chore: release 5.5.7 feat: improve vbenCheckButtonGroup (vbenjs#6329) types: 扩展user-dropdown组件的menus类型,支持iconify (vbenjs#6283) fix: resolve onClosed method failure in connectedComponent of useVbenModal (vbenjs#6309) fix: 修复使用useVbenVxeGrid配置hasEmptyText、hasEmptyRender不生效的问题 (vbenjs#6310) fix: When defaultHomePage is inconsistent with user.homePath, the pa… (vbenjs#6299) docs(settings): 完善'生产环境动态配置'步骤 (vbenjs#6297) fix: alert width fixed in small screen (vbenjs#6312) style: fix lint error (vbenjs#6298) feat: support for hybrid permission access control mode (vbenjs#6294) fix: fix table-title slot not work (vbenjs#6295) fix: Update index.ts (vbenjs#6268) fix: reset slider-captcha after login failed (vbenjs#6275) fix: json-bigint parse used in vxeTable (vbenjs#6271) fix: repair the unexpected form default value (vbenjs#5567) feat: optimize logo display (vbenjs#6267) feat: improve check updates (vbenjs#6257) feat: enhances compatibility with APIs returning large numeric values (vbenjs#6250) fix: component Input is not registered when initialize page (vbenjs#6246) feat: ellipsis text automatically displays tooltip based on ellipsis (vbenjs#6244) ... # Conflicts: # apps/web-naive/src/adapter/form.ts # apps/web-naive/src/bootstrap.ts # docs/src/components/common-ui/vben-ellipsis-text.md # docs/src/en/guide/in-depth/access.md # docs/src/guide/essentials/build.md # docs/src/guide/essentials/route.md
Description
close #6285
添加了混合权限访问控制模式,允许同时使用前端和后端权限控制方式,提供两者结合控制的方式
Type of change
Please delete options that are not relevant.
pnpm-lock.yamlunless you introduce a new test example.Checklist
pnpm run docs:devcommand.pnpm test.feat:,fix:,perf:,docs:, orchore:.Summary by CodeRabbit