-
Notifications
You must be signed in to change notification settings - Fork 3
/
poolWrapper.go
73 lines (64 loc) · 1.62 KB
/
poolWrapper.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package organization
import (
"github.com/doloresteam/organization/ldap-pool"
ldap "gopkg.in/ldap.v2"
)
func (org *Organization) poolConn() (*ldappool.PoolConn, error) {
return org.pool.Get()
}
// Add ...
func (org *Organization) Add(addRequest *ldap.AddRequest) error {
c, err := org.poolConn()
if err != nil {
return err
}
return c.Add(addRequest)
}
// Del ...
func (org *Organization) Del(delRequest *ldap.DelRequest) error {
c, err := org.poolConn()
if err != nil {
return err
}
return c.Del(delRequest)
}
// Modify ...
func (org *Organization) Modify(modifyRequest *ldap.ModifyRequest) error {
c, err := org.poolConn()
if err != nil {
return err
}
return c.Modify(modifyRequest)
}
// Compare ...
func (org *Organization) Compare(dn, attribute, value string) (bool, error) {
c, err := org.poolConn()
if err != nil {
return false, err
}
return c.Compare(dn, attribute, value)
}
// PasswordModify ...
func (org *Organization) PasswordModify(passwordModifyRequest *ldap.PasswordModifyRequest) (*ldap.PasswordModifyResult, error) {
c, err := org.poolConn()
if err != nil {
return nil, err
}
return c.PasswordModify(passwordModifyRequest)
}
// Search ...
func (org *Organization) Search(searchRequest *ldap.SearchRequest) (*ldap.SearchResult, error) {
c, err := org.poolConn()
if err != nil {
return nil, err
}
return c.Search(searchRequest)
}
// SearchWithPaging ...
func (org *Organization) SearchWithPaging(searchRequest *ldap.SearchRequest, pagingSize uint32) (*ldap.SearchResult, error) {
c, err := org.poolConn()
if err != nil {
return nil, err
}
return c.SearchWithPaging(searchRequest, pagingSize)
}