Skip to content

Commit

Permalink
Fix:Updating root user #3366
Browse files Browse the repository at this point in the history
  • Loading branch information
advplyr committed Sep 2, 2024
1 parent f194c5b commit 60e348f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server/controllers/UserController.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,12 @@ class UserController {
async update(req, res) {
const user = req.reqUser

if (user.type === 'root' && !req.user.isRoot) {
if (user.isRoot && !req.user.isRoot) {
Logger.error(`[UserController] Admin user "${req.user.username}" attempted to update root user`)
return res.sendStatus(403)
} else if (user.isRoot) {
// Root user cannot update type
delete req.body.type
}

const updatePayload = req.body
Expand Down

0 comments on commit 60e348f

Please sign in to comment.