userstore

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

AllDataLifeCycleStates is a slice of all DataLifeCycleState values

AllDataTypes is a slice of all DataType values

Functions

func GetRetentionTimeoutImmediateDeletion added in v0.7.2

func GetRetentionTimeoutImmediateDeletion() time.Time

GetRetentionTimeoutImmediateDeletion returns the immediate deletion retention timeout

func GetRetentionTimeoutIndefinite added in v0.7.2

func GetRetentionTimeoutIndefinite() time.Time

GetRetentionTimeoutIndefinite returns the indefinite retention timeout

func NewAddressSet added in v0.7.2

func NewAddressSet(items ...Address) set.Set[Address]

NewAddressSet returns a set of addresses

Types

type Accessor added in v0.4.0

type Accessor struct {
	ID uuid.UUID `json:"id"`

	// Name of accessor, must be unique
	Name string `json:"name" validate:"length:1,128" required:"true"`

	// Description of the accessor
	Description string `json:"description"`

	// Version of the accessor
	Version int `json:"version"`

	// Specify whether to access live or soft-deleted data
	DataLifeCycleState DataLifeCycleState `json:"data_life_cycle_state"`

	// Configuration for which user records to return
	SelectorConfig UserSelectorConfig `json:"selector_config" required:"true"`

	// Purposes for which this accessor is used
	Purposes []ResourceID `json:"purposes" validate:"skip" required:"true"`

	// List of userstore columns being accessed and the transformers to apply to each column
	Columns []ColumnOutputConfig `json:"columns" validate:"skip" required:"true"`

	// Policy for what data is returned by this accessor, based on properties of the caller and the user records
	AccessPolicy ResourceID `json:"access_policy" validate:"skip" required:"true"`

	// Policy for token resolution in the case of transformers that tokenize data
	TokenAccessPolicy ResourceID `json:"token_access_policy,omitempty" validate:"skip"`

	// Whether this accessor is a system accessor
	IsSystem bool `` /* 155-byte string literal not displayed */

	// Whether this accessor is audit logged each time it is executed
	IsAuditLogged bool `json:"is_audit_logged" description:"Whether this accessor is audit logged each time it is executed."`
}

Accessor represents a customer-defined view and permissions policy on userstore data

func (Accessor) GetPaginationKeys added in v0.7.6

func (Accessor) GetPaginationKeys() pagination.KeyTypes

GetPaginationKeys is part of the pagination.PageableType interface

type Address added in v0.6.3

type Address struct {
	ID                 string `json:"id,omitempty"`
	Country            string `json:"country,omitempty"`
	Name               string `json:"name,omitempty"`
	Organization       string `json:"organization,omitempty"`
	StreetAddressLine1 string `json:"street_address_line_1,omitempty"`
	StreetAddressLine2 string `json:"street_address_line_2,omitempty"`
	DependentLocality  string `json:"dependent_locality,omitempty"`
	Locality           string `json:"locality,omitempty"`
	AdministrativeArea string `json:"administrative_area,omitempty"`
	PostCode           string `json:"post_code,omitempty"`
	SortingCode        string `json:"sorting_code,omitempty"`
}

Address is a native userstore type that represents a physical address

type Column added in v0.3.0

type Column struct {
	// Columns may be renamed, but their ID cannot be changed.
	ID           uuid.UUID         `json:"id"`
	Name         string            `json:"name" validate:"length:1,128" required:"true"`
	DataType     ResourceID        `json:"data_type" validate:"skip"`
	Type         DataType          `json:"type" required:"true"`
	IsArray      bool              `json:"is_array" required:"true"`
	DefaultValue string            `json:"default_value"`
	IndexType    ColumnIndexType   `json:"index_type" required:"true"`
	IsSystem     bool              `` /* 149-byte string literal not displayed */
	Constraints  ColumnConstraints `json:"constraints" description:"Optional constraints for configuring the behavior of the associated column Type."`
}

Column represents a single field/column/value to be collected/stored/managed in the user data store of a tenant.

func (*Column) EqualsIgnoringNilID added in v1.1.0

func (c *Column) EqualsIgnoringNilID(other *Column) bool

EqualsIgnoringNilID returns true if the two columns are equal, ignoring ID if one is nil

func (Column) GetPaginationKeys added in v0.7.6

func (Column) GetPaginationKeys() pagination.KeyTypes

GetPaginationKeys is part of the pagination.PageableType interface

type ColumnConstraints added in v1.0.0

type ColumnConstraints struct {
	ImmutableRequired bool          `` /* 181-byte string literal not displayed */
	PartialUpdates    bool          `` /* 226-byte string literal not displayed */
	UniqueIDRequired  bool          `` /* 222-byte string literal not displayed */
	UniqueRequired    bool          `` /* 155-byte string literal not displayed */
	Fields            []ColumnField `` /* 153-byte string literal not displayed */
}

ColumnConstraints represents the data type constraints for a column

