userstore

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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"`

	// 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"`
}

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

type Address added in v0.6.3

type Address struct {
	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"`
	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 */
}

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

func (*Column) Equals added in v0.6.0

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

Equals returns true if the two columns are equal

type ColumnAccessor added in v0.3.0

type ColumnAccessor struct {
	ID uuid.UUID `json:"id" validate:"notnil"`

	// Friendly ID, must be unique?
	Name string `json:"name" validate:"notempty"`

	// the columns that are accessed here
	ColumnIDs []uuid.UUID `json:"column_ids" validate:"notnil"`

	// makes decisions about who can access this particular view of this field
	AccessPolicyID uuid.UUID `json:"access_policy_id" validate:"notnil"`

	// transforms the value of this field before it is returned to the client
	TransformationPolicyID uuid.UUID `json:"transformation_policy_id" validate:"notnil"`
}

ColumnAccessor represents a customer-defined view / permissions policy on a column

type ColumnAccessors added in v0.3.0

type ColumnAccessors []ColumnAccessor

ColumnAccessors is simply a slice of ColumnAccessor, and this type exists soley so that we can hang Scan() and Value() on it to make the db layer work.

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"`
	Validator ResourceID `json:"validator"`
}

ColumnInputConfig is a struct that contains a column and the validator 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 DataType added in v0.6.4

type DataType string

DataType is an enum for supported data types

const (
	DataTypeInvalid   DataType = ""
	DataTypeBoolean   DataType = "boolean"
	DataTypeInteger   DataType = "integer"
	DataTypeString    DataType = "string"
	DataTypeTimestamp DataType = "timestamp"
	DataTypeUUID      DataType = "uuid"
	DataTypeAddress   DataType = "address"
)

DataType constants (leaving gaps intentionally to allow future related types to be grouped) NOTE: keep in sync with mapDataType defined in TenantUserStoreConfig.tsx

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"`
}

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"`
}

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) 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

type UserSelectorValues added in v0.5.0

type UserSelectorValues []interface{}

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

Jump to

Keyboard shortcuts

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