Account REST API: adjust the deletable condition of external ids
Set the 'canDelete' field of external ids to be true if the external id for the last login is null. This is different from the old remote JSON service implementation, but it seems reasonable because an external id should be deletable if the external id is not a 'SCHEME_USERNAME' and it's not used to login. And this change will make it much easier for us to test the get/delete external ids REST API. Change-Id: I0ab347bddf782b20a3be1826279df5a1ba88c5df
This commit is contained in:
@@ -16,6 +16,8 @@ package com.google.gerrit.extensions.common;
|
||||
|
||||
import com.google.common.collect.ComparisonChain;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class AccountExternalIdInfo
|
||||
implements Comparable<AccountExternalIdInfo> {
|
||||
public String identity;
|
||||
@@ -30,4 +32,16 @@ public class AccountExternalIdInfo
|
||||
.compare(a.emailAddress, emailAddress)
|
||||
.result();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o instanceof AccountExternalIdInfo) {
|
||||
AccountExternalIdInfo a = (AccountExternalIdInfo) o;
|
||||
return (Objects.equals(a.identity, identity))
|
||||
&& (Objects.equals(a.emailAddress, emailAddress))
|
||||
&& (Objects.equals(a.trusted, trusted))
|
||||
&& (Objects.equals(a.canDelete, canDelete));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user