user

package
v0.0.0-...-1d800d4 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuditLogOperationChangePrimaryEmail = "change-primary-email"
	AuditLogOperationClearSessions      = "clear-sessions"
	AuditLogOperationLogin              = "login"
	AuditLogOperationResetPassword      = "reset-password"
	AuditLogOperationUpdatePassword     = "update-password"
	AuditLogOperationSoftDeletion       = "soft-deletion"
	AuditLogOperationCreateAccount      = "create-account"
)
View Source
const (
	AnonymousUserEpoch = 1
)

Variables

View Source
var DefaultEditorConfig = EditorConfig{
	AutoComplete:       true,
	AutoPairDelimiters: true,
	FontFamily:         editorFontFamilyLucida,
	FontSize:           12,
	LineHeight:         editorLineHightNormal,
	Mode:               editorModeDefault,
	OverallTheme:       editorOverallThemeNone,
	PDFViewer:          editorPdfViewerPdfjs,
	SyntaxValidation:   true,
	SpellCheckLanguage: "en",
	Theme:              "textmate",
}
View Source
var EditorThemes = []string{
	"ambiance",
	"chaos",
	"chrome",
	"clouds",
	"clouds_midnight",
	"cobalt",
	"crimson_editor",
	"dawn",
	"dracula",
	"dreamweaver",
	"eclipse",
	"github",
	"gob",
	"gruvbox",
	"idle_fingers",
	"iplastic",
	"katzenmilch",
	"kr_theme",
	"kuroir",
	"merbivore",
	"merbivore_soft",
	"mono_industrial",
	"monokai",
	"overleaf",
	"pastel_on_dark",
	"solarized_dark",
	"solarized_light",
	"sqlserver",
	"terminal",
	"textmate",
	"tomorrow",
	"tomorrow_night",
	"tomorrow_night_blue",
	"tomorrow_night_bright",
	"tomorrow_night_eighties",
	"twilight",
	"vibrant_ink",
	"xcode",
}

EditorThemes lists all the available theme names for the editor.

View Source
var ErrEmailAlreadyRegistered = &errors.InvalidStateError{
	Msg: "email already registered",
}
View Source
var ErrEpochChanged = &errors.InvalidStateError{Msg: "user epoch changed"}

Functions

This section is empty.

Types

type AlphaProgramField

type AlphaProgramField struct {
	AlphaProgram bool `json:"alphaProgram"`
}

type AsProjectMember

type AsProjectMember struct {
	WithPublicInfo
	PrivilegeLevel sharedTypes.PrivilegeLevel `json:"privileges"`
}

type AuditLogEntry

type AuditLogEntry struct {
	CreatedAt   time.Time
	Info        interface{}
	InitiatorId sharedTypes.UUID
	IPAddress   string
	Operation   string
}

type AuditLogField

type AuditLogField struct {
	AuditLog []AuditLogEntry
}

type BetaProgramField

type BetaProgramField struct {
	BetaProgram bool `json:"betaProgram"`
}

type BulkFetched

type BulkFetched []WithPublicInfo

func (BulkFetched) Get

func (BulkFetched) GetUserNonStandardId

func (b BulkFetched) GetUserNonStandardId(uuid sharedTypes.UUID) WithPublicInfoAndNonStandardId

func (*BulkFetched) ScanFrom

func (b *BulkFetched) ScanFrom(r pgx.Rows) error

type CreatedAtField

type CreatedAtField struct {
	CreatedAt time.Time
}

type EditorConfig

type EditorConfig struct {
	FontFamily         string                           `json:"fontFamily"`
	FontSize           int64                            `json:"fontSize"`
	LineHeight         string                           `json:"lineHeight"`
	Mode               string                           `json:"mode"`
	OverallTheme       string                           `json:"overallTheme"`
	PDFViewer          string                           `json:"pdfViewer"`
	SpellCheckLanguage spellingTypes.SpellCheckLanguage `json:"spellCheckLanguage"`
	Theme              string                           `json:"theme"`
	SyntaxValidation   bool                             `json:"syntaxValidation"`
	AutoComplete       bool                             `json:"autoComplete"`
	AutoPairDelimiters bool                             `json:"autoPairDelimiters"`
}

func (*EditorConfig) Validate

func (e *EditorConfig) Validate() error

type EditorConfigField

type EditorConfigField struct {
	EditorConfig EditorConfig `json:"ace"`
}

type EmailConfirmedAtField

type EmailConfirmedAtField struct {
	EmailConfirmedAt *time.Time `json:"emailConfirmedAt"`
}

type EmailDetails

type EmailDetails struct {
	ConfirmedAt *time.Time        `json:"confirmedAt"`
	Email       sharedTypes.Email `json:"email"`
}

type EmailDetailsWithDefaultFlag

type EmailDetailsWithDefaultFlag struct {
	EmailDetails
	IsDefault bool `json:"default"`
}

type EmailField

type EmailField struct {
	Email sharedTypes.Email `json:"email"`
}

