fix(admin): restore review workspace and add user account editing

This commit is contained in:
gr
2026-11-03 14:10:56 +08:00
parent 3cb30a7574
commit f7f323462c
82 changed files with 5281 additions and 2095 deletions
+3 -1
View File
@@ -897,7 +897,8 @@ def create_app(
raise HTTPException(status_code=404, detail="用户不存在")
# 改角色和启停是两个按钮:改了哪样就要哪样的权限
# Password reset is also a user edit; status-only access cannot reset it.
if body.role != target["role"] or body.password:
new_username = body.username.strip() if "username" in body.model_fields_set else None
if body.role != target["role"] or body.password or (new_username is not None and new_username != target["username"]):
need(principal, "user:write")
if bool(body.active) != target["active"]:
need(principal, "user:status")
@@ -905,6 +906,7 @@ def create_app(
database.update_user(
user_id, body.role, body.active, body.password,
actor_id=principal.id, ip=client_ip(request),
new_username=new_username,
)
except ValueError as exc:
raise HTTPException(status_code=400, detail=str(exc)) from exc