Documentation ¶
Index ¶
- Constants
- type AccountsListener
- type AccountsListenerCallback
- type AccountsManager
- func (mngr *AccountsManager) AssignAPIKeyToAccount(accountData *data.Account, flags int) error
- func (mngr *AccountsManager) AuthorizeAccount(accountData *data.Account, authorized bool) error
- 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) 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) UnregisterAccountSite(accountData *data.Account) error
- func (mngr *AccountsManager) UpdateAccount(accountData *data.Account, setPassword bool, copyData bool) error
- type UsersManager
Constants ¶
const ( // FindByEmail holds the string value of the corresponding search criterium. FindByEmail = "email" // FindByAPIKey holds the string value of the corresponding search criterium. FindByAPIKey = "apikey" // FindBySiteID holds the string value of the corresponding search criterium. FindBySiteID = "siteid" )
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 site account related tasks.
func NewAccountsManager ¶
func NewAccountsManager(conf *config.Configuration, log *zerolog.Logger) (*AccountsManager, error)
NewAccountsManager creates a new accounts manager instance.
func (*AccountsManager) AssignAPIKeyToAccount ¶
func (mngr *AccountsManager) AssignAPIKeyToAccount(accountData *data.Account, flags int) error
AssignAPIKeyToAccount is used to assign a new API key to the account identified by the account email; if no such account exists, an error is returned.
func (*AccountsManager) AuthorizeAccount ¶
func (mngr *AccountsManager) AuthorizeAccount(accountData *data.Account, authorized bool) error
AuthorizeAccount sets the authorization status of the account identified by the account email; if no such account exists, an error is returned.
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) 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) UnregisterAccountSite ¶
func (mngr *AccountsManager) UnregisterAccountSite(accountData *data.Account) error
UnregisterAccountSite unregisters the site associated with the given account.
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 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, 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.