new oclib
This commit is contained in:
2
go.mod
2
go.mod
@@ -5,7 +5,7 @@ go 1.23.0
|
||||
toolchain go1.23.3
|
||||
|
||||
require (
|
||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260123090329-6b12aa1713c7
|
||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260126093615-bc94f2b188e6
|
||||
github.com/beego/beego/v2 v2.3.1
|
||||
github.com/smartystreets/goconvey v1.7.2
|
||||
go.uber.org/zap v1.27.0
|
||||
|
||||
2
go.sum
2
go.sum
@@ -14,6 +14,8 @@ cloud.o-forge.io/core/oc-lib v0.0.0-20260122131802-b98728675928 h1:/JATUIWRD632N
|
||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260122131802-b98728675928/go.mod h1:vHWauJsS6ryf7UDqq8hRXoYD5RsONxcFTxeZPOztEuI=
|
||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260123090329-6b12aa1713c7 h1:iLv9e3sPvEb0O/DyKYYZBVNAMEgOX4ioOOzZgYIwvxc=
|
||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260123090329-6b12aa1713c7/go.mod h1:vHWauJsS6ryf7UDqq8hRXoYD5RsONxcFTxeZPOztEuI=
|
||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260126093615-bc94f2b188e6 h1:Sxjq1lQwSl+gkUYag4wAb6j74uU/JZviw1hkFavt58o=
|
||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260126093615-bc94f2b188e6/go.mod h1:vHWauJsS6ryf7UDqq8hRXoYD5RsONxcFTxeZPOztEuI=
|
||||
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 h1:mFRzDkZVAjdal+s7s0MwaRv9igoPqLRdzOLzw/8Xvq8=
|
||||
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
|
||||
@@ -468,6 +468,7 @@ func (c *ldapConn) SearchRoles(attrs ...string) ([]map[string][]string, error) {
|
||||
|
||||
// searchEntries executes a LDAP query, and returns a result as entries where each entry is mapping of LDAP attributes.
|
||||
func (c *ldapConn) searchEntries(baseDN, query string, attrs []string) ([]map[string][]string, error) {
|
||||
fmt.Println(baseDN, query, attrs)
|
||||
req := ldap.NewSearchRequest(baseDN, ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, query, attrs, nil)
|
||||
res, err := c.Search(req)
|
||||
if err != nil {
|
||||
@@ -476,7 +477,7 @@ func (c *ldapConn) searchEntries(baseDN, query string, attrs []string) ([]map[st
|
||||
|
||||
var entries []map[string][]string
|
||||
for _, v := range res.Entries {
|
||||
entry := map[string][]string{"dn": []string{v.DN}}
|
||||
entry := map[string][]string{"dn": {v.DN}}
|
||||
for _, attr := range v.Attributes {
|
||||
// We need the first value only for the named attribute.
|
||||
entry[attr.Name] = attr.Values
|
||||
|
||||
Reference in New Issue
Block a user