Documentation ¶
Index ¶
- Constants
- Variables
- func ADIntervalToDays(intervalStr string) int
- func ADIntervalToMins(intervalStr string) int
- func BuildAttributeFilter(filterParts []string) internal.HashSetStr
- func BuildTitleLine(entity Entity) (string, error)
- func EnableLogging()
- func GetFlagsFromUAC(uac int64) ([]string, error)
- func GetStructure(source *LdifParser) ([]string, error)
- func GetValues(source *LdifParser, attrName string) ([]string, error)
- func MatchesFilter(entity Entity, filterConditions []IEntityFilter) bool
- func TimeFromADGeneralizedTime(adTime string) (time.Time, error)
- func TimeFromADTimestamp(adTime string) time.Time
- func UACParse(uacValue string) (flagNames []string, err error)
- func UACPrint(dest io.Writer)
- type Entity
- func (e *Entity) AddAttribute(attr EntityAttribute)
- func (e *Entity) DeocdeTimestamps()
- func (e Entity) GetAllAttributeNames() []string
- func (e Entity) GetAllAttributes() []EntityAttribute
- func (e Entity) GetAttribute(name string) (EntityAttribute, bool)
- func (e Entity) GetDN() (EntityAttribute, bool)
- func (e Entity) Groups() []string
- func (e Entity) IsEmpty() bool
- func (e *Entity) SetAttribute(attr EntityAttribute)
- func (e Entity) Size() int
- type EntityAttribute
- type EntityFilter
- type EntitySource
- type FilterCondition
- type HailmaryFilter
- type IEntityFilter
- type ILogger
- type LdifParser
- func (parser LdifParser) BuildEntities(entities chan Entity, done chan bool) error
- func (parser LdifParser) BuildEntity(keyAttrName string, keyAttrVal string) (Entity, error)
- func (parser LdifParser) CountEntities() (count int, err error)
- func (parser *LdifParser) SetAttributeFilter(filter internal.HashSetStr)
- func (parser *LdifParser) SetEntityFilter(filter []IEntityFilter)
- type PkgLogger
- type PositionedScanner
- type UACFilter
Constants ¶
const LDAPMaxLineSize int = 1024 * 1024 * 10
Variables ¶
var FilterConditions = []FilterCondition{ FILTER_EQUALS, FILTER_NOT_EQUALS, FILTER_CONTAINS, FILTER_NOT_CONTAINS, }
Functions ¶
func ADIntervalToDays ¶
func ADIntervalToMins ¶
func BuildAttributeFilter ¶
func BuildAttributeFilter(filterParts []string) internal.HashSetStr
func BuildTitleLine ¶
func GetFlagsFromUAC ¶
GetFlagsFromUAC wraps teh msldapuac dependency for easy re-definition
func GetStructure ¶
func GetStructure(source *LdifParser) ([]string, error)
func GetValues ¶ added in v0.3.0
func GetValues(source *LdifParser, attrName string) ([]string, error)
func MatchesFilter ¶
func MatchesFilter(entity Entity, filterConditions []IEntityFilter) bool
MatchesFilter Returns false if an entity fails to match a provided filter. If no filter is specified, will always return true.
func TimeFromADTimestamp ¶
Types ¶
type Entity ¶
type Entity struct {
// contains filtered or unexported fields
}
func BuildEntity ¶
BuildEntity is a wrapper for BuildEntityFromAttrList that doesn't require an attribute filter and returns all entities.
func BuildEntityFromAttrList ¶
func BuildEntityFromAttrList(entityLines []string, includeAttrs *internal.HashSetStr) Entity
BuildEntityFromAttrList will construct an Entity from a list of attribute strings and filter out all attributes not in `includeAttrs`. Either a null or empty HashSetStr value in `includeAttrs` will include all attributes. The `includeAttrs` argument must contain lowercase string values.
func (*Entity) AddAttribute ¶
func (e *Entity) AddAttribute(attr EntityAttribute)
func (*Entity) DeocdeTimestamps ¶
func (e *Entity) DeocdeTimestamps()
func (Entity) GetAllAttributeNames ¶
func (Entity) GetAllAttributes ¶
func (e Entity) GetAllAttributes() []EntityAttribute
func (Entity) GetAttribute ¶
func (e Entity) GetAttribute(name string) (EntityAttribute, bool)
func (Entity) GetDN ¶
func (e Entity) GetDN() (EntityAttribute, bool)
func (*Entity) SetAttribute ¶
func (e *Entity) SetAttribute(attr EntityAttribute)
type EntityAttribute ¶
type EntityAttribute struct { Name string Value internal.HashSetStr }
func BuildAttributeFromLine ¶
func BuildAttributeFromLine(attrLine string) (EntityAttribute, error)
func BuildEntityAttribute ¶
func BuildEntityAttribute(name string, initValue string) EntityAttribute
func NewEntityAttribute ¶
func NewEntityAttribute(name string, value string) EntityAttribute
func (EntityAttribute) HasValue ¶
func (attr EntityAttribute) HasValue(val string) bool
func (*EntityAttribute) SetValue ¶
func (attr *EntityAttribute) SetValue(vals ...string)
func (EntityAttribute) Stringify ¶
func (attr EntityAttribute) Stringify() []string
type EntityFilter ¶
type EntityFilter struct { AttributeName string Value string Condition FilterCondition IsWildcard bool }
func (EntityFilter) Matches ¶
func (filter EntityFilter) Matches(entity Entity) bool
type EntitySource ¶
type EntitySource interface { BuildEntity(keyAttrName string, keyAttrVal string) (Entity, error) BuildEntities() ([]Entity, error) SetEntityFilter(filter []IEntityFilter) SetAttributeFilter(includeAttrs internal.HashSetStr) }
EntitySource returns LDAP Entites constructed from an input data source. If filter values are not set, they will default to empty lists. Null values will cause a panic.
type FilterCondition ¶
type FilterCondition string
const ( FILTER_EQUALS FilterCondition = ":=" FILTER_NOT_EQUALS FilterCondition = ":!=" FILTER_CONTAINS FilterCondition = ":~" FILTER_NOT_CONTAINS FilterCondition = ":!~" )
type HailmaryFilter ¶
type HailmaryFilter struct {
// contains filtered or unexported fields
}
func NewHailmaryFilter ¶
func NewHailmaryFilter(searchTerm string) HailmaryFilter
func (HailmaryFilter) Matches ¶
func (filter HailmaryFilter) Matches(entity Entity) bool
type IEntityFilter ¶
func BuildEntityFilter ¶
func BuildEntityFilter(filterStrings []string) ([]IEntityFilter, error)
type ILogger ¶
type ILogger interface { Info(template string, args ...interface{}) Debug(template string, args ...interface{}) Error(template string, args ...interface{}) SetLogLevelInfo() SetLogLevelDebug() }
ILogger is the package logging interface
var Logger ILogger
type LdifParser ¶
type LdifParser struct {
// contains filtered or unexported fields
}
LdifParser implements EntityBuilder and constructs LDAP Entities from an ldif file.
func NewLdifParser ¶
func NewLdifParser(filename string) LdifParser
NewLdifParser returns a constructed LdifEntityBuilder with null filters.
func (LdifParser) BuildEntities ¶
func (parser LdifParser) BuildEntities(entities chan Entity, done chan bool) error
BuildEntities constructs an ldap entity per entry in the input ldif file.
func (LdifParser) BuildEntity ¶
func (parser LdifParser) BuildEntity(keyAttrName string, keyAttrVal string) (Entity, error)
BuildEntity returns an empty Entity object if the object is not found, other wise it returns the entity object or an error if one is encountered.
func (LdifParser) CountEntities ¶ added in v0.3.0
func (parser LdifParser) CountEntities() (count int, err error)
CountEntities returns the number of entities in the input file
func (*LdifParser) SetAttributeFilter ¶
func (parser *LdifParser) SetAttributeFilter(filter internal.HashSetStr)
SetAttributeFilter modifies the parser to return only the ldap attributes present in the filter on entites that are parsed.
func (*LdifParser) SetEntityFilter ¶
func (parser *LdifParser) SetEntityFilter(filter []IEntityFilter)
SetEntityFilter modifies the parser to return only entities matching the attribute / value pairs in the filter.
type PkgLogger ¶
type PkgLogger struct {
// contains filtered or unexported fields
}
PkgLogger is the package logging implementation
func (PkgLogger) SetLogLevelDebug ¶
func (l PkgLogger) SetLogLevelDebug()
SetLogLevelDebug sets the current log level to debug
func (PkgLogger) SetLogLevelInfo ¶
func (l PkgLogger) SetLogLevelInfo()
SetLogLevelInfo sets the current log level to info
type PositionedScanner ¶
type PositionedScanner struct {
// contains filtered or unexported fields
}
func NewPositionedScanner ¶
func NewPositionedScanner(inputStream io.Reader) *PositionedScanner
func (PositionedScanner) Buffer ¶
func (ps PositionedScanner) Buffer(buffer []byte, max int)
func (PositionedScanner) Fork ¶
func (ps PositionedScanner) Fork(input io.ReadSeeker) (*PositionedScanner, error)
func (PositionedScanner) Position ¶
func (ps PositionedScanner) Position() int64
func (*PositionedScanner) Scan ¶
func (ps *PositionedScanner) Scan() bool
func (PositionedScanner) Text ¶
func (ps PositionedScanner) Text() string