mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-23 01:31:43 +00:00
fix(auth): prevent admin users from deleting the root account
This commit is contained in:
parent
6f03467f35
commit
3c016314e6
3 changed files with 192 additions and 3 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