mirror of
https://github.com/unmojang/drasl.git
synced 2025-08-03 10:56:06 -04:00
api: don't allow revoke admin status of DefaultAdmins
This commit is contained in:
parent
c16361c6bc
commit
1f48320a2f
3
user.go
3
user.go
@ -328,6 +328,9 @@ func (app *App) UpdateUser(
|
|||||||
if !callerIsAdmin {
|
if !callerIsAdmin {
|
||||||
return User{}, NewBadRequestUserError("Cannot change admin status of user without having admin privileges yourself.")
|
return User{}, NewBadRequestUserError("Cannot change admin status of user without having admin privileges yourself.")
|
||||||
}
|
}
|
||||||
|
if !(*isAdmin) && app.IsDefaultAdmin(&user) {
|
||||||
|
return User{}, NewBadRequestUserError("Cannot revoke admin status of a default admin.")
|
||||||
|
}
|
||||||
user.IsAdmin = *isAdmin
|
user.IsAdmin = *isAdmin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user