Files
syops/project-governance/plans/2026-03-29-permission-console-and-department-workflow-plan.md
T
2026-04-27 17:03:56 +08:00

2.0 KiB

Permission Console And Department Workflow Plan

Continue from the existing implementation. Do not rebuild the system from scratch.

Goal

Make the admin experience coherent around department-based permissions, keep admin as the only super admin, and move Dify operational controls into the user menu while keeping workspace behavior department-aware.

Outcomes

  • admin remains the only super_admin
  • users are managed through modal create/edit flows
  • departments become the primary access boundary for knowledge bases
  • workspace exposes a department selector on the left and respects that scope
  • Dify settings and Dify health move under the username menu
  • stale-sync recovery uses toast feedback only

Backend

  1. Re-verify the unique-super-admin policy around admin
  2. Keep department-based visibility and department ownership on knowledge bases
  3. Ensure user payloads expose:
    • primary_department_id
    • primary_department_name
    • accessible_department_ids
    • extra_department_ids
  4. Keep Dify health and stale recovery endpoints, but align wording with “stuck sync” semantics

Frontend

  1. Workspace
    • show department switcher in the left sidebar
    • keep knowledge-base create/edit department ownership in dialogs
    • expose Dify设置 and Dify健康状态 from the username menu
  2. Admin
    • use the page as 权限管理
    • left side: department management
    • right side: users and department access
    • create/edit users via modal only
    • remove obsolete knowledge-base-management and recent-jobs sections
  3. Dify Health
    • render as dialog from the username menu
    • replace banner-style feedback with 3-second toast feedback
    • explain each health metric in plain language

Validation

  • run backend pytest
  • run frontend build
  • deploy api + worker + frontend
  • smoke-check:
    • admin is the only super admin
    • department list and user list load
    • workspace department switch filters knowledge bases
    • Dify health opens from username menu and stale recovery shows toast