userstore

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

AllColumnTypes is a slice of all ColumnType values

Functions

This section is empty.

Types

type Accessor added in v0.4.0

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

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

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

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

	// the columns that are accessed here
	ColumnNames []string `json:"column_names" validate:"skip"`

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

	// Configuration for selectors for this accessor
	SelectorConfig UserSelectorConfig `json:"selector_config"`
}

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

func (*Accessor) Equals added in v0.6.0

func (o *Accessor) Equals(other *Accessor) bool

Equals returns true if the two accessors are equal

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:"notempty"`
	Type         ColumnType      `json:"type"`
	DefaultValue string          `json:"default_value"`
	IndexType    ColumnIndexType `json:"index_type"`
}

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 int

ColumnIndexType is an enum for supported column index types

const (
	// ColumnIndexTypeNone is the default value
	ColumnIndexTypeNone ColumnIndexType = iota

	// ColumnIndexTypeIndexed indicates that the column should be indexed
	ColumnIndexTypeIndexed

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

type ColumnType added in v0.3.0

type ColumnType int

ColumnType is an enum for supported column types

const (
	ColumnTypeInvalid ColumnType = 0

	ColumnTypeBoolean ColumnType = 1

	ColumnTypeString ColumnType = 100

	ColumnTypeTimestamp ColumnType = 200

	ColumnTypeUUID ColumnType = 300
)

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

func GetColumnType added in v0.6.0

func GetColumnType(i interface{}) ColumnType

GetColumnType returns the ColumnType for the given value

func (ColumnType) MarshalText added in v0.3.0

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

MarshalText implements encoding.TextMarshaler (for JSON)

func (ColumnType) String added in v0.3.0

func (t ColumnType) String() string

just here for easier debugging

func (*ColumnType) UnmarshalText added in v0.3.0

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

UnmarshalText implements encoding.TextMarshaler (for JSON)

func (*ColumnType) Validate added in v0.3.0

func (t *ColumnType) Validate() error

Validate implements Validateable

type Mutator added in v0.4.0

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

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

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

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

	// The columns that are updated here
	ColumnNames []string `json:"column_names" validate:"skip"`

	// Decides who can update these columns
	AccessPolicyID uuid.UUID `json:"access_policy_id" validate:"notnil"`

	// Validates the data before it is written to the userstore
	ValidationPolicyID uuid.UUID `json:"validation_policy_id" validate:"notnil"`

	// Configuration for selectors for this mutator
	SelectorConfig UserSelectorConfig `json:"selector_config"`
}

Mutator represents a customer-defined permissions policy for updating columns in userstore

func (*Mutator) Equals added in v0.6.0

func (o *Mutator) Equals(other *Mutator) bool

Equals returns true if the two mutators are equal

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

func (r Record) Validate() error

Validate implements Validateable and ensures that a Record has columns which consist only of valid ColumnTypes. TODO: need a Validation method that validates against a particular schema.

type UserSelectorConfig added in v0.5.0

type UserSelectorConfig struct {
	WhereClause string `json:"where_clause" validate:"notempty"`
}

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