field

package
v0.0.0-...-484a9e1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmailHostnameRegex = regexp.MustCompile(`^([a-z\d]([a-z\d\-]{0,61}[a-z\d])?\.)+$`)

EmailHostnameRegex must be matched by the domain part of an email address, converted to its lowercase ASCII representation (no punycode), with a trailing dot for easier matching. There is no EmailLocalRegex, as we're just using two simple rules to catch typos: only one @ allowed, and no spaces.

Functions

This section is empty.

Types

type Attribute

type Attribute string

Attribute is a helper for single-attribute based fields.

func (Attribute) Name

func (a Attribute) Name() string

type Count

type Count struct {
	Attribute
	Views
	Offset   int
	Resource string
	// contains filtered or unexported fields
}

Count is a field that returns the number of resources of a specific type (plus an offset) if it's nil, and is built for the uidNumber field of LDAP.

func (*Count) ApplyTemplates

func (field *Count) ApplyTemplates(context map[string]interface{}) error

func (*Count) FromJSON

func (field *Count) FromJSON(in interface{}) error

func (*Count) FromLDAP

func (field *Count) FromLDAP(in map[string][]string) error

func (*Count) New

func (field *Count) New() ldap.Field

func (*Count) Schema

func (field *Count) Schema() api.FieldSchema

func (*Count) Setup

func (field *Count) Setup() error

func (*Count) ToJSON

func (field *Count) ToJSON() interface{}

func (*Count) ToLDAP

func (field *Count) ToLDAP() map[string][]string

type Email

type Email struct {
	Attribute
	Views
	Required
	Identifier bool
	Title      api.TranslatedString
	Icon       string
	MaxCount   uint
	MinCount   uint // You probably want to set this to 1 to require at least 1 email address!
	// contains filtered or unexported fields
}

Email is an email address of a user

func (*Email) FromJSON

func (field *Email) FromJSON(in interface{}) error

func (*Email) FromLDAP

func (field *Email) FromLDAP(in map[string][]string) error

func (*Email) Identify

func (field *Email) Identify(id string) string

func (*Email) New

func (field *Email) New() ldap.Field

func (*Email) Schema

func (field *Email) Schema() api.FieldSchema

func (*Email) Setup

func (field *Email) Setup() error

func (*Email) ToJSON

func (field *Email) ToJSON() interface{}

func (*Email) ToLDAP

func (field *Email) ToLDAP() map[string][]string

type Fixed

type Fixed struct {
	Attribute
	Views
	Value string
	// contains filtered or unexported fields
}

Fixed is a field with a fixed (or templated) value. All fixed fields must be at the end of your configuration!

func (*Fixed) ApplyTemplates

func (field *Fixed) ApplyTemplates(context map[string]interface{}) error

func (*Fixed) FromJSON

func (field *Fixed) FromJSON(in interface{}) error

func (*Fixed) FromLDAP

func (field *Fixed) FromLDAP(in map[string][]string) error

func (*Fixed) New

func (field *Fixed) New() ldap.Field

func (*Fixed) Schema

func (field *Fixed) Schema() api.FieldSchema

func (*Fixed) Setup

func (field *Fixed) Setup() error

func (*Fixed) ToJSON

func (field *Fixed) ToJSON() interface{}

func (*Fixed) ToLDAP

func (field *Fixed) ToLDAP() map[string][]string

type MemberOf

type MemberOf struct {
	Attribute
	Views
	DNTemplate string
	// contains filtered or unexported fields
}

MemberOf is an editable list of groups a user is in. Modifications get handled by user-write.go.

func (*MemberOf) FormatDN

func (field *MemberOf) FormatDN(id string) string

func (*MemberOf) FromJSON

func (field *MemberOf) FromJSON(in interface{}) error

func (*MemberOf) FromLDAP

func (field *MemberOf) FromLDAP(in map[string][]string) error

func (*MemberOf) MatchDN

func (field *MemberOf) MatchDN(dn string) bool

func (*MemberOf) New

func (field *MemberOf) New() ldap.Field

func (*MemberOf) Schema

func (field *MemberOf) Schema() api.FieldSchema

func (*MemberOf) Setup

func (field *MemberOf) Setup() error

func (*MemberOf) ToJSON

func (field *MemberOf) ToJSON() interface{}

func (*MemberOf) ToLDAP

func (field *MemberOf) ToLDAP() map[string][]string

func (*MemberOf) UnwrapDN

func (field *MemberOf) UnwrapDN(dn string) string

type OrgEmail

