summaryrefslogtreecommitdiffstats
path: root/api/user.go
diff options
context:
space:
mode:
Diffstat (limited to 'api/user.go')
-rw-r--r--api/user.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/api/user.go b/api/user.go
index 4d12f0f33..34cbec151 100644
--- a/api/user.go
+++ b/api/user.go
@@ -995,7 +995,7 @@ func updateRoles(c *Context, w http.ResponseWriter, r *http.Request) {
}
if model.IsInRole(new_roles, model.ROLE_SYSTEM_ADMIN) && !c.IsSystemAdmin() {
- c.Err = model.NewAppError("updateRoles", "The system_admin role can only be set by another system admin", "")
+ c.Err = model.NewAppError("updateRoles", "The system admin role can only be set by another system admin", "")
c.Err.StatusCode = http.StatusForbidden
return
}
@@ -1018,6 +1018,12 @@ func updateRoles(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
+ if user.IsInRole(model.ROLE_SYSTEM_ADMIN) && !c.IsSystemAdmin() {
+ c.Err = model.NewAppError("updateRoles", "The system admin role can only by modified by another system admin", "")
+ c.Err.StatusCode = http.StatusForbidden
+ return
+ }
+
ruser := UpdateRoles(c, user, new_roles)
if c.Err != nil {
return