* 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:
parent
c4e0f717e7
commit
68bca621cd
7 changed files with 26 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue