Documentation ¶
Index ¶
- Constants
- Variables
- func PublicName(db prefixer.Prefixer) (string, error)deprecated
- func SettingsDocument(inst prefixer.Prefixer) (*couchdb.JSONDoc, error)deprecated
- type CouchdbStorage
- type ExternalTies
- type Mock
- func (m *Mock) CancelEmailUpdate(inst *instance.Instance) error
- func (m *Mock) ConfirmEmailUpdate(inst *instance.Instance, tok string) error
- func (m *Mock) GetExternalTies(inst *instance.Instance) (*ExternalTies, error)
- func (m *Mock) GetInstanceSettings(db prefixer.Prefixer) (*couchdb.JSONDoc, error)
- func (m *Mock) PublicName(db prefixer.Prefixer) (string, error)
- func (m *Mock) ResendEmailUpdate(inst *instance.Instance) error
- func (m *Mock) SetInstanceSettings(db prefixer.Prefixer, doc *couchdb.JSONDoc) error
- func (m *Mock) StartEmailUpdate(inst *instance.Instance, cmd *UpdateEmailCmd) error
- type Service
- type SettingsService
- func (s *SettingsService) CancelEmailUpdate(inst *instance.Instance) error
- func (s *SettingsService) ConfirmEmailUpdate(inst *instance.Instance, tok string) error
- func (s *SettingsService) GetExternalTies(inst *instance.Instance) (*ExternalTies, error)
- func (s *SettingsService) GetInstanceSettings(db prefixer.Prefixer) (*couchdb.JSONDoc, error)
- func (s *SettingsService) PublicName(db prefixer.Prefixer) (string, error)
- func (s *SettingsService) ResendEmailUpdate(inst *instance.Instance) error
- func (s *SettingsService) SetInstanceSettings(db prefixer.Prefixer, doc *couchdb.JSONDoc) error
- func (s *SettingsService) StartEmailUpdate(inst *instance.Instance, cmd *UpdateEmailCmd) error
- type Storage
- type UpdateEmailCmd
Constants ¶
const TokenExpiration = 7 * 24 * time.Hour
Variables ¶
Functions ¶
func PublicName
deprecated
Types ¶
type CouchdbStorage ¶
type CouchdbStorage struct { }
CouchdbStorage handle all the settings data in couchdb.
func NewCouchdbStorage ¶
func NewCouchdbStorage() *CouchdbStorage
NewCouchdbStorage instantiates a new CouchdbStorage.
type ExternalTies ¶
type ExternalTies struct { HasBlockingSubscription bool `json:"has_blocking_subscription"` BlockingSubscription *cloudery.BlockingSubscription `json:"blocking_subscription,omitempty"` }
type Mock ¶
Mock implementation of Service.
func NewServiceMock ¶
NewServiceMock instantiates a new Mock.
func (*Mock) CancelEmailUpdate ¶
CancelEmailUpdate mock method.
func (*Mock) ConfirmEmailUpdate ¶
ConfirmEmailUpdate mock method.
func (*Mock) GetExternalTies ¶
func (m *Mock) GetExternalTies(inst *instance.Instance) (*ExternalTies, error)
func (*Mock) GetInstanceSettings ¶
GetInstanceSettings mock method.
func (*Mock) PublicName ¶
PublicName mock method.
func (*Mock) ResendEmailUpdate ¶
ResendEmailUpdate mock method.
func (*Mock) SetInstanceSettings ¶
SetInstanceSettings mock method.
func (*Mock) StartEmailUpdate ¶
func (m *Mock) StartEmailUpdate(inst *instance.Instance, cmd *UpdateEmailCmd) error
StartEmailUpdate mock method.
type Service ¶
type Service interface { PublicName(db prefixer.Prefixer) (string, error) GetInstanceSettings(inst prefixer.Prefixer) (*couchdb.JSONDoc, error) SetInstanceSettings(inst prefixer.Prefixer, doc *couchdb.JSONDoc) error StartEmailUpdate(inst *instance.Instance, cmd *UpdateEmailCmd) error ResendEmailUpdate(inst *instance.Instance) error ConfirmEmailUpdate(inst *instance.Instance, tok string) error CancelEmailUpdate(inst *instance.Instance) error GetExternalTies(inst *instance.Instance) (*ExternalTies, error) }
type SettingsService ¶
type SettingsService struct {
// contains filtered or unexported fields
}
SettingsService handle the business logic around "settings".
This service handle 2 structured documents present in consts.Settings - The "instance settings" (consts.InstanceSettingsID) - The "bitwarden settings" (consts.BitwardenSettingsID) (#TODO)
func NewService ¶
func NewService( emailer emailer.Emailer, instance instance.Service, token token.Service, cloudery cloudery.Service, storage Storage, ) *SettingsService
NewService instantiates a new SettingsService.
func (*SettingsService) CancelEmailUpdate ¶
func (s *SettingsService) CancelEmailUpdate(inst *instance.Instance) error
CancelEmailUpdate cancel any ongoing email update process
If no process is ongoin it's a no-op.
func (*SettingsService) ConfirmEmailUpdate ¶
func (s *SettingsService) ConfirmEmailUpdate(inst *instance.Instance, tok string) error
ConfirmEmailUpdate is the second step to the email update process.
This step consiste to make the email change effectif and relay the change into the cloudery.
func (*SettingsService) GetExternalTies ¶
func (s *SettingsService) GetExternalTies(inst *instance.Instance) (*ExternalTies, error)
func (*SettingsService) GetInstanceSettings ¶
GetInstanceSettings allows for fetch directly the consts.InstanceSettingsID couchdb document.
func (*SettingsService) PublicName ¶
func (s *SettingsService) PublicName(db prefixer.Prefixer) (string, error)
PublicName returns the settings' public name or a default one if missing
func (*SettingsService) ResendEmailUpdate ¶
func (s *SettingsService) ResendEmailUpdate(inst *instance.Instance) error
ResendEmailUpdate will resend the validation email.
func (*SettingsService) SetInstanceSettings ¶
SetInstanceSettings allows a set directly the consts.InstanceSettingsID couchdb document.
func (*SettingsService) StartEmailUpdate ¶
func (s *SettingsService) StartEmailUpdate(inst *instance.Instance, cmd *UpdateEmailCmd) error
StartEmailUpdate will start the email updating process.
This process consists of validating the user with a password and sending a validation email to the new address with a validation link. This link will allow the user to confirm its email.
type Storage ¶
type Storage interface {
// contains filtered or unexported methods
}
Storage used to persiste and fetch settings data.