mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-08-09 05:18:45 +02: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:
@@ -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