diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/account/DeleteActive.java b/gerrit-server/src/main/java/com/google/gerrit/server/account/DeleteActive.java index d013120119..8b713cad91 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/account/DeleteActive.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/account/DeleteActive.java @@ -53,7 +53,7 @@ public class DeleteActive implements RestModifyView { @Override public Response apply(AccountResource rsrc, Input input) throws RestApiException, OrmException, IOException { - if (self.get() == rsrc.getUser()) { + if (self.get().hasSameAccountId(rsrc.getUser())) { throw new ResourceConflictException("cannot deactivate own account"); } diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/account/Emails.java b/gerrit-server/src/main/java/com/google/gerrit/server/account/Emails.java index b894f5673b..8cfb66c867 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/account/Emails.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/account/Emails.java @@ -56,7 +56,8 @@ public class Emails @Override public AccountResource.Email parse(AccountResource rsrc, IdString id) throws ResourceNotFoundException { - if (self.get() != rsrc.getUser() && !self.get().getCapabilities().canAdministrateServer()) { + if (!self.get().hasSameAccountId(rsrc.getUser()) + && !self.get().getCapabilities().canAdministrateServer()) { throw new ResourceNotFoundException(); }