aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/admin_auth_ldap.go
diff options
context:
space:
mode:
authorSteven Kriegler <61625851+justusbunsi@users.noreply.github.com>2022-07-04 11:21:14 +0200
committerGitHub <noreply@github.com>2022-07-04 11:21:14 +0200
commit33f6f91008f2219e94e8d909539b38a590554122 (patch)
treec9999a53ac1cc11fb9679ab7e604ab5e33b892d8 /cmd/admin_auth_ldap.go
parentf9b172db65b9a60da86ffee66d9a58853486b1ff (diff)
downloadgitea-33f6f91008f2219e94e8d909539b38a590554122.tar.gz
gitea-33f6f91008f2219e94e8d909539b38a590554122.zip
Allow enable LDAP source and disable user sync via CLI (#20206)
The current `admin auth` CLI for managing authentication source of type LDAP via BindDN and Simple LDAP does not allow enabling the respective source, once disabled via `--not-active`. The same applies to `--synchronize-users` specifially for LDAP via BindDN. These changes add two new flags to LDAP related CLI commands: - `--active` for both LDAP authentication source types - `--disable-synchronize-users` for LDAP via BindDN Signed-off-by: justusbunsi <61625851+justusbunsi@users.noreply.github.com>
Diffstat (limited to 'cmd/admin_auth_ldap.go')
-rw-r--r--cmd/admin_auth_ldap.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/cmd/admin_auth_ldap.go b/cmd/admin_auth_ldap.go
index ec86b2c671..9040def822 100644
--- a/cmd/admin_auth_ldap.go
+++ b/cmd/admin_auth_ldap.go
@@ -34,6 +34,10 @@ var (
Name: "not-active",
Usage: "Deactivate the authentication source.",
},
+ cli.BoolFlag{
+ Name: "active",
+ Usage: "Activate the authentication source.",
+ },
cli.StringFlag{
Name: "security-protocol",
Usage: "Security protocol name.",
@@ -117,6 +121,10 @@ var (
Name: "synchronize-users",
Usage: "Enable user synchronization.",
},
+ cli.BoolFlag{
+ Name: "disable-synchronize-users",
+ Usage: "Disable user synchronization.",
+ },
cli.UintFlag{
Name: "page-size",
Usage: "Search page size.",
@@ -183,9 +191,15 @@ func parseAuthSource(c *cli.Context, authSource *auth.Source) {
if c.IsSet("not-active") {
authSource.IsActive = !c.Bool("not-active")
}
+ if c.IsSet("active") {
+ authSource.IsActive = c.Bool("active")
+ }
if c.IsSet("synchronize-users") {
authSource.IsSyncEnabled = c.Bool("synchronize-users")
}
+ if c.IsSet("disable-synchronize-users") {
+ authSource.IsSyncEnabled = !c.Bool("disable-synchronize-users")
+ }
}
// parseLdapConfig assigns values on config according to command line flags.