From d3142c55418a6cdc8e76cc987e5bc736ba2a29f4 Mon Sep 17 00:00:00 2001 From: smail Date: Wed, 30 Sep 2026 04:49:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A1=E6=9F=A5=E6=A3=80=E6=9F=A5=E7=82=B9?= =?UTF-8?q?=EF=BC=9A=E4=BF=AE=E6=AD=A3=E7=AE=A1=E7=90=86=E5=91=98=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E9=87=8D=E7=BD=AE=E5=9B=9E=E5=BD=92=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 按生产规则先验证管理员管理普通用户,再覆盖管理员临时密码重置场景,保留现有授权约束。 --- backend/controllers/password_reset_permissions_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/controllers/password_reset_permissions_test.go b/backend/controllers/password_reset_permissions_test.go index 3adc3cf..6763291 100644 --- a/backend/controllers/password_reset_permissions_test.go +++ b/backend/controllers/password_reset_permissions_test.go @@ -58,11 +58,6 @@ func TestEditUserPasswordResetRoleMatrix(t *testing.T) { adminContext := &appcontext.Context{UserID: admin.ID, SessionVersion: admin.SessionVersion, SecurityVersion: admin.SecurityVersion, UserAccount: admin.Account, Role: access.RoleAdmin, RecentAuth: true, RecoveryCodeConfigured: true, Lang: "zhCn"} userContext := &appcontext.Context{UserID: user.ID, SessionVersion: user.SessionVersion, SecurityVersion: user.SecurityVersion, UserAccount: user.Account, Role: access.RoleUser, RecentAuth: true, RecoveryCodeConfigured: true, Lang: "zhCn"} - if result := editUserRequest(t, superContext, `{"id":`+itoa(admin.ID)+`,"password":"ResetAdm12","disabled":0}`); result != 0 { - t.Fatalf("super administrator could not reset administrator: %d", result) - } - assertUserPassword(t, admin.ID, "ResetAdm12") - if _, err := db.Instance.ID(admin.ID).Get(&admin); err != nil { t.Fatal(err) } @@ -74,6 +69,11 @@ func TestEditUserPasswordResetRoleMatrix(t *testing.T) { } assertUserPassword(t, user.ID, "ResetUser123") + if result := editUserRequest(t, superContext, `{"id":`+itoa(admin.ID)+`,"password":"ResetAdm12","disabled":0}`); result != 0 { + t.Fatalf("super administrator could not reset administrator: %d", result) + } + assertUserPassword(t, admin.ID, "ResetAdm12") + if result := editUserRequest(t, adminContext, `{"id":`+itoa(superAdmin.ID)+`,"password":"DeniedPass123","disabled":0}`); result == 0 { t.Fatal("administrator reset of super administrator was accepted") }