-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwrapper.go
52 lines (43 loc) · 2.07 KB
/
wrapper.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
package ldapx
import "github.com/go-ldap/ldap/v3"
// NewModifyRequest creates a new ModifyRequest with the given DN and controls.
func NewModifyRequest(dn string, controls []ldap.Control) *ldap.ModifyRequest {
return ldap.NewModifyRequest(dn, controls)
}
// NewPasswordModifyRequest creates a new PasswordModifyRequest with the given user identity, old password and new password.
func NewPasswordModifyRequest(userIdentity string, oldPassword string, newPassword string) *ldap.PasswordModifyRequest {
return ldap.NewPasswordModifyRequest(userIdentity, oldPassword, newPassword)
}
// NewSearchRequest creates a new SearchRequest with the given base DN, scope,
// derefAliases, sizeLimit, timeLimit, typesOnly, filter, attributes and
// controls.
func NewSearchRequest(
baseDN string,
scope, derefAliases, sizeLimit, timeLimit int,
typesOnly bool,
filter string,
attributes []string,
controls []ldap.Control,
) *ldap.SearchRequest {
return ldap.NewSearchRequest(baseDN, scope, derefAliases, sizeLimit, timeLimit, typesOnly, filter, attributes, controls)
}
// NewAddRequest creates a new AddRequest with the given DN and controls.
func NewAddRequest(dn string, controls []ldap.Control) *ldap.AddRequest {
return ldap.NewAddRequest(dn, controls)
}
// NewDelRequest creates a new DelRequest with the given DN and controls.
func NewDelRequest(dn string, controls []ldap.Control) *ldap.DelRequest {
return ldap.NewDelRequest(dn, controls)
}
// NewControlBeheraPasswordPolicy creates a new Behera password policy control.
func NewControlBeheraPasswordPolicy() *ldap.ControlBeheraPasswordPolicy {
return ldap.NewControlBeheraPasswordPolicy()
}
// NewControlPaging creates a new paging control with the given paging size.
func NewControlPaging(pagingSize uint32) *ldap.ControlPaging {
return ldap.NewControlPaging(pagingSize)
}
// NewControlString creates a new ControlString with the given control type, criticality and control value.
func NewControlString(controlType string, criticality bool, controlValue string) *ldap.ControlString {
return ldap.NewControlString(controlType, criticality, controlValue)
}