1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-19 16:58:37 +00:00

Add option to prevent LDAP from deactivating everything on empty search (#9879) (#9896)

* Add option to prevent LDAP from deactivating everything on empty search

* Update options/locale/locale_en-US.ini

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
zeripath
2020-01-20 19:18:23 +00:00
committed by Lauris BH
parent f96c1a2c79
commit ff508c9c9b
7 changed files with 26 additions and 0 deletions

View File

@@ -1760,6 +1760,15 @@ func SyncExternalUsers(ctx context.Context) {
continue
}
if len(sr) == 0 {
if !s.LDAP().AllowDeactivateAll {
log.Error("LDAP search found no entries but did not report an error. Refusing to deactivate all users")
continue
} else {
log.Warn("LDAP search found no entries but did not report an error. All users will be deactivated as per settings")
}
}
for _, su := range sr {
select {
case <-ctx.Done():