Merge branch 'stable-3.1' into stable-3.2
* stable-3.1:
Bump Bazel version to 3.5.0
Change-Id: Ifa61dd0510a3a3b1c6c8106c768bd7bf4f28110c
diff --git a/WORKSPACE b/WORKSPACE
index f836343..880def2 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,7 +3,7 @@
load("//:bazlets.bzl", "load_bazlets")
load_bazlets(
- commit = "3f9dadc615dc4053369a42d9ada37dafd8d4763c",
+ commit = "0f81174e3d1b892a1342ebc75bb4bbb158ae0efe",
#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");