type EmailsField

type EmailsField struct {
	Emails []EmailDetails `json:"emails"`
}

type EpochField

type EpochField struct {
	Epoch int64 `json:"epoch"`
}

type Features

type Features struct {
	Collaborators  int                        `json:"collaborators,omitempty"`
	CompileTimeout sharedTypes.ComputeTimeout `json:"compileTimeout"`
	CompileGroup   sharedTypes.CompileGroup   `json:"compileGroup"`
	Versioning     bool                       `json:"versioning,omitempty"`
}

type FeaturesField

type FeaturesField struct {
	Features Features `json:"features"`
}

type FirstNameField

type FirstNameField struct {
	FirstName string `json:"first_name"`
}

type ForActivateUserPage

type ForActivateUserPage struct {
	EmailField
	LoginCountField
}

type ForEmailChange

type ForEmailChange struct {
	EmailField
	EpochField
	IdField
}

type ForPasswordChange

type ForPasswordChange struct {
	WithPublicInfo
	EpochField
	HashedPasswordField
}

type ForSession

type ForSession struct {
	EpochField
	WithPublicInfo
}

type ForSettingsPage

type ForSettingsPage struct {
	WithPublicInfo
	BetaProgramField
}

type HashedPasswordField

type HashedPasswordField struct {
	HashedPassword string `json:"-"`
}

type IdField

type IdField struct {
	Id sharedTypes.UUID `json:"_id"`
}

type LastLoggedInField

type LastLoggedInField struct {
	LastLoggedIn *time.Time
}

type LastLoginIpField

type LastLoginIpField struct {
	LastLoginIp string
}

type LastNameField

type LastNameField struct {
	LastName string `json:"last_name"`
}

type LearnedWordsField

type LearnedWordsField struct {
	LearnedWords []string `json:"learnedWords"`
}

type LoginCountField

type LoginCountField struct {
	LoginCount int64
}

type Manager

type Manager interface {
	CreateUser(ctx context.Context, u *ForCreation) error
	SoftDelete(ctx context.Context, userId sharedTypes.UUID, ip string) error
	HardDelete(ctx context.Context, userId sharedTypes.UUID) error
	ProcessSoftDeleted(ctx context.Context, cutOff time.Time, fn func(userId sharedTypes.UUID) bool) error
	TrackClearSessions(ctx context.Context, userId sharedTypes.UUID, ip string, info interface{}) error
	BumpEpoch(ctx context.Context, userId sharedTypes.UUID) error
	CheckEmailAlreadyRegistered(ctx context.Context, email sharedTypes.Email) error
	GetUser(ctx context.Context, userId sharedTypes.UUID, target interface{}) error
	GetUserByEmail(ctx context.Context, email sharedTypes.Email, target interface{}) error
	GetContacts(ctx context.Context, userId sharedTypes.UUID) ([]WithPublicInfo, error)
	SetBetaProgram(ctx context.Context, userId sharedTypes.UUID, joined bool) error
	UpdateEditorConfig(ctx context.Context, userId sharedTypes.UUID, config EditorConfig) error
	TrackLogin(ctx context.Context, userId sharedTypes.UUID, epoch int64, ip string) error
	ChangeEmailAddress(ctx context.Context, change ForEmailChange, ip string, newEmail sharedTypes.Email) error
	SetUserName(ctx context.Context, userId sharedTypes.UUID, u WithNames) error
	ChangePassword(ctx context.Context, change ForPasswordChange, ip, operation string, newHashedPassword string) error
	DeleteDictionary(ctx context.Context, userId sharedTypes.UUID) error
	LearnWord(ctx context.Context, userId sharedTypes.UUID, word string) error
	UnlearnWord(ctx context.Context, userId sharedTypes.UUID, word string) error
	GetByPasswordResetToken(ctx context.Context, token oneTimeToken.OneTimeToken, u *ForPasswordChange) error
}

func New

func New(db *pgxpool.Pool) Manager

type MustReconfirmField

type MustReconfirmField struct {
	MustReconfirm bool
}

type ProjectListViewCaller

type ProjectListViewCaller struct {
	WithPublicInfoAndNonStandardId
	EmailConfirmedAtField
}

func (*ProjectListViewCaller) ToUserEmails

type WithNames

type WithNames struct {
	FirstNameField
	LastNameField
}

type WithPublicInfo

type WithPublicInfo struct {
	EmailField
	FirstNameField
	IdField
	LastNameField
}

func (*WithPublicInfo) DisplayName

func (u *WithPublicInfo) DisplayName() string

type WithPublicInfoAndFeatures

type WithPublicInfoAndFeatures struct {
	FeaturesField
	WithPublicInfo
}

type WithPublicInfoAndNonStandardId

type WithPublicInfoAndNonStandardId struct {
	WithPublicInfo
	IdNoUnderscore sharedTypes.UUID `json:"id"`
}

Jump to

Keyboard shortcuts

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