Documentation ¶
Index ¶
- Variables
- func Auth(lc *TLdapClient, username, password string) (success bool, err error)
- func HealthCheck(lc *TLdapClient) (success bool, err error)
- func ParseTicks(ticks string) (time.Time, error)
- func TicksToTime(ticks int64) time.Time
- type TLdapClient
- func (lc *TLdapClient) AddGroupUser(path string, groupName, userDN string) error
- func (lc *TLdapClient) Auth(username, password string) (success bool, err error)
- func (lc *TLdapClient) Bind(username, password string) (success bool, err error)
- func (lc *TLdapClient) ChangePassword(path string, staff_code, new_password string) error
- func (lc *TLdapClient) Close()
- func (lc *TLdapClient) Connect() (err error)
- func (lc *TLdapClient) CreateGroup(path string, groupName string) error
- func (lc *TLdapClient) CreatePath(path string, pathName string) error
- func (lc *TLdapClient) CreateUser(path string, ldapUser *TLdapUser) (string, string, error)
- func (lc *TLdapClient) DelGroupUser(path string, groupName, userDN string) error
- func (lc *TLdapClient) DeleteGroup(path string, group_name string) error
- func (lc *TLdapClient) DeletePath(path string, path_name string) error
- func (lc *TLdapClient) DeleteUser(path string, staff_code string) error
- func (lc *TLdapClient) DisableAccount(staff_code string) error
- func (lc *TLdapClient) EnableAccount(staff_code string) error
- func (lc *TLdapClient) GetSearchResult(entry *ldap.Entry) *TResultLdap
- func (lc *TLdapClient) IsClosing() bool
- func (lc *TLdapClient) Search(SearchFilter string, scope int) (results []*TResultLdap, err error)
- func (lc *TLdapClient) SearchBase(SearchFilter string) (results []*TResultLdap, err error)
- func (lc *TLdapClient) SearchSubAll(SearchFilter string) (results []*TResultLdap, err error)
- func (lc *TLdapClient) SearchSubOne(SearchFilter string) (results []*TResultLdap, err error)
- func (lc *TLdapClient) SearchUser(username string) (user *TResultLdap, err error)
- func (lc *TLdapClient) SetExternalEmailAddress(path, staff_code, mail, display_name string) error
- type TLdapUser
- type TResultLdap
Constants ¶
This section is empty.
Variables ¶
var DefaultPwd string = "BGgsh*1050"
Functions ¶
func HealthCheck ¶
func HealthCheck(lc *TLdapClient) (success bool, err error)
func ParseTicks ¶
ParseTicks parses dates represented as Active Directory LargeInts into times. Not all time fields are represented this way, so be sure to test that your particular time returns expected results. Some time fields represented as LargeInts include accountExpires, lastLogon, lastLogonTimestamp, and pwdLastSet. More: https://social.technet.microsoft.com/wiki/contents/articles/31135.active-directory-large-integer-attributes.aspx
func TicksToTime ¶
TicksToTime converts an ActiveDirectory time in ticks to a time. This algorithm is summarized as:
Many dates are saved in Active Directory as Large Integer values. These attributes represent dates as the number of 100-nanosecond intervals since 12:00 AM January 1, 1601. 100-nanosecond intervals, equal to 0.0000001 seconds, are also called ticks. Dates in Active Directory are always saved in Coordinated Universal Time, or UTC. More: https://social.technet.microsoft.com/wiki/contents/articles/31135.active-directory-large-integer-attributes.aspx
If we directly follow the above algorithm we encounter time.Duration limits of 290 years and int overflow issues. Thus below, we carefully sidestep those.
Types ¶
type TLdapClient ¶
type TLdapClient struct { Addr string `json:"addr"` BaseDn string `json:"baseDn"` BindDn string `json:"bindDn` BindPass string `json:"bindPass"` AuthFilter string `json:"authFilter"` Attributes []string `json:"attributes"` MailDomain string `json:"mailDomain"` TLS bool `json:"tls"` StartTLS bool `json:"startTLS"` Conn *ldap.Conn }
func (*TLdapClient) AddGroupUser ¶
func (lc *TLdapClient) AddGroupUser(path string, groupName, userDN string) error
func (*TLdapClient) Auth ¶
func (lc *TLdapClient) Auth(username, password string) (success bool, err error)
func (*TLdapClient) Bind ¶
func (lc *TLdapClient) Bind(username, password string) (success bool, err error)
func (*TLdapClient) ChangePassword ¶
func (lc *TLdapClient) ChangePassword(path string, staff_code, new_password string) error
func (*TLdapClient) Close ¶
func (lc *TLdapClient) Close()
func (*TLdapClient) Connect ¶
func (lc *TLdapClient) Connect() (err error)
func (*TLdapClient) CreateGroup ¶
func (lc *TLdapClient) CreateGroup(path string, groupName string) error
func (*TLdapClient) CreatePath ¶
func (lc *TLdapClient) CreatePath(path string, pathName string) error
func (*TLdapClient) CreateUser ¶
https://learn.microsoft.com/zh-cn/windows/win32/ad/creating-a-user
func (*TLdapClient) DelGroupUser ¶
func (lc *TLdapClient) DelGroupUser(path string, groupName, userDN string) error
func (*TLdapClient) DeleteGroup ¶
func (lc *TLdapClient) DeleteGroup(path string, group_name string) error
func (*TLdapClient) DeletePath ¶
func (lc *TLdapClient) DeletePath(path string, path_name string) error
func (*TLdapClient) DeleteUser ¶
func (lc *TLdapClient) DeleteUser(path string, staff_code string) error
func (*TLdapClient) DisableAccount ¶
func (lc *TLdapClient) DisableAccount(staff_code string) error
func (*TLdapClient) EnableAccount ¶
func (lc *TLdapClient) EnableAccount(staff_code string) error
func (*TLdapClient) GetSearchResult ¶
func (lc *TLdapClient) GetSearchResult(entry *ldap.Entry) *TResultLdap
func (*TLdapClient) IsClosing ¶
func (lc *TLdapClient) IsClosing() bool
func (*TLdapClient) Search ¶
func (lc *TLdapClient) Search(SearchFilter string, scope int) (results []*TResultLdap, err error)
func (*TLdapClient) SearchBase ¶
func (lc *TLdapClient) SearchBase(SearchFilter string) (results []*TResultLdap, err error)
func (*TLdapClient) SearchSubAll ¶
func (lc *TLdapClient) SearchSubAll(SearchFilter string) (results []*TResultLdap, err error)
func (*TLdapClient) SearchSubOne ¶
func (lc *TLdapClient) SearchSubOne(SearchFilter string) (results []*TResultLdap, err error)
func (*TLdapClient) SearchUser ¶
func (lc *TLdapClient) SearchUser(username string) (user *TResultLdap, err error)
func (*TLdapClient) SetExternalEmailAddress ¶
func (lc *TLdapClient) SetExternalEmailAddress(path, staff_code, mail, display_name string) error
type TLdapUser ¶ added in v1.1.1
type TResultLdap ¶
func Search ¶
func Search(lc *TLdapClient, SearchFilter string) (results []*TResultLdap, err error)
func SearchUser ¶
func SearchUser(lc *TLdapClient, username string) (user *TResultLdap, err error)
func (*TResultLdap) GetAttr ¶
func (Self *TResultLdap) GetAttr(name string) string
func (*TResultLdap) GetAttrByInt ¶
func (Self *TResultLdap) GetAttrByInt(name string) int
func (*TResultLdap) String ¶
func (Self *TResultLdap) String() string