ldapext

package
v1.3.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseDN string
	BindDN string
	Conn   *ldap.Conn
	Users  *Users
	Units  *Units
	Groups *Groups
}

func Open

func Open(configs Configs) (*Client, error)

func (*Client) Close

func (c *Client) Close()

type Configs

type Configs struct {
	LdapURL          string `env:"LDAP_URL,required"`
	LdapBaseDN       string `env:"LDAP_BASE_DN,required"`
	LdapBindUsername string `env:"LDAP_BIND_USERNAME,required"`
	LdapBindPassword string `env:"LDAP_BIND_PASSWORD,required"`
}

type Group

type Group struct {
	ID        string
	UnitID    string
	Unit      *Unit
	Name      string
	CreatedAt time.Time
	UpdatedAt time.Time
}

type Groups

type Groups struct {
	// contains filtered or unexported fields
}

func (Groups) Create

func (e Groups) Create(group *Group) error

func (Groups) Delete

func (e Groups) Delete(group *Group) error

func (Groups) List

func (e Groups) List(unit *Unit, qe query.Encode) ([]*Group, int64, error)

func (Groups) Return

func (e Groups) Return(id string, qe query.Encode) (*Group, error)

func (Groups) Returns

func (e Groups) Returns(id ...string) ([]*Group, error)

type Unit

type Unit struct {
	ID        string
	Name      string
	CreatedAt time.Time
	UpdatedAt time.Time
}

type Units

type Units struct {
	// contains filtered or unexported fields
}

func (Units) Create

func (e Units) Create(unit *Unit) error

func (Units) Delete

func (e Units) Delete(unit *Unit) error

func (Units) List

func (e Units) List(qe query.Encode) ([]*Unit, int64, error)

func (Units) Return

func (e Units) Return(id string, qe query.Encode) (*Unit, error)

type User

type User struct {
	ID        string
	UnitID    string
	Unit      *Unit
	Username  string
	Name      string
	Surname   string
	Email     string
	Mobile    string
	UID       int
	GID       int
	Groups    []*Group
	CreatedAt time.Time
	UpdatedAt time.Time
}

type Users

type Users struct {
	// contains filtered or unexported fields
}

func (Users) Create

func (e Users) Create(user *User, password string) error

func (Users) Delete

func (e Users) Delete(user *User) error

func (Users) List

func (e Users) List(unit *Unit, qe query.Encode) ([]*User, int64, error)

func (Users) Member

func (e Users) Member(user *User, groups []*Group) error

func (Users) Password deprecated

func (e Users) Password(user *User, oldPassword, newPassword string) error

Deprecated: This method will be removed soon, Use the SetPassword method instead

func (Users) Return

func (e Users) Return(id string, qe query.Encode) (*User, error)

func (Users) ReturnByUsername

func (e Users) ReturnByUsername(username string, qe query.Encode) (*User, error)

func (Users) Search

func (e Users) Search(filters ...string) ([]*User, int64, error)

func (Users) SetPassword

func (e Users) SetPassword(user *User, password string) error

func (Users) Update

func (e Users) Update(user *User) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL