diff --git a/apps/api/v2/src/modules/oauth-clients/controllers/oauth-client-users/oauth-client-users.controller.ts b/apps/api/v2/src/modules/oauth-clients/controllers/oauth-client-users/oauth-client-users.controller.ts index f53ee7f1b8aae..e54d8d666542c 100644 --- a/apps/api/v2/src/modules/oauth-clients/controllers/oauth-client-users/oauth-client-users.controller.ts +++ b/apps/api/v2/src/modules/oauth-clients/controllers/oauth-client-users/oauth-client-users.controller.ts @@ -152,7 +152,11 @@ export class OAuthClientUsersController { const existingUser = await this.userRepository.findById(userId); if (!existingUser) { - throw new NotFoundException(`User with ${userId} does not exist`); + throw new NotFoundException(`User with ID=${userId} does not exist`); + } + + if (!existingUser.isPlatformManaged) { + throw new NotFoundException(`Can't delete non managed user with ID=${userId}`); } const user = await this.userRepository.delete(userId);