manager

package
v2.24.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
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 site 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

func (mngr *AccountsManager) FindAccount(by string, value string) (*data.Account, error)

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) GrantSiteAccess added in v2.3.0

func (mngr *AccountsManager) GrantSiteAccess(accountData *data.Account, grantAccess bool) error

GrantSiteAccess sets the Site 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 SitesManager added in v2.3.0

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

SitesManager is responsible for all sites related tasks.

func NewSitesManager added in v2.3.0

func NewSitesManager(storage data.Storage, conf *config.Configuration, log *zerolog.Logger) (*SitesManager, error)

NewSitesManager creates a new sites manager instance.

func (*SitesManager) CloneSites added in v2.3.0

func (mngr *SitesManager) CloneSites(eraseCredentials bool) data.Sites

CloneSites retrieves all sites currently stored by cloning the data, thus avoiding race conflicts and making outside modifications impossible.

func (*SitesManager) FindSite added in v2.3.0

func (mngr *SitesManager) FindSite(id string) *data.Site

FindSite returns the site specified by the ID if one exists.

func (*SitesManager) GetSite added in v2.3.0

func (mngr *SitesManager) GetSite(id string, cloneSite bool) (*data.Site, error)

GetSite retrieves the site with the given ID, creating it first if necessary.

func (*SitesManager) UpdateSite added in v2.3.0

func (mngr *SitesManager) UpdateSite(siteData *data.Site) error

UpdateSite updates the site identified by the site ID; if no such site 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, sitesManager *SitesManager, 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

func (mngr *UsersManager) VerifyUserToken(token string, user string, scope string) (string, error)

VerifyUserToken is used to verify a user token against the current session.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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