Merge "Make it configurable whether the first user should become admin"
This commit is contained in:
@@ -970,10 +970,10 @@ Default is the number of CPUs.
|
|||||||
[[capability.administrateServer]]capability.administrateServer::
|
[[capability.administrateServer]]capability.administrateServer::
|
||||||
+
|
+
|
||||||
Names of groups of users that are allowed to exercise the
|
Names of groups of users that are allowed to exercise the
|
||||||
administrateServer capability, in addition to those listed in
|
`administrateServer` capability, in addition to those listed in
|
||||||
All-Projects. Configuring this option can be a useful fail-safe
|
All-Projects. Configuring this option can be a useful fail-safe
|
||||||
to recover a server in the event an administrator removed all
|
to recover a server in the event an administrator removed all
|
||||||
groups from the administrateServer capability, or to ensure that
|
groups from the `administrateServer` capability, or to ensure that
|
||||||
specific groups always have administration capabilities.
|
specific groups always have administration capabilities.
|
||||||
+
|
+
|
||||||
----
|
----
|
||||||
@@ -987,7 +987,16 @@ name. If a group cannot be found for the configured name a warning
|
|||||||
is logged and the server will continue normal startup.
|
is logged and the server will continue normal startup.
|
||||||
+
|
+
|
||||||
If not specified (default), only the groups listed by All-Projects
|
If not specified (default), only the groups listed by All-Projects
|
||||||
may use the administrateServer capability.
|
may use the `administrateServer` capability.
|
||||||
|
|
||||||
|
[[capability.makeFirstUserAdmin]]capability.makeFirstUserAdmin::
|
||||||
|
+
|
||||||
|
Whether the first user that logs in to the Gerrit server should
|
||||||
|
automatically be added to the administrator group and hence get the
|
||||||
|
`administrateServer` capability assigned. This is useful to bootstrap
|
||||||
|
the authentication database.
|
||||||
|
+
|
||||||
|
Default is true.
|
||||||
|
|
||||||
|
|
||||||
[[change]]
|
[[change]]
|
||||||
|
@@ -30,6 +30,7 @@ import com.google.gerrit.server.IdentifiedUser;
|
|||||||
import com.google.gerrit.server.account.externalids.ExternalId;
|
import com.google.gerrit.server.account.externalids.ExternalId;
|
||||||
import com.google.gerrit.server.account.externalids.ExternalIds;
|
import com.google.gerrit.server.account.externalids.ExternalIds;
|
||||||
import com.google.gerrit.server.account.externalids.ExternalIdsUpdate;
|
import com.google.gerrit.server.account.externalids.ExternalIdsUpdate;
|
||||||
|
import com.google.gerrit.server.config.GerritServerConfig;
|
||||||
import com.google.gerrit.server.project.ProjectCache;
|
import com.google.gerrit.server.project.ProjectCache;
|
||||||
import com.google.gerrit.server.query.account.InternalAccountQuery;
|
import com.google.gerrit.server.query.account.InternalAccountQuery;
|
||||||
import com.google.gwtorm.server.OrmException;
|
import com.google.gwtorm.server.OrmException;
|
||||||
@@ -43,6 +44,7 @@ import java.util.Collections;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import org.eclipse.jgit.errors.ConfigInvalidException;
|
import org.eclipse.jgit.errors.ConfigInvalidException;
|
||||||
|
import org.eclipse.jgit.lib.Config;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -69,6 +71,7 @@ public class AccountManager {
|
|||||||
@Inject
|
@Inject
|
||||||
AccountManager(
|
AccountManager(
|
||||||
SchemaFactory<ReviewDb> schema,
|
SchemaFactory<ReviewDb> schema,
|
||||||
|
@GerritServerConfig Config cfg,
|
||||||
Accounts accounts,
|
Accounts accounts,
|
||||||
AccountsUpdate.Server accountsUpdateFactory,
|
AccountsUpdate.Server accountsUpdateFactory,
|
||||||
AccountCache byIdCache,
|
AccountCache byIdCache,
|
||||||
@@ -90,7 +93,8 @@ public class AccountManager {
|
|||||||
this.userFactory = userFactory;
|
this.userFactory = userFactory;
|
||||||
this.changeUserNameFactory = changeUserNameFactory;
|
this.changeUserNameFactory = changeUserNameFactory;
|
||||||
this.projectCache = projectCache;
|
this.projectCache = projectCache;
|
||||||
this.awaitsFirstAccountCheck = new AtomicBoolean(true);
|
this.awaitsFirstAccountCheck =
|
||||||
|
new AtomicBoolean(cfg.getBoolean("capability", "makeFirstUserAdmin", true));
|
||||||
this.auditService = auditService;
|
this.auditService = auditService;
|
||||||
this.accountQueryProvider = accountQueryProvider;
|
this.accountQueryProvider = accountQueryProvider;
|
||||||
this.externalIds = externalIds;
|
this.externalIds = externalIds;
|
||||||
|
Reference in New Issue
Block a user