ExternalUser: Allow specifying a PropertyMap
PropertyMap is a concept of CurrentUser to store or cache per-user state. This state is immutable for the lifetime of the object. With this commit, we allow specifying this state for ExternalUser. Change-Id: I41fc3d148d3cf3a0870f1bde1de5dd37ae0ebea5
This commit is contained in:
@@ -38,7 +38,9 @@ public class ExternalUser extends CurrentUser {
|
|||||||
|
|
||||||
public interface Factory {
|
public interface Factory {
|
||||||
ExternalUser create(
|
ExternalUser create(
|
||||||
Collection<String> emailAddresses, Collection<ExternalId.Key> externalIdKeys);
|
Collection<String> emailAddresses,
|
||||||
|
Collection<ExternalId.Key> externalIdKeys,
|
||||||
|
PropertyMap propertyMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final GroupBackend groupBackend;
|
private final GroupBackend groupBackend;
|
||||||
@@ -51,7 +53,9 @@ public class ExternalUser extends CurrentUser {
|
|||||||
public ExternalUser(
|
public ExternalUser(
|
||||||
GroupBackend groupBackend,
|
GroupBackend groupBackend,
|
||||||
@Assisted Collection<String> emailAddresses,
|
@Assisted Collection<String> emailAddresses,
|
||||||
@Assisted Collection<ExternalId.Key> externalIdKeys) {
|
@Assisted Collection<ExternalId.Key> externalIdKeys,
|
||||||
|
@Assisted PropertyMap propertyMap) {
|
||||||
|
super(propertyMap);
|
||||||
this.groupBackend = groupBackend;
|
this.groupBackend = groupBackend;
|
||||||
this.emailAddresses = ImmutableSet.copyOf(emailAddresses);
|
this.emailAddresses = ImmutableSet.copyOf(emailAddresses);
|
||||||
this.externalIdKeys = ImmutableSet.copyOf(externalIdKeys);
|
this.externalIdKeys = ImmutableSet.copyOf(externalIdKeys);
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import com.google.gerrit.extensions.registration.DynamicSet;
|
|||||||
import com.google.gerrit.extensions.restapi.AuthException;
|
import com.google.gerrit.extensions.restapi.AuthException;
|
||||||
import com.google.gerrit.server.CurrentUser;
|
import com.google.gerrit.server.CurrentUser;
|
||||||
import com.google.gerrit.server.ExternalUser;
|
import com.google.gerrit.server.ExternalUser;
|
||||||
|
import com.google.gerrit.server.PropertyMap;
|
||||||
import com.google.gerrit.server.account.GroupBackend;
|
import com.google.gerrit.server.account.GroupBackend;
|
||||||
import com.google.gerrit.server.account.GroupMembership;
|
import com.google.gerrit.server.account.GroupMembership;
|
||||||
import com.google.gerrit.server.account.externalids.ExternalId;
|
import com.google.gerrit.server.account.externalids.ExternalId;
|
||||||
@@ -294,6 +295,7 @@ public class ExternalUserPermissionIT extends AbstractDaemonTest {
|
|||||||
ExternalUser createUserInGroup(String userId, String groupId) {
|
ExternalUser createUserInGroup(String userId, String groupId) {
|
||||||
return externalUserFactory.create(
|
return externalUserFactory.create(
|
||||||
ImmutableSet.of(),
|
ImmutableSet.of(),
|
||||||
ImmutableSet.of(ExternalId.Key.parse("company-auth:" + groupId + "-" + userId)));
|
ImmutableSet.of(ExternalId.Key.parse("company-auth:" + groupId + "-" + userId)),
|
||||||
|
PropertyMap.EMPTY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user