user

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: ISC Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when a user is not found in the database.
	ErrNotFound = errors.New("user not found")
)

Functions

This section is empty.

Types

type DB added in v1.4.0

type DB interface {
	// TxInsert inserts a user into the database using a transaction.
	TxInsert(*sql.Tx, User) error

	// TxUpdate updates a user in the database using a transaction.
	TxUpdate(*sql.Tx, User) error

	// TxGet gets a user from the database using a transactions.
	//
	// An ErrNotFound error is returned if a user is not found for the provided
	// user ID.
	TxGet(tx *sql.Tx, userID string) (*User, error)

	// Get gets a user from the database.
	//
	// An ErrNotFound error is returned if a user is not found for the provided
	// user ID.
	Get(userID string) (*User, error)
}

DB represents the user database API.

type PluginData added in v1.4.0

type PluginData struct {
	ClearText []byte
	Encrypted []byte
}

PluginData contains the user data for a specific plugin.

type User

type User struct {
	ID      uuid.UUID             // Unique ID
	Plugins map[string]PluginData // [pluginID]PluginData
	Updated bool
}

User represents a politeia user.

Plugins are only provided with and can only edit the plugin data that they own. The user object does not necessarily contain all plugin data for the user. Plugins have two ways to save user data:

  1. Update the user object that is provided to them by the backend during the execution of plugin commands. These updates are saved to the database by the backend. Plugins have the option of saving data to the user object as either clear text or encrypted.

  2. Plugins can create and manage a database table themselves to store plugin user data in. This option should be reserved for data that would cause performance issues if saved to this global user object.

Jump to

Keyboard shortcuts

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