Adapt to changes in Gerrit core
Change-Id: I3ed73ae011e821d0e4cbe1a6d7b8c8600ddd4ca9
diff --git a/src/main/java/com/googlesource/gerrit/plugins/singleusergroup/SingleUserGroup.java b/src/main/java/com/googlesource/gerrit/plugins/singleusergroup/SingleUserGroup.java
index c354f3e..18eadf1 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/singleusergroup/SingleUserGroup.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/singleusergroup/SingleUserGroup.java
@@ -28,6 +28,7 @@
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.registration.DynamicSet;
import com.google.gerrit.index.query.QueryParseException;
+import com.google.gerrit.server.CurrentUser;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.account.AbstractGroupBackend;
import com.google.gerrit.server.account.AccountCache;
@@ -91,7 +92,10 @@
}
@Override
- public GroupMembership membershipsOf(IdentifiedUser user) {
+ public GroupMembership membershipsOf(CurrentUser user) {
+ if (!user.isIdentifiedUser()) {
+ return GroupMembership.EMPTY;
+ }
ImmutableList.Builder<AccountGroup.UUID> groups = ImmutableList.builder();
groups.add(uuid(user.getAccountId()));
if (user.getUserName().isPresent()) {