LDAP user synchronization (#1478)
This commit is contained in:
parent
fd76f090a2
commit
524885dd65
15 changed files with 356 additions and 52 deletions
|
@ -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 {
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue