1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-18 16:28:36 +00:00

Prevent empty LDAP search from deactivating all users (#9879) (#9890)

* Backport of #9879 (Add option to prevent LDAP from deactivating everything on empty search)

* go fmtted

Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
dioss-Machiel
2020-01-20 21:02:35 +01:00
committed by techknowlogick
parent c4e0f717e7
commit 68bca621cd
7 changed files with 26 additions and 0 deletions

View File

@@ -1715,6 +1715,15 @@ func SyncExternalUsers() {
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 {
if len(su.Username) == 0 {
continue