manager

package module
v0.0.0-...-95cfd4e Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Targets = make(map[string]Target)

Functions

func GetUserableEmails

func GetUserableEmails(user Userable) (mails []string)

func GetUserableMailNickname

func GetUserableMailNickname(user Userable) (mailNickname string)

func GetUserableNames

func GetUserableNames(user Userable) (names []string)

func GetUserablePhones

func GetUserablePhones(user Userable) (phones []string)

func InitWithTargetConfigStore

func InitWithTargetConfigStore(store TargetConfigStore)

func JSON

func JSON(in any) (bytes datatypes.JSON)

func NewDepartment

func NewDepartment() *department

func RegisterPlatform

func RegisterPlatform(name string, platform Platform)

func TargetKey

func TargetKey(t Target) string

func Uniq

func Uniq[T Entry](list []T) []T

Types

type Config

type Config struct {
	Platform string
}

type DatabaseConfigStore

type DatabaseConfigStore struct {
	// contains filtered or unexported fields
}

type DefaultViperConfig

type DefaultViperConfig struct {
	// contains filtered or unexported fields
}

func (DefaultViperConfig) GetPlatform

func (c DefaultViperConfig) GetPlatform() string

func (DefaultViperConfig) GetUnmarshaler

func (c DefaultViperConfig) GetUnmarshaler() Unmarshaler

type DefaultViperConfigStore

type DefaultViperConfigStore struct{}

func (DefaultViperConfigStore) GetConfigs

func (DefaultViperConfigStore) GetConfigs() (configs []TargetConfig)

type DepartmentEntryExtIDStoreable

type DepartmentEntryExtIDStoreable interface {
	DepartmentableEntry
	EntryExtIDStoreable
}

type DepartmentModifyUserOptions

type DepartmentModifyUserOptions struct {
	Role DepartmentUserRole
}

type DepartmentUserAction

type DepartmentUserAction uint
const (
	DepartmentUserActionSet DepartmentUserAction = iota
	DepartmentUserActionAdd
	DepartmentUserActionDelete
)

type DepartmentUserRole

type DepartmentUserRole uint
const (
	DepartmentUserRoleMember DepartmentUserRole = iota
	DepartmentUserRoleAdmin
)

type DepartmentUserWriter

type DepartmentUserWriter interface {
	AddToDepartment(options DepartmentModifyUserOptions, extID ExternalIdentity) error
	RemoveFromDepartment(options DepartmentModifyUserOptions, extID ExternalIdentity) error
}

type Departmentable

type Departmentable interface {
	GetName() string
	GetDescription() string
}

type DepartmentableEntry

type DepartmentableEntry interface {
	Entry
	Departmentable
	GetChildDepartments() (departments []DepartmentableEntry)
	CreateChildDepartment(departmentable Departmentable) (DepartmentableEntry, error)
	GetUsers() (users []UserableEntry, err error)
}

type Entry

type Entry interface {
	GetID() string
	GetTarget() Target
	GetTargetSlug() string
	GetPlatform() string
}

type EntryCenter

type EntryCenter interface {
	LookupEntryByExternalIdentity(extID ExternalIdentity) (Entry, error)
	LookupEntryUserByExternalIdentity(extID ExternalIdentity) (UserEntryExtIDStoreable, error)
	LookupEntryDepartmentByExternalIdentity(extID ExternalIdentity) (DepartmentEntryExtIDStoreable, error)
}

type EntryExtIDStoreable

type EntryExtIDStoreable interface {
	GetExternalIdentities() ExternalIdentities
	SetExternalIdentities(extIDs ExternalIdentities) error
}

type EntryType

type EntryType string
const (
	EntryTypeUser    EntryType = "user"
	EntryTypeDept    EntryType = "dept"
	EntryTypeProject EntryType = "project"
)

type ExternalIdentities

type ExternalIdentities []ExternalIdentity

func (ExternalIdentities) StringList

func (i ExternalIdentities) StringList() (list []string)

type ExternalIdentity

type ExternalIdentity string

mail format as ei.{entry_type}.{external_entry_id}@{target_slug}.{platform}

const InvalidExternalIdentity ExternalIdentity = ""

func ExternalIdentitiesFromStringList

func ExternalIdentitiesFromStringList(list []string) (extIDs []ExternalIdentity)

func ExternalIdentityOfDepartment

