File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ func (h *SessionHandlers) Register(c *gin.Context) {
80
80
c .JSON (http .StatusForbidden , gin.H {"error" : "Superuser registration is not allowed" })
81
81
return
82
82
}
83
- // If registering as admin, you need to be a superuser
83
+ // If registering as admin, you need to be a superuser or admin
84
84
if * newUser .Role == api .UserRequestRoleAdmin {
85
85
// Check if the current user is authenticated with superuser privileges
86
86
_ , role , err := auth .AuthenticationFunc (c .GetHeader ("Authorization" ))
@@ -89,7 +89,7 @@ func (h *SessionHandlers) Register(c *gin.Context) {
89
89
return
90
90
}
91
91
// Check if the user has superuser privileges
92
- if role != "superuser" {
92
+ if role != "superuser" && role != "admin" {
93
93
c .JSON (http .StatusForbidden , gin.H {"error" : "Superuser privileges required to register " + string (* newUser .Role ) + " accounts" })
94
94
return
95
95
}
You can’t perform that action at this time.
0 commit comments