Documentation
¶
Overview ¶
Copyright 2020-2024 NGR Softlab
Copyright 2020-2024 NGR Softlab ¶
Copyright 2020-2024 NGR Softlab
Index ¶
- Constants
- Variables
- func TestBaseDn(userName, passWord, host string, port interface{}, baseDn string, ...) error
- func TryAccess(userName, passWord, host string, port interface{}, useTls bool) error
- type ADStruct
- type GroupInfo
- type LdapConn
- func (conn *LdapConn) Close()
- func (conn *LdapConn) GetGroupUsers(group string) (res []UserShortInfo, err error)
- func (conn *LdapConn) GetRecursiveSearchResult(prevLevel *[]GroupInfo, level int) *[]GroupInfo
- func (conn *LdapConn) GetRootGroups(baseDn string) (res []GroupInfo, err error)
- func (conn *LdapConn) GetStruct(baseDn string) (res ADStruct, err error)
- func (conn *LdapConn) GetSubGroups(group string, level int) (res []GroupInfo, err error)
- func (conn *LdapConn) GetUserInfo(userName, baseDn string) (res UserFullInfo, err error)
- type LdapConnOptions
- type UserFullInfo
- type UserShortInfo
Constants ¶
View Source
const (
// DepthOfLdapSearch For get AD struct
DepthOfLdapSearch = 4
)
Variables ¶
View Source
var ( ADUserAttrs = []string{ "cn", "department", "mobile", "mail", "title", "thumbnailPhoto", "manager", "telephoneNumber", "streetAddress", "l", "physicalDeliveryOfficeName", "postalCode", "co", "company", } ADGroupUserAttrs = []string{"cn", "mail", "userPrincipalName", "title", "department"} ADGroupAttrs = []string{"name", "ou", "distinguishedName"} )
Functions ¶
Types ¶
type GroupInfo ¶
type GroupInfo struct { Name string `json:"name"` DName string `json:"distinguishedName"` // long department name Ou string `json:"ou"` Has []GroupInfo `json:"has"` // list of subdirs (group children) }
GroupInfo Department obj from AD struct.
type LdapConn ¶
type LdapConn struct { Connection *ldap.Conn // contains filtered or unexported fields }
func NewLdapConn ¶
func NewLdapConn(userName, passWord, host string, port interface{}, useTls bool, options ...LdapConnOptions) (*LdapConn, error)
func (*LdapConn) GetGroupUsers ¶
func (conn *LdapConn) GetGroupUsers(group string) (res []UserShortInfo, err error)
func (*LdapConn) GetRecursiveSearchResult ¶
GetRecursiveSearchResult - run recursive search in AD (group->subgroup->etc.), return groups tree info
func (*LdapConn) GetRootGroups ¶
GetRootGroups Reading root AD folders (ou)
func (*LdapConn) GetSubGroups ¶
GetSubGroups Reading AD subFolders in group
func (*LdapConn) GetUserInfo ¶
func (conn *LdapConn) GetUserInfo(userName, baseDn string) (res UserFullInfo, err error)
type LdapConnOptions ¶
type LdapConnOptions struct {
OpenLDAP bool
}
type UserFullInfo ¶
type UserFullInfo struct { CN string `json:"cn"` // full name Department string `json:"department"` Mobile string `json:"mobile"` // mobile phone Mail string `json:"mail"` // email Title string `json:"title"` // user title Photo string `json:"thumbnailPhoto"` // bad photo from AD Company string `json:"company"` Address string `json:"address"` City string `json:"city"` Index string `json:"index"` Country string `json:"country"` Room string `json:"room"` Phone string `json:"phone"` Manager string `json:"manager"` }
UserFullInfo User full info from AD struct
Click to show internal directories.
Click to hide internal directories.