mirror of
https://github.com/samsonjs/immich.git
synced 2026-04-27 15:07:45 +00:00
fix(server): Prevent delete admin user (#1023)
This commit is contained in:
parent
47f5e4134e
commit
614743c8f4
1 changed files with 5 additions and 0 deletions
|
|
@ -119,6 +119,11 @@ export class UserService {
|
||||||
if (!user) {
|
if (!user) {
|
||||||
throw new BadRequestException('User not found');
|
throw new BadRequestException('User not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (user.isAdmin) {
|
||||||
|
throw new BadRequestException('Cannot delete admin user');
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const deletedUser = await this.userRepository.delete(user);
|
const deletedUser = await this.userRepository.delete(user);
|
||||||
return mapUser(deletedUser);
|
return mapUser(deletedUser);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue