mirror of
https://github.com/immich-app/immich.git
synced 2025-01-12 15:32:36 +02:00
fix(server): Prevent delete admin user (#1023)
This commit is contained in:
parent
47f5e4134e
commit
614743c8f4
@ -119,6 +119,11 @@ export class UserService {
|
||||
if (!user) {
|
||||
throw new BadRequestException('User not found');
|
||||
}
|
||||
|
||||
if (user.isAdmin) {
|
||||
throw new BadRequestException('Cannot delete admin user');
|
||||
}
|
||||
|
||||
try {
|
||||
const deletedUser = await this.userRepository.delete(user);
|
||||
return mapUser(deletedUser);
|
||||
|
Loading…
Reference in New Issue
Block a user