guichet/utils-ldap.go

18 lines
370 B
Go
Raw Normal View History

2023-07-26 06:31:43 +00:00
/*
Utilities related to LDAP
*/
package main
import (
"github.com/go-ldap/ldap/v3"
)
func replaceIfContent(modifReq *ldap.ModifyRequest, key string, value string, previousValue string) error {
if value != "" {
modifReq.Replace(key, []string{value})
} else if previousValue != "" {
modifReq.Delete(key, []string{previousValue})
}
return nil
}