Fix more comparisons of current user

Change-Id: I3a7c46dfa705ae6fa088735af7f031a840816957
This commit is contained in:
David Pursehouse 2018-05-22 16:03:42 +09:00
parent 879c2a53ee
commit adfefda094
2 changed files with 3 additions and 2 deletions

View File

@ -53,7 +53,7 @@ public class DeleteActive implements RestModifyView<AccountResource, Input> {
@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");
}

View File

@ -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();
}