From c8acbdb36330559688acf3d818b67531368f57ab Mon Sep 17 00:00:00 2001 From: creamlike1024 Date: Sun, 31 Aug 2025 14:54:47 +0800 Subject: [PATCH] fix: update sidebar modules role check --- controller/user.go | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/controller/user.go b/controller/user.go index a65eb5aa2..3110bf1b0 100644 --- a/controller/user.go +++ b/controller/user.go @@ -664,18 +664,7 @@ func UpdateSelf(c *gin.Context) { if sidebarModules, exists := requestData["sidebar_modules"]; exists { userId := c.GetInt("id") userRole := c.GetInt("role") - // 注意超级管理员目前在 calculateUserPermissions 中被设置为无权更新设置 - perms := calculateUserPermissions(userRole) - allow, ok := perms["sidebar_settings"] - if !ok { - c.JSON(http.StatusOK, gin.H{ - "success": false, - "message": "无权更新设置", - }) - return - } - allowBool, ok := allow.(bool) - if !ok || !allowBool { + if userRole != common.RoleRootUser && userRole != common.RoleAdminUser { c.JSON(http.StatusOK, gin.H{ "success": false, "message": "无权更新设置",