datastore

package
Version: v0.0.0-...-1a7bac6 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Invalid   = iota       // 0
	Standard  = 100 * iota // 100
	Admin                  // 200
	Superuser              // 300
)

Available user roles:

* Invalid: default value set in case there is no authentication previous process for this user and thus not got a valid role. * Standard: role for regular users. This is the less privileged role * Admin: role for createsuperuser users, including standard role permissions but not superuser ones * Superuser: role for users having all the permissions

View Source
const MaxNonceAgeInSeconds = 60

MaxNonceAgeInSeconds is the nonce age

View Source
const OpenidNonceMaxAge = MaxNonceAgeInSeconds * time.Second

OpenidNonceMaxAge is the maximum age of stored nonces. Any nonces older than this will automatically be rejected. Stored nonces older than this will periodically be purged from the database.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataStore

type DataStore interface {
	OpenIDNonceStore() openid.NonceStore
	CreateUser(user User) (int64, error)
	GetUser(username string) (User, error)
	UserList() ([]User, error)
	UserUpdate(user User) error
	UserDelete(username string) error

	OrgUserAccess(orgID, username string, role int) bool
	OrganizationsForUser(username string) ([]Organization, error)
	OrganizationForUserToggle(orgID, username string) error
	OrganizationGet(orgID string) (Organization, error)
	OrganizationCreate(org Organization) error
	OrganizationUpdate(org Organization) error
}

DataStore is the interfaces for the data repository

type OpenidNonce

type OpenidNonce struct {
	ID        int64
	Nonce     string
	Endpoint  string
	TimeStamp int64
}

OpenidNonce holds the details of the nonce, combining a timestamp and random text

type Organization

type Organization struct {
	OrganizationID string
	Name           string
}

Organization holds details of the organization

type OrganizationUser

type OrganizationUser struct {
	OrganizationID string
	Username       string
}

OrganizationUser holds links a user and organization

type User

type User struct {
	ID       int64
	Username string
	Name     string
	Email    string
	Role     int
}

User holds user personal, authentication and authorization info

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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