filter

package
v2.6.2 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package filter provides the definition of the filter interface. The LDAP search filter syntax according to RFC 4515 and RFC 2254 is supported. Addionally, a custom syntax is supported to allow more complex highly readable filters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapeFilter

func EscapeFilter(filter string) string

EscapeFilter returns a string representation of a filter with escaped values according to RFC 4515

func ReplaceAliases

func ReplaceAliases(in string) string

ReplaceAliases replaces alias expressions in the input string

Types

type Alias

type Alias struct {
	// ID is the identifier of the alias
	ID string
	// Kind is the kind of the alias
	Kind Kind
	// Parameters are the parameters of the alias used for substitution
	Parameters []string
	// Substitution is the function used to substitute the alias
	Substitution func([]string) string
}

Alias is used to define shortcuts for filters and matching rules

func AndAlias

func AndAlias() Alias

func Attr

func Attr() Alias

func Band

func Band() Alias

func Bor

func Bor() Alias

func Data

func Data() Alias

func Dc

func Dc() Alias

func Disabled

func Disabled() Alias

func Enabled

func Enabled() Alias

func Expired

func Expired() Alias

func Group

func Group() Alias

func Id

func Id() Alias

func ListAliases

func ListAliases() []Alias

ListAliases returns a list of all aliases

func Member_of

func Member_of() Alias

func NotAlias

func NotAlias() Alias

func Not_expired

func Not_expired() Alias

func OrAlias

func OrAlias() Alias

func Recursive

func Recursive() Alias

func User

func User() Alias

func (Alias) Register

func (a Alias) Register() Alias

Register registers an alias in the registry

func (Alias) String

func (a Alias) String() string

String returns a string representation of an alias

type Filter

type Filter struct {
	// Attribute is the attribute to filter on
	Attribute attributes.Attribute
	// Value is the value to filter for
	Value string
	// Rule is the matching rule bit mask to use
	Rule attributes.MatchingRule
}

Filter is used to define an LDAP filter

func And

func And(property Filter, properties ...Filter) Filter

And returns a filter that matches all given filters

func ByID

func ByID(id string) Filter

ByID returns a filter that matches an object by its ID (CN, DN, GUID, SAN, UPN, Name or DisplayName)

func HasExpired

func HasExpired() Filter

HasExpired returns a filter that matches an object that has expired

func IsDomainController

func IsDomainController() Filter

IsDomainController returns a filter that matches a domain controller

func IsEnabled

func IsEnabled() Filter

IsEnabled returns a filter that matches a not disabled user object

func IsGroup

func IsGroup() Filter

IsGroup returns a filter that matches a group

func IsUser

func IsUser() Filter

IsUser returns a filter that matches a user

func MemberOf

func MemberOf(parent string, recursive bool) Filter

MemberOf returns a filter that matches a member of a group

func Not

func Not(property Filter) Filter

Not returns a filter that matches the opposite of the given filter

func Or

func Or(property Filter, properties ...Filter) Filter

Or returns a filter that matches any of the given filters

func ParseRaw

func ParseRaw(raw string) (*Filter, error)

ParseRaw parses and validates a raw LDAP filter (RFC 4515)

func (Filter) ExpandAlias

func (o Filter) ExpandAlias() Filter

ExpandAlias expands an filter to a filter by itself or its attribute alias

func (Filter) String

func (o Filter) String() string

String returns a string representation of a filter (LDAP filter syntax)

type Kind

type Kind string

Kind is used to define the kind of an alias

const (
	// FilterImplementation is the kind of an alias that is a custom filter implementation
	FilterImplementation Kind = "filter implementation"
	FilterComposition    Kind = "filter composition"
	// MatchingRule is the kind of an alias that is a matching rule bit mask
	MatchingRule Kind = "matching rule"
)

Jump to

Keyboard shortcuts

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