diff --git a/src/controllers/PermissionController.ts b/src/controllers/PermissionController.ts index e123e81..663343c 100644 --- a/src/controllers/PermissionController.ts +++ b/src/controllers/PermissionController.ts @@ -90,7 +90,7 @@ export class PermissionController { if (oldPermission.id != permission.id) { throw new PermissionIdsNotMatchingError(); } - let existingPermission = await this.permissionRepository.findOne({ target: permission.target, action: permission.action, principal: permission.principal }, { relations: ['principal'] }); + let existingPermission = await this.permissionRepository.findOne({ target: permission.target, action: permission.action, principal: await permission.getPrincipal() }, { relations: ['principal'] }); if (existingPermission) { await this.remove(permission.id, true); return new ResponsePermission(existingPermission);