func ExternalIdentityOfDepartment(target Target, dept DepartmentableEntry) ExternalIdentity

func ExternalIdentityOfEntry

func ExternalIdentityOfEntry(entry Entry) ExternalIdentity

func ExternalIdentityOfUser

func ExternalIdentityOfUser(target Target, user UserableEntry) ExternalIdentity

func ExternalIdentityParseString

func ExternalIdentityParseString(raw string) (ExternalIdentity, error)

func (ExternalIdentity) CheckIfInternal

func (id ExternalIdentity) CheckIfInternal(target Target) error

func (ExternalIdentity) GetEntryID

func (id ExternalIdentity) GetEntryID() string

func (ExternalIdentity) GetEntryType

func (id ExternalIdentity) GetEntryType() EntryType

func (ExternalIdentity) GetPlatform

func (id ExternalIdentity) GetPlatform() string

func (ExternalIdentity) GetTarget

func (id ExternalIdentity) GetTarget() (Target, error)

func (ExternalIdentity) GetTargetSlug

func (id ExternalIdentity) GetTargetSlug() string

func (ExternalIdentity) Valid

func (id ExternalIdentity) Valid() bool

type Platform

type Platform interface {
	InitFormUnmarshaler(unmarshaler func(any) error) (Target, error)
}

type Target

type Target interface {
	TargetEntry
	GetTarget() Target
	GetTargetSlug() string
	GetPlatform() string
	GetRootDepartment() (DepartmentableEntry, error)
	GetAllUsers() (users []UserableEntry, err error)
}

func GetTargetByPlatformAndSlug

func GetTargetByPlatformAndSlug(platform, slug string) (Target, error)

func InitTarget

func InitTarget(platformKey string, unmarshaler func(any) error) (Target, error)

type TargetConfig

type TargetConfig interface {
	GetPlatform() string
	GetUnmarshaler() Unmarshaler
}

type TargetConfigStore

type TargetConfigStore interface {
	GetConfigs() []TargetConfig
}

type TargetEntry

type TargetEntry interface {
	LookupEntryUserByInternalExternalIdentity(internalExtID ExternalIdentity) (UserableEntry, error)
	LookupEntryDepartmentByInternalExternalIdentity(internalExtID ExternalIdentity) (DepartmentableEntry, error)
}

type TargetWithEnterpriseEmail

type TargetWithEnterpriseEmail interface {
	GetEnterpriseEmailDomains() []string
}

type Unmarshaler

type Unmarshaler func(any) error

type User

type User struct {
	Name  string
	Email string
	Phone string
}

func NewUser

func NewUser() *User

func (User) GetEmail

func (o User) GetEmail() (email string)

func (User) GetMailNickname

func (o User) GetMailNickname() (mailNickname string)

func (User) GetName

func (o User) GetName() (name string)

func (User) GetPhone

func (o User) GetPhone() (phonr string)

type UserEntryExtIDStoreable

type UserEntryExtIDStoreable interface {
	UserableEntry
	EntryExtIDStoreable
}

type UserWriteable

type UserWriteable interface {
	CreateUser(options Userable) (UserableEntry, error)
	LookupUser(options Userable) (UserableEntry, error)
}

type Userable

type Userable interface {
	GetName() (name string)
	GetEmail() (email string)
	GetPhone() (phone string)
}

type UserableCanMerge

type UserableCanMerge interface {
	UserableEntry
	Merge(user UserableEntry) error
}

type UserableEntry

type UserableEntry interface {
	Entry
	Userable
}

func RecursionGetAllUsersIncludeChildDepartments

func RecursionGetAllUsersIncludeChildDepartments(department DepartmentableEntry) (users []UserableEntry, err error)

type UserableWithMailNickName

type UserableWithMailNickName interface {
	Userable
	GetMailNickname() (mailNickname string)
}

type UserableWithMails

type UserableWithMails interface {
	Userable
	GetEmails() (mails []string)
}

type UserableWithNames

type UserableWithNames interface {
	Userable
	GetNames() (names []string)
}

type UserableWithPhones

type UserableWithPhones interface {
	Userable
	GetPhones() (phones []string)
}

type UserableWithRole

type UserableWithRole interface {
	UserableEntry
	GetRole() (role DepartmentUserRole)
}

Directories

Path Synopsis
cmd
drivers

Jump to

Keyboard shortcuts

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