outposts: initial ldap outpost implementation
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
20
outpost/pkg/ldap/utils.go
Normal file
20
outpost/pkg/ldap/utils.go
Normal file
@ -0,0 +1,20 @@
|
||||
package ldap
|
||||
|
||||
import (
|
||||
"github.com/nmcclain/ldap"
|
||||
)
|
||||
|
||||
func AKAttrsToLDAP(attrs interface{}) []*ldap.EntryAttribute {
|
||||
attrList := []*ldap.EntryAttribute{}
|
||||
for attrKey, attrValue := range attrs.(map[string]interface{}) {
|
||||
entry := &ldap.EntryAttribute{Name: attrKey}
|
||||
switch attrValue.(type) {
|
||||
case []string:
|
||||
entry.Values = attrValue.([]string)
|
||||
case string:
|
||||
entry.Values = []string{attrValue.(string)}
|
||||
}
|
||||
attrList = append(attrList, entry)
|
||||
}
|
||||
return attrList
|
||||
}
|
Reference in New Issue
Block a user