mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-24 02:01:41 +00:00
Merge pull request #5370 from mikiher/fix/root-user-delete-protection
Prevent admin users from deleting the root account
This commit is contained in:
commit
2d9f63963e
3 changed files with 40 additions and 6 deletions
|
|
@ -530,7 +530,14 @@ class User extends Model {
|
|||
},
|
||||
{
|
||||
sequelize,
|
||||
modelName: 'user'
|
||||
modelName: 'user',
|
||||
hooks: {
|
||||
beforeDestroy(user) {
|
||||
if (user.type === 'root') {
|
||||
throw new Error('Root user cannot be deleted')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue