Versions in this module Expand all Collapse all v1 v1.0.1 Nov 13, 2024 v1.0.0 Oct 8, 2024 Changes in this version + var ErrActiveDirectoryMustBeLDAPS = errors.New("ActiveDirectory servers must be connected to via LDAPS to change passwords") + var ErrComputerNotFound = errors.New("computer not found") + var ErrDNDuplicated = errors.New("DN is not unique") + var ErrGroupNotFound = errors.New("group not found") + var ErrMailDuplicated = errors.New("mail is not unique") + var ErrSAMAccountNameDuplicated = errors.New("sAMAccountName is not unique") + var ErrUserNotFound = errors.New("user not found") + type Computer struct + Enabled bool + Groups []string + OS string + OSVersion string + SAMAccountName string + type Config struct + BaseDN string + DialOptions []ldap.DialOpt + IsActiveDirectory bool + Server string + type FullUser struct + AccountExpires *time.Time + CN string + Description *string + DisplayName *string + Email *string + FirstName string + LastName string + ObjectClasses []string + Path *string + SAMAccountName *string + UserAccountControl UAC + type Group struct + Members []string + type LDAP struct + func New(config Config, user, password string) (*LDAP, error) + func (l *LDAP) AddUserToGroup(dn, groupDN string) error + func (l *LDAP) ChangePasswordForSAMAccountName(sAMAccountName, oldPassword, newPassword string) (err error) + func (l *LDAP) CheckPasswordForDN(dn, password string) (*User, error) + func (l *LDAP) CheckPasswordForSAMAccountName(sAMAccountName, password string) (*User, error) + func (l *LDAP) CreateUser(user FullUser, password string) (string, error) + func (l *LDAP) DeleteUser(dn string) error + func (l *LDAP) FindComputerByDN(dn string) (computer *Computer, err error) + func (l *LDAP) FindComputerBySAMAccountName(sAMAccountName string) (computer *Computer, err error) + func (l *LDAP) FindComputers() (computers []Computer, err error) + func (l *LDAP) FindGroupByDN(dn string) (group *Group, err error) + func (l *LDAP) FindGroups() (groups []Group, err error) + func (l *LDAP) FindUserByDN(dn string) (user *User, err error) + func (l *LDAP) FindUserByMail(mail string) (user *User, err error) + func (l *LDAP) FindUserBySAMAccountName(sAMAccountName string) (user *User, err error) + func (l *LDAP) FindUsers() (users []User, err error) + func (l *LDAP) RemoveUserFromGroup(dn, groupDN string) error + func (l *LDAP) WithCredentials(dn, password string) (*LDAP, error) + func (l LDAP) GetConnection() (*ldap.Conn, error) + type Object struct + func (o Object) CN() string + func (o Object) DN() string + type SamAccountType uint32 + const SamAccountTypeMax + const SamAliasObject + const SamAppBasicGroup + const SamAppQueryGroup + const SamDomainObject + const SamGroupObject + const SamMachineAccount + const SamNonSecurityAliasObject + const SamNonSecurityGroupObject + const SamTrustAccount + const SamUserObject + func (t SamAccountType) String() string + type UAC struct + AccountDisabled bool + DontRequirePreauth bool + EncryptedTextPasswordAllowed bool + HomeDirRequired bool + InterdomainTrustAccount bool + Lockout bool + LogonScript bool + MNSLogonAccount bool + NoPasswordExpiration bool + NormalAccount bool + NotDelegated bool + PasswordCantChange bool + PasswordExpired bool + PasswordNotRequired bool + ServerTrustAccount bool + SmartCardRequired bool + TempDuplicateAccount bool + TrustedForDelegation bool + TrustedToAuthenticateForDelegation bool + UseDESKeyOnly bool + WorkstationTrustAccount bool + func UACFromUint32(v uint32) UAC + func (u UAC) String() string + func (u UAC) Uint32() uint32 + type User struct + Description string + Enabled bool + Groups []string + Mail *string + SAMAccountName string