Merge branch 'stable-2.16'
* stable-2.16: Set version to 2.16.2 Fix case-insensitive searching of hashtags Add new maintainer Han-Wen Nienhuys as developer in pom.xml files ListBranchesIT: Make assertions on received refs more strict Set version to 2.14.18-SNAPSHOT Upgrade jackson-core to 2.9.8 Upgrade testcontainers to 1.10.3 ElasticContainer: Use version 5.6.14 for V5_6 tests ldap: allow to disable the groups relevance filtering Revert "Allow to enable git protocol version 2 for upload pack" Update rules_go to 0.16.0 RefInfo: Add implementation of toString Change-Id: Ifea0498b29e2197699865724e694c075250b545c
This commit is contained in:
@@ -34,6 +34,7 @@ import com.google.gerrit.server.account.GroupBackend;
|
||||
import com.google.gerrit.server.account.GroupMembership;
|
||||
import com.google.gerrit.server.account.externalids.ExternalId;
|
||||
import com.google.gerrit.server.auth.ldap.Helper.LdapSchema;
|
||||
import com.google.gerrit.server.config.GerritServerConfig;
|
||||
import com.google.gerrit.server.project.ProjectCache;
|
||||
import com.google.gerrit.server.project.ProjectState;
|
||||
import com.google.inject.Inject;
|
||||
@@ -52,6 +53,7 @@ import javax.naming.directory.DirContext;
|
||||
import javax.naming.ldap.LdapName;
|
||||
import javax.naming.ldap.Rdn;
|
||||
import javax.security.auth.login.LoginException;
|
||||
import org.eclipse.jgit.lib.Config;
|
||||
|
||||
/** Implementation of GroupBackend for the LDAP group system. */
|
||||
public class LdapGroupBackend implements GroupBackend {
|
||||
@@ -65,6 +67,7 @@ public class LdapGroupBackend implements GroupBackend {
|
||||
private final LoadingCache<String, Boolean> existsCache;
|
||||
private final ProjectCache projectCache;
|
||||
private final Provider<CurrentUser> userProvider;
|
||||
private final Config gerritConfig;
|
||||
|
||||
@Inject
|
||||
LdapGroupBackend(
|
||||
@@ -72,12 +75,14 @@ public class LdapGroupBackend implements GroupBackend {
|
||||
@Named(GROUP_CACHE) LoadingCache<String, Set<AccountGroup.UUID>> membershipCache,
|
||||
@Named(GROUP_EXIST_CACHE) LoadingCache<String, Boolean> existsCache,
|
||||
ProjectCache projectCache,
|
||||
Provider<CurrentUser> userProvider) {
|
||||
Provider<CurrentUser> userProvider,
|
||||
@GerritServerConfig Config gerritConfig) {
|
||||
this.helper = helper;
|
||||
this.membershipCache = membershipCache;
|
||||
this.projectCache = projectCache;
|
||||
this.existsCache = existsCache;
|
||||
this.userProvider = userProvider;
|
||||
this.gerritConfig = gerritConfig;
|
||||
}
|
||||
|
||||
private boolean isLdapUUID(AccountGroup.UUID uuid) {
|
||||
@@ -178,7 +183,7 @@ public class LdapGroupBackend implements GroupBackend {
|
||||
if (id == null) {
|
||||
return GroupMembership.EMPTY;
|
||||
}
|
||||
return new LdapGroupMembership(membershipCache, projectCache, id);
|
||||
return new LdapGroupMembership(membershipCache, projectCache, id, gerritConfig);
|
||||
}
|
||||
|
||||
private static String findId(Collection<ExternalId> extIds) {
|
||||
|
||||
@@ -22,20 +22,24 @@ import com.google.gerrit.server.project.ProjectCache;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import org.eclipse.jgit.lib.Config;
|
||||
|
||||
class LdapGroupMembership implements GroupMembership {
|
||||
private final LoadingCache<String, Set<AccountGroup.UUID>> membershipCache;
|
||||
private final ProjectCache projectCache;
|
||||
private final String id;
|
||||
private final boolean guessRelevantGroups;
|
||||
private GroupMembership membership;
|
||||
|
||||
LdapGroupMembership(
|
||||
LoadingCache<String, Set<AccountGroup.UUID>> membershipCache,
|
||||
ProjectCache projectCache,
|
||||
String id) {
|
||||
String id,
|
||||
Config gerritConfig) {
|
||||
this.membershipCache = membershipCache;
|
||||
this.projectCache = projectCache;
|
||||
this.id = id;
|
||||
this.guessRelevantGroups = gerritConfig.getBoolean("ldap", "guessRelevantGroups", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -56,7 +60,9 @@ class LdapGroupMembership implements GroupMembership {
|
||||
@Override
|
||||
public Set<AccountGroup.UUID> getKnownGroups() {
|
||||
Set<AccountGroup.UUID> g = new HashSet<>(get().getKnownGroups());
|
||||
g.retainAll(projectCache.guessRelevantGroupUUIDs());
|
||||
if (guessRelevantGroups) {
|
||||
g.retainAll(projectCache.guessRelevantGroupUUIDs());
|
||||
}
|
||||
return g;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ public class TransferConfig {
|
||||
private final long maxObjectSizeLimit;
|
||||
private final String maxObjectSizeLimitFormatted;
|
||||
private final boolean inheritProjectMaxObjectSizeLimit;
|
||||
private final boolean enableProtocolV2;
|
||||
|
||||
@Inject
|
||||
TransferConfig(@GerritServerConfig Config cfg) {
|
||||
@@ -46,7 +45,6 @@ public class TransferConfig {
|
||||
maxObjectSizeLimitFormatted = cfg.getString("receive", null, "maxObjectSizeLimit");
|
||||
inheritProjectMaxObjectSizeLimit =
|
||||
cfg.getBoolean("receive", "inheritProjectMaxObjectSizeLimit", false);
|
||||
enableProtocolV2 = cfg.getBoolean("receive", "enableProtocolV2", false);
|
||||
|
||||
packConfig = new PackConfig();
|
||||
packConfig.setDeltaCompress(false);
|
||||
@@ -74,8 +72,4 @@ public class TransferConfig {
|
||||
public boolean inheritProjectMaxObjectSizeLimit() {
|
||||
return inheritProjectMaxObjectSizeLimit;
|
||||
}
|
||||
|
||||
public boolean enableProtocolV2() {
|
||||
return enableProtocolV2;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user