Documentation
¶
Index ¶
- type Manager
- func (manager *Manager) AddGroupUsers(ctx context.Context, groupcn string, usercn ...string) (*schema.Object, error)
- func (manager *Manager) Bind(ctx context.Context, dn, password string) (*schema.Object, error)
- func (manager *Manager) ChangePassword(ctx context.Context, dn, old string, new *string) (*schema.Object, *string, error)
- func (manager *Manager) Connect() error
- func (manager *Manager) Create(ctx context.Context, dn string, attr url.Values) (*schema.Object, error)
- func (manager *Manager) CreateGroup(ctx context.Context, cn string, attrs url.Values) (*schema.Object, error)
- func (manager *Manager) CreateUser(ctx context.Context, user string, attrs url.Values, allocateGID bool) (*schema.Object, error)
- func (manager *Manager) Delete(ctx context.Context, dn string) (*schema.Object, error)
- func (manager *Manager) DeleteGroup(ctx context.Context, cn string) (*schema.Object, error)
- func (manager *Manager) DeleteUser(ctx context.Context, cn string) (*schema.Object, error)
- func (ldap *Manager) Disconnect() error
- func (manager *Manager) Get(ctx context.Context, dn string) (*schema.Object, error)
- func (manager *Manager) GetGroup(ctx context.Context, cn string) (*schema.Object, error)
- func (manager *Manager) GetUser(ctx context.Context, cn string) (*schema.Object, error)
- func (ldap *Manager) Host() string
- func (manager *Manager) List(ctx context.Context, request schema.ObjectListRequest) (*schema.ObjectList, error)
- func (manager *Manager) ListAttributeTypes(ctx context.Context, req schema.AttributeTypeListRequest) (*schema.AttributeTypeListResponse, error)
- func (manager *Manager) ListGroups(ctx context.Context, request schema.ObjectListRequest) (*schema.ObjectList, error)
- func (manager *Manager) ListObjectClasses(ctx context.Context, req schema.ObjectClassListRequest) (*schema.ObjectClassListResponse, error)
- func (manager *Manager) ListUsers(ctx context.Context, request schema.ObjectListRequest) (*schema.ObjectList, error)
- func (ldap *Manager) Port() int
- func (manager *Manager) RemoveGroupUsers(ctx context.Context, groupcn string, usercn ...string) (*schema.Object, error)
- func (manager *Manager) Run(ctx context.Context, logger *slog.Logger) error
- func (manager *Manager) Update(ctx context.Context, dn string, attr url.Values) (*schema.Object, error)
- func (manager *Manager) UpdateGroup(ctx context.Context, cn string, attrs url.Values) (*schema.Object, error)
- func (manager *Manager) UpdateUser(ctx context.Context, cn string, attrs url.Values) (*schema.Object, error)
- func (ldap *Manager) User() string
- func (manager *Manager) WhoAmI() (string, error)
- type Opt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
LDAP manager
func (*Manager) AddGroupUsers ¶
func (manager *Manager) AddGroupUsers(ctx context.Context, groupcn string, usercn ...string) (*schema.Object, error)
Add users to a group, and return the updated group. Membership changes are applied with a single LDAP modify request on the group entry.
func (*Manager) Bind ¶
Bind a user to check if they are authenticated, returns httpresponse.ErrNotAuthorized if the credentials are invalid
func (*Manager) ChangePassword ¶
func (manager *Manager) ChangePassword(ctx context.Context, dn, old string, new *string) (*schema.Object, *string, error)
Change a password for a user. If the new password is empty, then the password is reset to a new random password and returned. The old password may be omitted when the directory permits administrative password resets.
func (*Manager) Create ¶
func (manager *Manager) Create(ctx context.Context, dn string, attr url.Values) (*schema.Object, error)
Create an object
func (*Manager) CreateGroup ¶
func (manager *Manager) CreateGroup(ctx context.Context, cn string, attrs url.Values) (*schema.Object, error)
Create a group with optional additional attributes. If posixGroup is one of the configured group object classes and no gidNumber is supplied, the next available GID is allocated atomically from the cn=lastgid device entry.
func (*Manager) CreateUser ¶
func (manager *Manager) CreateUser(ctx context.Context, user string, attrs url.Values, allocateGID bool) (*schema.Object, error)
Create a user. When allocateGID is true and gidNumber is not supplied for a posixAccount entry, gidNumber is set to the effective uidNumber.
func (*Manager) DeleteGroup ¶
Delete a group by cn
func (*Manager) DeleteUser ¶
Delete a user
func (*Manager) Disconnect ¶
Disconnect from the LDAP server
func (*Manager) List ¶
func (manager *Manager) List(ctx context.Context, request schema.ObjectListRequest) (*schema.ObjectList, error)
Return the objects as a list
func (*Manager) ListAttributeTypes ¶
func (manager *Manager) ListAttributeTypes(ctx context.Context, req schema.AttributeTypeListRequest) (*schema.AttributeTypeListResponse, error)
Returns attribute types
func (*Manager) ListGroups ¶
func (manager *Manager) ListGroups(ctx context.Context, request schema.ObjectListRequest) (*schema.ObjectList, error)
Return all groups
func (*Manager) ListObjectClasses ¶
func (manager *Manager) ListObjectClasses(ctx context.Context, req schema.ObjectClassListRequest) (*schema.ObjectClassListResponse, error)
Returns object classes
func (*Manager) ListUsers ¶
func (manager *Manager) ListUsers(ctx context.Context, request schema.ObjectListRequest) (*schema.ObjectList, error)
Return all users
func (*Manager) RemoveGroupUsers ¶
func (manager *Manager) RemoveGroupUsers(ctx context.Context, groupcn string, usercn ...string) (*schema.Object, error)
Remove users from a group, and return the updated group. Membership changes are applied with a single LDAP modify request on the group entry.
func (*Manager) Update ¶
func (manager *Manager) Update(ctx context.Context, dn string, attr url.Values) (*schema.Object, error)
Update attributes for an object. It will replace the attributes where the values is not empty, and delete the attributes where the values is empty. If the request changes an RDN attribute, the entry is renamed first and then modified. The object is returned after the update.
func (*Manager) UpdateGroup ¶
func (manager *Manager) UpdateGroup(ctx context.Context, cn string, attrs url.Values) (*schema.Object, error)
Update attributes for a group. It will replace the attributes where the values are not empty, and delete the attributes where the values are empty. If the request changes the naming attribute, the entry is renamed first and then modified. The updated group is returned.
func (*Manager) UpdateUser ¶
func (manager *Manager) UpdateUser(ctx context.Context, cn string, attrs url.Values) (*schema.Object, error)
Update attributes for a user. It will replace the attributes where the values are not empty, and delete the attributes where the values are empty. If the request changes the naming attribute, the entry is renamed first and then modified. The updated user is returned.
type Opt ¶
type Opt func(*opt) error
Opt represents a function that modifies the options
func WithBaseDN ¶
func WithGroupDN ¶
func WithPassword ¶
func WithSkipVerify ¶
func WithSkipVerify() Opt