diff options
Diffstat (limited to 'routers/admin')
-rw-r--r-- | routers/admin/admin.go | 4 | ||||
-rw-r--r-- | routers/admin/auths.go | 11 |
2 files changed, 11 insertions, 4 deletions
diff --git a/routers/admin/admin.go b/routers/admin/admin.go index 6b5b33f734..8ae4504847 100644 --- a/routers/admin/admin.go +++ b/routers/admin/admin.go @@ -121,6 +121,7 @@ const ( syncSSHAuthorizedKey syncRepositoryUpdateHook reinitMissingRepository + syncExternalUsers ) // Dashboard show admin panel dashboard @@ -157,6 +158,9 @@ func Dashboard(ctx *context.Context) { case reinitMissingRepository: success = ctx.Tr("admin.dashboard.reinit_missing_repos_success") err = models.ReinitMissingRepositories() + case syncExternalUsers: + success = ctx.Tr("admin.dashboard.sync_external_users_started") + go models.SyncExternalUsers() } if err != nil { diff --git a/routers/admin/auths.go b/routers/admin/auths.go index eb7c7e8e93..590e45a4f4 100644 --- a/routers/admin/auths.go +++ b/routers/admin/auths.go @@ -74,6 +74,7 @@ func NewAuthSource(ctx *context.Context) { ctx.Data["CurrentSecurityProtocol"] = models.SecurityProtocolNames[ldap.SecurityProtocolUnencrypted] ctx.Data["smtp_auth"] = "PLAIN" ctx.Data["is_active"] = true + ctx.Data["is_sync_enabled"] = true ctx.Data["AuthSources"] = authSources ctx.Data["SecurityProtocols"] = securityProtocols ctx.Data["SMTPAuths"] = models.SMTPAuths @@ -186,10 +187,11 @@ func NewAuthSourcePost(ctx *context.Context, form auth.AuthenticationForm) { } if err := models.CreateLoginSource(&models.LoginSource{ - Type: models.LoginType(form.Type), - Name: form.Name, - IsActived: form.IsActive, - Cfg: config, + Type: models.LoginType(form.Type), + Name: form.Name, + IsActived: form.IsActive, + IsSyncEnabled: form.IsSyncEnabled, + Cfg: config, }); err != nil { if models.IsErrLoginSourceAlreadyExist(err) { ctx.Data["Err_Name"] = true @@ -273,6 +275,7 @@ func EditAuthSourcePost(ctx *context.Context, form auth.AuthenticationForm) { source.Name = form.Name source.IsActived = form.IsActive + source.IsSyncEnabled = form.IsSyncEnabled source.Cfg = config if err := models.UpdateSource(source); err != nil { if models.IsErrOpenIDConnectInitialize(err) { |