Documentation
¶
Overview ¶
Package usersettings owns per-user preferences: the console's look and locale, and which workspace a client lands on when it has none in mind. It is deliberately separate from the account package, which handles account lifecycle rather than taste.
Index ¶
- Variables
- func ValidTimezone(tz string) bool
- type BrandAccent
- type Members
- type Service
- func (s *Service) AdoptFirstWorkspace(userID, workspaceID uint)
- func (s *Service) DefaultWorkspace(userID uint) (*models.WorkspaceWithRole, error)
- func (s *Service) Get(userID uint) (*models.UserSetting, error)
- func (s *Service) Save(userID uint, in Update) (*models.UserSetting, error)
- func (s *Service) SetBrandAccent(f BrandAccent)
- func (s *Service) SetDefaultWorkspace(userID uint, workspaceID *uint) error
- type Settings
- type Update
- type Users
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotMember = errors.New("you are not a member of this workspace") ErrInvalidTheme = errors.New("theme must be one of: system, light, dark") ErrInvalidAccent = errors.New("accent must be one of: default, blue, indigo, slate, orange, lime") ErrInvalidLocale = fmt.Errorf("locale must be one of: %s", strings.Join(models.Locales(), ", ")) ErrInvalidLandingView = errors.New("landing view is not a known console section") ErrInvalidTimezone = errors.New("timezone must be an IANA time zone name, such as Europe/Paris") ErrAccentLocked = errors.New("the accent is set by your organization") )
Functions ¶
func ValidTimezone ¶ added in v1.10.15
ValidTimezone reports whether tz is an IANA time zone name the server's tz database knows. "Local" is refused: it names the server's zone, not the user's.
Types ¶
type BrandAccent ¶ added in v1.9.6
BrandAccent supplies the operator's accent and whether it is enforced on every account. A function rather than the branding service itself, so preferences do not depend on branding — the arrow points one way.
type Members ¶
type Members interface {
FindMember(workspaceID, userID uint) (*models.WorkspaceMember, error)
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) AdoptFirstWorkspace ¶
func (*Service) DefaultWorkspace ¶
func (s *Service) DefaultWorkspace(userID uint) (*models.WorkspaceWithRole, error)
func (*Service) Get ¶
func (s *Service) Get(userID uint) (*models.UserSetting, error)
Get returns a user's preferences, defaulted when they have never saved any.
func (*Service) SetBrandAccent ¶ added in v1.9.6
func (s *Service) SetBrandAccent(f BrandAccent)
SetBrandAccent wires the operator default (nil-safe: unset means Miabi's own).
type Settings ¶
type Settings interface {
Get(userID uint) (*models.UserSetting, error)
Save(s *models.UserSetting) error
}