Documentation
¶
Index ¶
- func AddUser(username, firstName, lastName, email, password string, ...) error
- func AddUserToGroup(username, groupName string) error
- func Authenticate(username, password string) (bool, error)
- func Close()
- func Conn() *ldap.Conn
- func DeleteUser(username string) error
- func GetGroup(groupName string, attributes []string) (*ldap.Entry, error)
- func GetGroupMembers(groupName string) ([]string, error)
- func GetUser(username string, attributes []string) (*ldap.Entry, error)
- func GetUserGroups(username string) ([]string, error)
- func Init() (err error)
- func ModifyUser(username string, changes map[string][]string) error
- func New(cfg config.Ldap) (*ldap.Conn, error)
- func RemoveUserFromGroup(username, groupName string) error
- func Search(baseDN, filter string, attributes []string, scope int) ([]*ldap.Entry, error)
- func SearchWithContext(ctx context.Context, baseDN, filter string, attributes []string, scope int) ([]*ldap.Entry, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddUser ¶
func AddUser(username, firstName, lastName, email, password string, attributes map[string][]string) error
AddUser adds a new user to the LDAP directory
func AddUserToGroup ¶
AddUserToGroup adds a user to a group
func Authenticate ¶
Authenticate authenticates a user with the given username and password
func Conn ¶
Conn returns the global LDAP connection. It returns nil if the connection is not initialized.
func DeleteUser ¶
DeleteUser deletes a user from the LDAP directory
func GetGroupMembers ¶
GetGroupMembers returns all members of a given group
func GetUserGroups ¶
GetUserGroups returns all groups for a given username
func Init ¶
func Init() (err error)
Init initializes the global LDAP connection. It reads LDAP configuration from config.App.Ldap. If LDAP is not enabled, it returns nil. The function is thread-safe and ensures the connection is initialized only once.
func ModifyUser ¶
ModifyUser modifies an existing user in the LDAP directory
func New ¶
New returns a new LDAP connection with given configuration. It's the caller's responsibility to close the connection, caller should always call Close() when it's no longer needed.
func RemoveUserFromGroup ¶
RemoveUserFromGroup removes a user from a group
Types ¶
This section is empty.