memory

package
v0.3.0-dev.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewInMemoryDataAccess

func NewInMemoryDataAccess() dal.DataAccess

NewInMemoryDataAccess returns a new InMemoryDataAccess instance.

Types

type InMemoryDataAccess

type InMemoryDataAccess struct {
	dal.DataAccess
	// contains filtered or unexported fields
}

InMemoryDataAccess is an entirely in-memory representation of a data access layer. Great for testing and development. Terrible for production.

func (InMemoryDataAccess) GroupAddUser

func (da InMemoryDataAccess) GroupAddUser(groupname string, username string) error

GroupAddUser adds a user to a group

func (InMemoryDataAccess) GroupCreate

func (da InMemoryDataAccess) GroupCreate(group rest.Group) error

GroupCreate creates a new user group.

func (InMemoryDataAccess) GroupDelete

func (da InMemoryDataAccess) GroupDelete(name string) error

GroupDelete delete a group.

func (InMemoryDataAccess) GroupExists

func (da InMemoryDataAccess) GroupExists(name string) (bool, error)

GroupExists is used to determine whether a group exists in the data store.

func (InMemoryDataAccess) GroupGet

func (da InMemoryDataAccess) GroupGet(name string) (rest.Group, error)

GroupGet gets a specific group.

func (InMemoryDataAccess) GroupGrantRole

func (da InMemoryDataAccess) GroupGrantRole() error

GroupGrantRole grants one or more roles to a group.

func (InMemoryDataAccess) GroupList

func (da InMemoryDataAccess) GroupList() ([]rest.Group, error)

GroupList returns a list of all known groups in the datastore. Passwords are not included. Nice try.

func (InMemoryDataAccess) GroupRemoveUser

func (da InMemoryDataAccess) GroupRemoveUser(groupname string, username string) error

GroupRemoveUser removes one or more users from a group.

func (InMemoryDataAccess) GroupRevokeRole

func (da InMemoryDataAccess) GroupRevokeRole() error

GroupRevokeRole revokes one or more roles from a group.

func (InMemoryDataAccess) GroupUpdate

func (da InMemoryDataAccess) GroupUpdate(group rest.Group) error

GroupUpdate is used to update an existing group. An error is returned if the groupname is empty or if the group doesn't exist. TODO Should we let this create groups that don't exist?

func (InMemoryDataAccess) GroupUserAdd

func (da InMemoryDataAccess) GroupUserAdd(group string, user string) error

GroupUserAdd comments TBD

func (InMemoryDataAccess) GroupUserDelete

func (da InMemoryDataAccess) GroupUserDelete(group string, user string) error

GroupUserDelete comments TBD

func (InMemoryDataAccess) GroupUserList

func (da InMemoryDataAccess) GroupUserList(group string) ([]rest.User, error)

GroupUserList comments TBD

func (InMemoryDataAccess) Initialize

func (da InMemoryDataAccess) Initialize() error

Initialize initializes an InMemoryDataAccess instance.

func (InMemoryDataAccess) TokenEvaluate

func (da InMemoryDataAccess) TokenEvaluate(tokenString string) bool

TokenEvaluate will test a token for validity. It returns true if the token exists and is still within its valid period; false otherwise.

func (InMemoryDataAccess) TokenGenerate

func (da InMemoryDataAccess) TokenGenerate(username string, duration time.Duration) (rest.Token, error)

TokenGenerate generates a new token for the given user with a specified expiration duration. Any existing token for this user will be automatically invalidated. If the user doesn't exist an error is returned.

func (InMemoryDataAccess) TokenInvalidate

func (da InMemoryDataAccess) TokenInvalidate(tokenString string) error

TokenInvalidate immediately invalidates the specified token. An error is returned if the token doesn't exist.

func (InMemoryDataAccess) TokenRetrieveByToken

func (da InMemoryDataAccess) TokenRetrieveByToken(tokenString string) (rest.Token, error)

TokenRetrieveByToken retrieves the token by its value. An error is returned if no such token exists.

func (InMemoryDataAccess) TokenRetrieveByUser

func (da InMemoryDataAccess) TokenRetrieveByUser(username string) (rest.Token, error)

TokenRetrieveByUser retrieves the token associated with a username. An error is returned if no such token (or user) exists.

func (InMemoryDataAccess) UserAuthenticate

func (da InMemoryDataAccess) UserAuthenticate(username string, password string) (bool, error)

UserAuthenticate authenticates a username/password combination.

func (InMemoryDataAccess) UserCreate

func (da InMemoryDataAccess) UserCreate(user rest.User) error

UserCreate is used to create a new Cog user in the data store. An error is returned if the username is empty or if a user already exists.

func (InMemoryDataAccess) UserDelete

func (da InMemoryDataAccess) UserDelete(username string) error

UserDelete deletes an existing user from the data store. An error is returned if the username parameter is empty of if the user doesn't exist.

func (InMemoryDataAccess) UserExists

func (da InMemoryDataAccess) UserExists(username string) (bool, error)

UserExists is used to determine whether a Cog user with the given username exists in the data store.

func (InMemoryDataAccess) UserGet

func (da InMemoryDataAccess) UserGet(username string) (rest.User, error)

UserGet returns a user from the data store. An error is returned if the username parameter is empty or if the user doesn't exist.

func (InMemoryDataAccess) UserGroupAdd

func (da InMemoryDataAccess) UserGroupAdd(user string, group string) error

UserGroupAdd comments TBD

func (InMemoryDataAccess) UserGroupDelete

func (da InMemoryDataAccess) UserGroupDelete(user string, group string) error

UserGroupDelete comments TBD

func (InMemoryDataAccess) UserGroupList

func (da InMemoryDataAccess) UserGroupList(user string) ([]rest.Group, error)

UserGroupList comments TBD

func (InMemoryDataAccess) UserList

func (da InMemoryDataAccess) UserList() ([]rest.User, error)

UserList returns a list of all known users in the datastore. Passwords are not included. Nice try.

func (InMemoryDataAccess) UserUpdate

func (da InMemoryDataAccess) UserUpdate(user rest.User) error

UserUpdate is used to update an existing user. An error is returned if the username is empty or if the user doesn't exist. TODO Should we let this create users that don't exist?

Jump to

Keyboard shortcuts

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