add memberOf attribute to users,
bump version to 1.0.1
This commit is contained in:
parent
bb574e4e2a
commit
435431fd62
@ -15,7 +15,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var LDAPSessions map[string]*LDAPClient
|
var LDAPSessions map[string]*LDAPClient
|
||||||
var APIVersion = "1.0.0"
|
var APIVersion = "1.0.1"
|
||||||
|
|
||||||
func Run() {
|
func Run() {
|
||||||
gob.Register(LDAPClient{})
|
gob.Register(LDAPClient{})
|
||||||
|
26
app/ldap.go
26
app/ldap.go
@ -34,8 +34,8 @@ func (l LDAPClient) GetAllUsers() (int, gin.H) {
|
|||||||
searchRequest := ldap.NewSearchRequest(
|
searchRequest := ldap.NewSearchRequest(
|
||||||
l.peopledn, // The base dn to search
|
l.peopledn, // The base dn to search
|
||||||
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
|
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
|
||||||
"(&(objectClass=inetOrgPerson))", // The filter to apply
|
"(&(objectClass=inetOrgPerson))", // The filter to apply
|
||||||
[]string{"dn", "cn", "sn", "mail", "uid"}, // A list attributes to retrieve
|
[]string{"dn", "cn", "sn", "mail", "uid", "memberOf"}, // A list attributes to retrieve
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -53,10 +53,11 @@ func (l LDAPClient) GetAllUsers() (int, gin.H) {
|
|||||||
results = append(results, gin.H{
|
results = append(results, gin.H{
|
||||||
"dn": entry.DN,
|
"dn": entry.DN,
|
||||||
"attributes": gin.H{
|
"attributes": gin.H{
|
||||||
"cn": entry.GetAttributeValue("cn"),
|
"cn": entry.GetAttributeValue("cn"),
|
||||||
"sn": entry.GetAttributeValue("sn"),
|
"sn": entry.GetAttributeValue("sn"),
|
||||||
"mail": entry.GetAttributeValue("mail"),
|
"mail": entry.GetAttributeValue("mail"),
|
||||||
"uid": entry.GetAttributeValue("uid"),
|
"uid": entry.GetAttributeValue("uid"),
|
||||||
|
"memberOf": entry.GetAttributeValues("memberOf"),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -103,8 +104,8 @@ func (l LDAPClient) GetUser(uid string) (int, gin.H) {
|
|||||||
searchRequest := ldap.NewSearchRequest( // setup search for user by uid
|
searchRequest := ldap.NewSearchRequest( // setup search for user by uid
|
||||||
fmt.Sprintf("uid=%s,%s", uid, l.peopledn), // The base dn to search
|
fmt.Sprintf("uid=%s,%s", uid, l.peopledn), // The base dn to search
|
||||||
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
|
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
|
||||||
"(&(objectClass=inetOrgPerson))", // The filter to apply
|
"(&(objectClass=inetOrgPerson))", // The filter to apply
|
||||||
[]string{"dn", "cn", "sn", "mail", "uid"}, // A list attributes to retrieve
|
[]string{"dn", "cn", "sn", "mail", "uid", "memberOf"}, // A list attributes to retrieve
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -120,10 +121,11 @@ func (l LDAPClient) GetUser(uid string) (int, gin.H) {
|
|||||||
result := gin.H{
|
result := gin.H{
|
||||||
"dn": entry.DN,
|
"dn": entry.DN,
|
||||||
"attributes": gin.H{
|
"attributes": gin.H{
|
||||||
"cn": entry.GetAttributeValue("cn"),
|
"cn": entry.GetAttributeValue("cn"),
|
||||||
"sn": entry.GetAttributeValue("sn"),
|
"sn": entry.GetAttributeValue("sn"),
|
||||||
"mail": entry.GetAttributeValue("mail"),
|
"mail": entry.GetAttributeValue("mail"),
|
||||||
"uid": entry.GetAttributeValue("uid"),
|
"uid": entry.GetAttributeValue("uid"),
|
||||||
|
"memberOf": entry.GetAttributeValues("memberOf"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user