func (ColumnConstraints) Equals added in v1.0.0

func (cc ColumnConstraints) Equals(other ColumnConstraints) bool

Equals returns true if the column constraints are equal

func (ColumnConstraints) Validate added in v1.1.0

func (o ColumnConstraints) Validate() error

Validate implements Validateable

type ColumnDataType added in v1.2.0

type ColumnDataType struct {
	ID                   uuid.UUID           `json:"id"`
	Name                 string              `json:"name" validate:"length:1,128" required:"true"`
	Description          string              `json:"description"`
	IsCompositeFieldType bool                `json:"is_composite_field_type" description:"Whether the data type can be used for a composite field."`
	IsNative             bool                `json:"is_native" description:"Whether this is a native non-editable data type."`
	CompositeAttributes  CompositeAttributes `json:"composite_attributes"`
}

ColumnDataType represents the settings for a data type

type ColumnField added in v1.0.0

type ColumnField struct {
	Type                DataType `json:"type" required:"true"`
	Name                string   `` /* 290-byte string literal not displayed */
	CamelCaseName       string   `` /* 126-byte string literal not displayed */
	StructName          string   `json:"struct_name" description:"Read-only snake-case version of field name, with all letters lowercase. (ex. id_field_1)"`
	Required            bool     `json:"required" description:"Whether a value must be specified for the field."`
	IgnoreForUniqueness bool     `` /* 138-byte string literal not displayed */
}

ColumnField represents the settings for a column field

func (ColumnField) Validate added in v1.1.0

func (o ColumnField) Validate() error

Validate implements Validateable

type ColumnIndexType added in v0.6.0

type ColumnIndexType string

ColumnIndexType is an enum for supported column index types

const (
	// ColumnIndexTypeNone is the default value
	ColumnIndexTypeNone ColumnIndexType = "none"

	// ColumnIndexTypeIndexed indicates that the column should be indexed
	ColumnIndexTypeIndexed ColumnIndexType = "indexed"

	// ColumnIndexTypeUnique indicates that the column should be indexed and unique
	ColumnIndexTypeUnique ColumnIndexType = "unique"
)

type ColumnInputConfig added in v0.6.4

type ColumnInputConfig struct {
	Column     ResourceID `json:"column"`
	Normalizer ResourceID `json:"normalizer"`

	// Validator is deprecated in favor of Normalizer
	Validator ResourceID `json:"validator"`
}

ColumnInputConfig is a struct that contains a column and the normalizer to use for that column

type ColumnOutputConfig added in v0.6.4

type ColumnOutputConfig struct {
	Column      ResourceID `json:"column"`
	Transformer ResourceID `json:"transformer"`
}

ColumnOutputConfig is a struct that contains a column and the transformer to apply to that column

type CompositeAttributes added in v1.2.0

type CompositeAttributes struct {
	IncludeID bool             `json:"include_id" description:"Whether the composite data type must include an id field."`
	Fields    []CompositeField `json:"fields" description:"The set of fields associated with a composite data type."`
}

CompositeAttributes represents the attributes for a composite data type

type CompositeField added in v1.2.0

type CompositeField struct {
	DataType            ResourceID `json:"data_type"`
	Name                string     `` /* 290-byte string literal not displayed */
	CamelCaseName       string     `` /* 126-byte string literal not displayed */
	StructName          string     `json:"struct_name" description:"Read-only snake-case version of field name, with all letters lowercase. (ex. id_field_1)"`
	Required            bool       `json:"required" description:"Whether a value must be specified for the field."`
	IgnoreForUniqueness bool       `` /* 139-byte string literal not displayed */
}

CompositeField represents the settings for a composite data type field

type CompositeValue added in v1.0.0

type CompositeValue map[string]interface{}

CompositeValue is a map of strings to value

type DataLifeCycleState added in v0.7.2

type DataLifeCycleState string

DataLifeCycleState identifies the life-cycle state for a piece of data - either live or soft-deleted.

const (
	DataLifeCycleStateDefault     DataLifeCycleState = ""
	DataLifeCycleStateLive        DataLifeCycleState = "live"
	DataLifeCycleStateSoftDeleted DataLifeCycleState = "softdeleted"

	// maps to softdeleted
	DataLifeCycleStatePostDelete DataLifeCycleState = "postdelete"

	// maps to live
	DataLifeCycleStatePreDelete DataLifeCycleState = "predelete"
)

Supported data life cycle states

func (DataLifeCycleState) Enum added in v1.1.0

func (t DataLifeCycleState) Enum() []interface{}

Enum implements Enum

func (DataLifeCycleState) GetConcrete added in v0.7.2

func (dlcs DataLifeCycleState) GetConcrete() DataLifeCycleState

GetConcrete returns the concrete data life cycle state for the given data life cycle state

func (DataLifeCycleState) GetDefaultRetentionTimeout added in v0.7.2

