sessions

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2019 License: GPL-3.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitSessionManagement

func InitSessionManagement(s sessions.Store, us userDAO)

InitSessionManagement initialize the global Store. Default parameters are nil, anything else is just for testing

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store provides functions to store and get data to the session of a request Don't create your own Store! Better get the global Store via the corresponding function

func GetSessionStore

func GetSessionStore() *Store

GetSessionStore returns a pointer to the session-store

func (*Store) EndFor

func (s *Store) EndFor(w http.ResponseWriter, r *http.Request, u *user.User) error

EndFor removes the user from the session User parameter is not used by now, just for future

func (*Store) GetCurrent

func (s *Store) GetCurrent(r *http.Request) (*user.User, error)

GetCurrent returns the current signed in user to the given request. If the current user is not signed in, the function will return nil, nil If an error occurs nil and the error will be returned

func (*Store) RemoveCurrentCaseProtocol added in v0.10.0

func (s *Store) RemoveCurrentCaseProtocol(w http.ResponseWriter, r *http.Request) error

RemoveCurrentCaseProtocol removes the current case protocol from the session.

func (*Store) SetCurrentCaseProtocol added in v0.10.0

func (s *Store) SetCurrentCaseProtocol(w http.ResponseWriter, r *http.Request,
	protocol *test.CaseExecutionProtocol) error

SetCurrentCaseProtocol saves the given protocol to the session. After this call, you can get the current case protocol via the GetCurrentCaseProtocol-function

func (*Store) StartFor

func (s *Store) StartFor(w http.ResponseWriter, r *http.Request, user *user.User) error

StartFor connects the session of the request with an user. After this call, you can get the user via the GetCurrent-function

type TestStore

type TestStore struct {
	// contains filtered or unexported fields
}

TestStore is a Test-Stub of Session-Store

func (*TestStore) Get

func (s *TestStore) Get(r *http.Request, name string) (*sessions.Session, error)

Get gets the session with given name from given request.

func (*TestStore) New

func (s *TestStore) New(r *http.Request, name string) (*sessions.Session, error)

New creates a new session with given name for given request.

func (*TestStore) Save

func (s *TestStore) Save(r *http.Request, w http.ResponseWriter,
	session *sessions.Session) error

Save saves a session and writes into the response writer.

Jump to

Keyboard shortcuts

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