Documentation ¶
Index ¶
- Constants
- type AccountsListener
- type AccountsListenerCallback
- type AccountsManager
- func (mngr *AccountsManager) CloneAccounts(erasePasswords bool) data.Accounts
- func (mngr *AccountsManager) ConfigureAccount(accountData *data.Account) error
- func (mngr *AccountsManager) CreateAccount(accountData *data.Account) error
- func (mngr *AccountsManager) FindAccount(by string, value string) (*data.Account, error)
- func (mngr *AccountsManager) FindAccountEx(by string, value string, cloneAccount bool) (*data.Account, error)
- func (mngr *AccountsManager) GrantGOCDBAccess(accountData *data.Account, grantAccess bool) error
- func (mngr *AccountsManager) GrantSitesAccess(accountData *data.Account, grantAccess bool) error
- func (mngr *AccountsManager) RemoveAccount(accountData *data.Account) error
- func (mngr *AccountsManager) ResetPassword(name string) error
- func (mngr *AccountsManager) SendContactForm(account *data.Account, subject, message string)
- func (mngr *AccountsManager) UpdateAccount(accountData *data.Account, setPassword bool, copyData bool) error
- type OperatorsManager
- func (mngr *OperatorsManager) CloneOperators(eraseCredentials bool) data.Operators
- func (mngr *OperatorsManager) FindOperator(id string) *data.Operator
- func (mngr *OperatorsManager) FindSite(id string) (*data.Operator, *data.Site)
- func (mngr *OperatorsManager) GetOperator(id string, clone bool) (*data.Operator, error)
- func (mngr *OperatorsManager) UpdateOperator(opData *data.Operator) error
- type UsersManager
Constants ¶
const (
// FindByEmail holds the string value of the corresponding search criterium.
FindByEmail = "email"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountsListener ¶
type AccountsListener interface { // AccountCreated is called whenever an account was created. AccountCreated(account *data.Account) // AccountUpdated is called whenever an account was updated. AccountUpdated(account *data.Account) // AccountRemoved is called whenever an account was removed. AccountRemoved(account *data.Account) }
AccountsListener is an interface that listens to accounts events.
type AccountsListenerCallback ¶
type AccountsListenerCallback = func(AccountsListener, *data.Account)
AccountsListenerCallback is the generic function type for accounts listeners.
type AccountsManager ¶
type AccountsManager struct {
// contains filtered or unexported fields
}
AccountsManager is responsible for all sites account related tasks.
func NewAccountsManager ¶
func NewAccountsManager(storage data.Storage, conf *config.Configuration, log *zerolog.Logger) (*AccountsManager, error)
NewAccountsManager creates a new accounts manager instance.
func (*AccountsManager) CloneAccounts ¶
func (mngr *AccountsManager) CloneAccounts(erasePasswords bool) data.Accounts
CloneAccounts retrieves all accounts currently stored by cloning the data, thus avoiding race conflicts and making outside modifications impossible.
func (*AccountsManager) ConfigureAccount ¶
func (mngr *AccountsManager) ConfigureAccount(accountData *data.Account) error
ConfigureAccount configures the account identified by the account email; if no such account exists, an error is returned.
func (*AccountsManager) CreateAccount ¶
func (mngr *AccountsManager) CreateAccount(accountData *data.Account) error
CreateAccount creates a new account; if an account with the same email address already exists, an error is returned.
func (*AccountsManager) FindAccount ¶
FindAccount is used to find an account by various criteria. The account is cloned to prevent data changes.
func (*AccountsManager) FindAccountEx ¶
func (mngr *AccountsManager) FindAccountEx(by string, value string, cloneAccount bool) (*data.Account, error)
FindAccountEx is used to find an account by various criteria and optionally clone the account.
func (*AccountsManager) GrantGOCDBAccess ¶
func (mngr *AccountsManager) GrantGOCDBAccess(accountData *data.Account, grantAccess bool) error
GrantGOCDBAccess sets the GOCDB access status of the account identified by the account email; if no such account exists, an error is returned.
func (*AccountsManager) GrantSitesAccess ¶ added in v0.0.14
func (mngr *AccountsManager) GrantSitesAccess(accountData *data.Account, grantAccess bool) error
GrantSitesAccess sets the Sites access status of the account identified by the account email; if no such account exists, an error is returned.
func (*AccountsManager) RemoveAccount ¶
func (mngr *AccountsManager) RemoveAccount(accountData *data.Account) error
RemoveAccount removes the account identified by the account email; if no such account exists, an error is returned.
func (*AccountsManager) ResetPassword ¶
func (mngr *AccountsManager) ResetPassword(name string) error
ResetPassword resets the password for the given user.
func (*AccountsManager) SendContactForm ¶
func (mngr *AccountsManager) SendContactForm(account *data.Account, subject, message string)
SendContactForm sends a generic email to the ScienceMesh admins.
func (*AccountsManager) UpdateAccount ¶
func (mngr *AccountsManager) UpdateAccount(accountData *data.Account, setPassword bool, copyData bool) error
UpdateAccount updates the account identified by the account email; if no such account exists, an error is returned.
type OperatorsManager ¶ added in v0.0.14
type OperatorsManager struct {
// contains filtered or unexported fields
}
OperatorsManager is responsible for all sites related tasks.
func NewOperatorsManager ¶ added in v0.0.14
func NewOperatorsManager(storage data.Storage, conf *config.Configuration, log *zerolog.Logger) (*OperatorsManager, error)
NewOperatorsManager creates a new operators manager instance.
func (*OperatorsManager) CloneOperators ¶ added in v0.0.14
func (mngr *OperatorsManager) CloneOperators(eraseCredentials bool) data.Operators
CloneOperators retrieves all operators currently stored by cloning the data, thus avoiding race conflicts and making outside modifications impossible.
func (*OperatorsManager) FindOperator ¶ added in v0.0.14
func (mngr *OperatorsManager) FindOperator(id string) *data.Operator
FindOperator returns the operator specified by the ID if one exists.
func (*OperatorsManager) FindSite ¶ added in v0.0.14
FindSite returns the site specified by the ID if one exists.
func (*OperatorsManager) GetOperator ¶ added in v0.0.14
GetOperator retrieves the operator with the given ID, creating it first if necessary.
func (*OperatorsManager) UpdateOperator ¶ added in v0.0.14
func (mngr *OperatorsManager) UpdateOperator(opData *data.Operator) error
UpdateOperator updates the operator identified by the ID; if no such operator exists, one will be created first.
type UsersManager ¶
type UsersManager struct {
// contains filtered or unexported fields
}
UsersManager is responsible for managing logged in users through session objects.
func NewUsersManager ¶
func NewUsersManager(conf *config.Configuration, log *zerolog.Logger, opsManager *OperatorsManager, accountsManager *AccountsManager) (*UsersManager, error)
NewUsersManager creates a new users manager instance.
func (*UsersManager) LoginUser ¶
func (mngr *UsersManager) LoginUser(name, password string, scope string, session *html.Session) (string, error)
LoginUser tries to login a given username/password pair. On success, the corresponding user account is stored in the session and a user token is returned.
func (*UsersManager) LogoutUser ¶
func (mngr *UsersManager) LogoutUser(session *html.Session)
LogoutUser logs the current user out.
func (*UsersManager) VerifyUserToken ¶
VerifyUserToken is used to verify a user token against the current session.