We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c64f899 commit abedb9eCopy full SHA for abedb9e
server/handles/user.go
@@ -1,9 +1,10 @@
1
package handles
2
3
import (
4
- "github.com/alist-org/alist/v3/pkg/utils"
5
"strconv"
6
+ "github.com/alist-org/alist/v3/pkg/utils"
7
+
8
"github.com/alist-org/alist/v3/internal/model"
9
"github.com/alist-org/alist/v3/internal/op"
10
"github.com/alist-org/alist/v3/server/common"
@@ -97,6 +98,14 @@ func UpdateUser(c *gin.Context) {
97
98
return
99
}
100
101
102
+ if !utils.SliceEqual(user.Role, req.Role) {
103
+ if req.IsAdmin() || req.IsGuest() {
104
+ common.ErrorStrResp(c, "cannot assign admin or guest role to user", 400, true)
105
+ return
106
+ }
107
108
109
if err := op.UpdateUser(&req); err != nil {
110
common.ErrorResp(c, err, 500)
111
} else {
0 commit comments