mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-12-06 06:56:27 +01:00
fix(auth): prevent admin users from deleting the root account
This commit is contained in:
1 parent
6f03467f35
commit
3c016314e6
3 files changed
+192
-3
No files matched your search
@@ -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')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user