type OrgEmail struct {
	Email
	DomainTemplates map[string][]string
	// contains filtered or unexported fields
}

OrgEmail is an email field, but it replaces all addresses on an organization's domain with a fixed set of addresses from a template.

Example usage:

```go

&OrgEmail{Email{...}, map[string][]string{
  "example.org": []string{
    `{{ .uid }}`, // jdoe@example.org
    `{{ .givenName }}.{{ .sn }}`, // jane.doe@example.org
  },
}

```

func (*OrgEmail) ApplyTemplates

func (field *OrgEmail) ApplyTemplates(context map[string]interface{}) error

func (*OrgEmail) FromJSON

func (field *OrgEmail) FromJSON(in interface{}) error

func (*OrgEmail) New

func (field *OrgEmail) New() ldap.Field

func (*OrgEmail) Setup

func (field *OrgEmail) Setup() error

type Password

type Password struct {
	Attribute
	Views
	Title api.TranslatedString
	Icon  string
	//Complexity uint
	MinLength uint
	// contains filtered or unexported fields
}

Password is the main UID/Group CN field

func (*Password) FromJSON

func (field *Password) FromJSON(in interface{}) error

func (*Password) FromLDAP

func (field *Password) FromLDAP(in map[string][]string) error

func (*Password) New

func (field *Password) New() ldap.Field

func (*Password) Schema

func (field *Password) Schema() api.FieldSchema

func (*Password) Setup

func (field *Password) Setup() error

func (*Password) ToJSON

func (field *Password) ToJSON() interface{}

func (*Password) ToLDAP

func (field *Password) ToLDAP() map[string][]string

type Picture

type Picture struct {
	Attribute
	Views
	Title       api.TranslatedString
	MaxFilesize uint
	// contains filtered or unexported fields
}

Picture is an image file, e.g. for the user avatar

func (*Picture) FromJSON

func (field *Picture) FromJSON(in interface{}) error

func (*Picture) FromLDAP

func (field *Picture) FromLDAP(in map[string][]string) error

func (*Picture) New

func (field *Picture) New() ldap.Field

func (*Picture) Schema

func (field *Picture) Schema() api.FieldSchema

func (*Picture) Setup

func (field *Picture) Setup() error

func (*Picture) ToJSON

func (field *Picture) ToJSON() interface{}

func (*Picture) ToLDAP

func (field *Picture) ToLDAP() map[string][]string

type Required

type Required bool

type Separator

type Separator struct {
	Read  []string
	Title api.TranslatedString
	// contains filtered or unexported fields
}

func (*Separator) FromJSON

func (field *Separator) FromJSON(in interface{}) error

func (*Separator) FromLDAP

func (field *Separator) FromLDAP(in map[string][]string) error

func (*Separator) GetViews

func (field *Separator) GetViews() api.FieldViews

func (*Separator) Name

func (field *Separator) Name() string

func (*Separator) New

func (field *Separator) New() ldap.Field

func (*Separator) Schema

func (field *Separator) Schema() api.FieldSchema

func (*Separator) Setup

func (field *Separator) Setup() error

func (*Separator) ToJSON

func (field *Separator) ToJSON() interface{}

func (*Separator) ToLDAP

func (field *Separator) ToLDAP() map[string][]string

type Text

type Text struct {
	Attribute
	Views
	Required
	Default string // If this is non-empty an empty value will be overwritten with the template value.

	Identifier   bool
	Long         bool
	Multiple     bool
	Autocomplete string
	Spellcheck   bool
	Readonly     bool
	Title        api.TranslatedString
	Icon         string
	Choices      []string
	Type         string
	//Choices     map[string]string
	//Suggestions []string
	Validations []*regexp.Regexp
	// contains filtered or unexported fields
}

Text is a simple text field

func (*Text) ApplyTemplates

func (field *Text) ApplyTemplates(context map[string]interface{}) error

func (*Text) FromJSON

func (field *Text) FromJSON(in interface{}) error

func (*Text) FromLDAP

func (field *Text) FromLDAP(in map[string][]string) error

func (*Text) Identify

func (field *Text) Identify(id string) string

func (*Text) New

func (field *Text) New() ldap.Field

func (*Text) Schema

func (field *Text) Schema() api.FieldSchema

func (*Text) Setup

func (field *Text) Setup() error

func (*Text) ToJSON

func (field *Text) ToJSON() interface{}

func (*Text) ToLDAP

func (field *Text) ToLDAP() map[string][]string

type Views

type Views api.FieldViews

func (Views) GetViews

func (v Views) GetViews() api.FieldViews

Jump to

Keyboard shortcuts

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