2.0 KiB
2.0 KiB
Access Control And Admin UI Implementation Plan
For agent: REQUIRED SUB-SKILL: Use Section 4 or Section 5 to implement this plan. Goal: Add three-tier roles plus knowledge-base access control, and simplify workspace/admin UI around Dify settings and diff management. Architecture: Backend introduces a user-to-knowledge-base access table and expands role handling from two levels to three. Frontend aligns workspace and admin around a shared account/settings pattern, removes noisy admin panels, and tightens diff/search/delete flows. Tech Stack: FastAPI, SQLAlchemy, Alembic, Vue 3, TypeScript, Tailwind CSS
Tasks
Task 1: Role and access schema
- Add
super_adminrole handling. - Add
user_group_accesstable and ORM relationships. - Update bootstrap defaults so the seeded admin becomes
super_admin. - Add Alembic migration.
Task 2: API authorization
- Restrict knowledge-base and file access by role + assigned knowledge bases.
- Keep
super_adminglobal. - Allow
adminto access operational admin pages, but requiresuper_adminfor user management. - Support storing
accessible_group_idson user create/update.
Task 3: Workspace header and settings
- Move Dify settings into the account menu.
- Reuse the same account-menu pattern in workspace and admin.
- Keep admin console entry only for admin tiers.
Task 4: Diff and delete dialogs
- Global diff search uses explicit search type (
knowledge_base/file_name) with matching placeholder. - Diff table uses fixed-width layout and stable footer.
- Knowledge-base delete dialog uses top-right
Xand simplified body.
Task 5: Admin page simplification
- Remove knowledge-base management and recent jobs panels.
- Keep Dify health and user management.
- Add per-user knowledge-base access controls and three role options.
Task 6: Verification and deployment
- Run backend pytest coverage for admin/files/groups access behavior.
- Run frontend build.
- Apply migration on server and rebuild
api/frontend.