func (dlcs DataLifeCycleState) GetDefaultRetentionTimeout() time.Time

GetDefaultRetentionTimeout returns the default retention timeout for the data life cycle state

func (DataLifeCycleState) IsLive added in v0.7.2

func (dlcs DataLifeCycleState) IsLive() bool

IsLive return true if the concrete data life cycle state is live

func (DataLifeCycleState) MarshalText added in v1.1.0

func (t DataLifeCycleState) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler (for JSON)

func (*DataLifeCycleState) UnmarshalText added in v1.1.0

func (t *DataLifeCycleState) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextMarshaler (for JSON)

func (*DataLifeCycleState) Validate added in v1.1.0

func (t *DataLifeCycleState) Validate() error

Validate implements Validateable

type DataType added in v0.6.4

type DataType string

DataType is an enum for supported data types

const (
	DataTypeInvalid         DataType = ""
	DataTypeAddress         DataType = "address"
	DataTypeBirthdate       DataType = "birthdate"
	DataTypeBoolean         DataType = "boolean"
	DataTypeComposite       DataType = "composite"
	DataTypeDate            DataType = "date"
	DataTypeEmail           DataType = "email"
	DataTypeInteger         DataType = "integer"
	DataTypeE164PhoneNumber DataType = "e164_phonenumber"
	DataTypePhoneNumber     DataType = "phonenumber"
	DataTypeSSN             DataType = "ssn"
	DataTypeString          DataType = "string"
	DataTypeTimestamp       DataType = "timestamp"
	DataTypeUUID            DataType = "uuid"
)

DataType constants NOTE: keep in sync with mapDataType defined in TenantUserStoreConfig.tsx

func (DataType) Enum added in v0.7.6

func (t DataType) Enum() []interface{}

Enum implements Enum

func (DataType) MarshalText added in v0.7.6

func (t DataType) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler (for JSON)

func (*DataType) UnmarshalText added in v0.7.6

func (t *DataType) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextMarshaler (for JSON)

func (*DataType) Validate added in v0.7.6

func (t *DataType) Validate() error

Validate implements Validateable

type Mutator added in v0.4.0

type Mutator struct {
	ID uuid.UUID `json:"id"`

	// Name of mutator, must be unique
	Name string `json:"name" validate:"length:1,128" required:"true"`

	// Description of the mutator
	Description string `json:"description"`

	// Version of the mutator
	Version int `json:"version"`

	// Configuration for which user records to modify
	SelectorConfig UserSelectorConfig `json:"selector_config" required:"true"`

	// The set of userstore columns to modify for each user record
	Columns []ColumnInputConfig `json:"columns" validate:"skip" required:"true"`

	// Policy for whether the data for each user record can be updated
	AccessPolicy ResourceID `json:"access_policy" validate:"skip" required:"true"`

	IsSystem bool `` /* 152-byte string literal not displayed */
}

Mutator represents a customer-defined scope and permissions policy for updating userstore data

type Purpose added in v0.6.4

type Purpose struct {
	ID          uuid.UUID `json:"id"`
	Name        string    `json:"name" validate:"length:1,128" required:"true"`
	Description string    `json:"description"`
	IsSystem    bool      `` /* 152-byte string literal not displayed */
}

Purpose represents a customer-defined purpose for userstore columns

type Record

type Record map[string]interface{}

Record is a single "row" of data containing 0 or more Columns from userstore's schema The key is the name of the column

func (Record) BoolValue added in v0.6.4

func (r Record) BoolValue(key string) bool

BoolValue returns a boolean value for the specified key

func (Record) StringValue added in v0.6.4

func (r Record) StringValue(key string) string

StringValue returns a string value for the specified key

func (Record) UUIDValue added in v0.6.4

func (r Record) UUIDValue(key string) uuid.UUID

UUIDValue returns a UUID value for the specified key

type ResourceID added in v0.6.4

type ResourceID struct {
	ID   uuid.UUID `json:"id"`
	Name string    `json:"name"`
}

ResourceID is a struct that contains a name and ID, only one of which is required to be set

func (ResourceID) EquivalentTo added in v1.2.0

func (r ResourceID) EquivalentTo(other ResourceID) bool

EquivalentTo returns true if the resources are compatible with each other

func (ResourceID) Validate added in v0.6.4

func (r ResourceID) Validate() error

Validate implements Validateable

type UserSelectorConfig added in v0.5.0

type UserSelectorConfig struct {
	WhereClause string `json:"where_clause" validate:"notempty" example:"{id} = ANY (?)"`
}

UserSelectorConfig is the configuration for a UserSelector

func (UserSelectorConfig) MatchesAll added in v1.1.0

func (u UserSelectorConfig) MatchesAll() bool

MatchesAll returns true if the UserSelectorConfig is configured to match all users

type UserSelectorValues added in v0.5.0

type UserSelectorValues []interface{}

UserSelectorValues are the values passed for the UserSelector of an accessor or mutator

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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