Merge branch 'stable-3.1'
* stable-3.1:
Upgrade bazlets to latest stable-2.16
Change-Id: I4c1eb4879dc7a8c9c5ec7e0c2d4c4da4b2e4bfcb
diff --git a/WORKSPACE b/WORKSPACE
index 6116a16..8707608 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,7 +3,7 @@
load("//:bazlets.bzl", "load_bazlets")
load_bazlets(
- commit = "b6cb89690a5e06261932eb30c95fd8db34a7943a",
+ commit = "74f9d8e76d5014d218ae6fe55127a5288c9a32c3",
#local_path = "/home/<user>/projects/bazlets",
)
diff --git a/src/main/java/com/googlesource/gerrit/plugins/serviceuser/PutOwner.java b/src/main/java/com/googlesource/gerrit/plugins/serviceuser/PutOwner.java
index 78bc448..fd8bbbf 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/serviceuser/PutOwner.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/serviceuser/PutOwner.java
@@ -22,6 +22,7 @@
import com.google.common.base.Strings;
import com.google.gerrit.common.data.GroupDescription;
import com.google.gerrit.entities.AccountGroup;
+import com.google.gerrit.entities.AccountGroup.UUID;
import com.google.gerrit.entities.Project;
import com.google.gerrit.extensions.annotations.PluginName;
import com.google.gerrit.extensions.common.GroupInfo;
@@ -109,10 +110,11 @@
db.unset(USER, rsrc.getUser().getUserName().get(), KEY_OWNER);
} else {
group = groups.parse(TopLevelResource.INSTANCE, IdString.fromDecoded(input.group)).getGroup();
- if (!AccountGroup.isInternalGroup(group.getGroupUUID())) {
- throw new MethodNotAllowedException();
+ UUID groupUUID = group.getGroupUUID();
+ if (!AccountGroup.uuid(groupUUID.get()).isInternalGroup()) {
+ throw new MethodNotAllowedException("Group with UUID '" + groupUUID + "' is external");
}
- db.setString(USER, rsrc.getUser().getUserName().get(), KEY_OWNER, group.getGroupUUID().get());
+ db.setString(USER, rsrc.getUser().getUserName().get(), KEY_OWNER, groupUUID.get());
}
MetaDataUpdate md = metaDataUpdateFactory.create(allProjects);
md.setMessage("Set owner for service user '" + rsrc.getUser().getUserName() + "'\n");