Files
syops/project-governance/plans/2026-03-29-access-control-and-admin-ui-plan.md
T
2026-04-27 17:03:56 +08:00

40 lines
2.0 KiB
Markdown

# 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_admin` role handling.
- Add `user_group_access` table 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_admin` global.
- Allow `admin` to access operational admin pages, but require `super_admin` for user management.
- Support storing `accessible_group_ids` on 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 `X` and 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`.