common

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACLRule

type ACLRule struct {
	DistinguishedNameSuffix string
	Allowed                 bool
}

ACLRule represents an ACL rule used to determine if a object can make search on a specific DN.

type ACLRuleSet

type ACLRuleSet []ACLRule

ACLRuleSet is an ordered set of ACL rules, sorted by the most precise suffix.

func (ACLRuleSet) Len

func (set ACLRuleSet) Len() int

func (ACLRuleSet) Less

func (set ACLRuleSet) Less(i, j int) bool

Less returns true if the suffix of the rule at index i is more precise than the one at index j.

func (ACLRuleSet) Swap

func (set ACLRuleSet) Swap(i, j int)

type ImplObject

type ImplObject struct {
	DN         string
	Attributes ldap.Attributes
	SubObjects map[string]*Object

	BindPasswords optional.Option[string]
	ACLs          ACLRuleSet
}

ImplObject is a generic LDAP object implementation with all the required properties to be used by a specific LDAP directory implementation.

func (*ImplObject) AddACLRule

func (obj *ImplObject) AddACLRule(rule ...ACLRule)

AddACLRule adds the given ACL rule to the current object at the right position, following the DN suffix order.

func (*ImplObject) AddAttribute

func (obj *ImplObject) AddAttribute(name string, values ...string)

AddAttribute adds the given values to the named attribute of the current object.

type Object

type Object struct {
	// ImplObject contains all information about the object, but because we
	// want to keep the Object clean from any conflict and misundertanding,
	// we use a different name for the internal object.
	ImplObject
}

Object is a generic LDAP object implementation. It wraps ImplObject in order to implement the ldap.Object interface.

func (Object) Attributes

func (obj Object) Attributes() ldap.Attributes

Attributes returns the list of attributes of the current object.

func (Object) Bind

func (obj Object) Bind(password string) (bool, error)

Bind returns true if the current object is able to authenticate and the password is correct. It returns false if the password is wrong or not set.

func (Object) CanSearchOn

func (obj Object) CanSearchOn(dn string) bool

CanSearchOn returns true if the current object is able to perform a search on the given DN.

func (Object) DN

func (obj Object) DN() string

DN returns the DN of the current object.

func (Object) Search

func (obj Object) Search(scope gldap.Scope, filter string) ([]ldap.Object, error)

Search searches sub objects based on the given scope and filter. Depending on the scope, the search will be more or less precise : - gldap.BaseObject: only the current object will be searched - gldap.SingleLevel: the current object and its children will be searched - gldap.WholeSubtree: the current object and all its descendants will be searched.

Jump to

Keyboard shortcuts

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