model

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenPassword

func GenPassword() (string, error)

GenPassword generates a new random password

Types

type IntegrationConfig added in v0.0.6

type IntegrationConfig struct {
	ID       string
	Provider string
	Name     string

	// WebDav
	Username string
	Password string
	Address  string

	// Insecure ignore TLS cert errors
	Insecure bool

	// Dropbox
	Accesstoken string

	// Localfs
	//TODO: experimental, security blah blah
	Path string
}

IntegrationConfig config for various integrations

type User

type User struct {
	ID            string
	Email         string
	EmailVerified bool
	Password      string
	Name          string
	Nickname      string
	GivenName     string
	FamilyName    string
	CreatedAt     time.Time
	UpdatedAt     time.Time
	// IsAdmin indicates if the user can managed others users in this instance.
	IsAdmin bool
	// Sync15 if the user should use this sync type (which uses a lot less bandwidth).
	Sync15 bool
	// AdditionalScopes is a list of scopes to add to the user session.
	AdditionalScopes []string
	// Integrations stores the list of "Integrations" as shown on the tablet.
	Integrations []IntegrationConfig
}

User holds the user profile

func DeserializeUser

func DeserializeUser(b []byte) (*User, error)

DeserializeUser deserializes

func NewUser

func NewUser(userID string, rawPassword string) (*User, error)

NewUser create a new user object

func (*User) CheckPassword

func (u *User) CheckPassword(raw string) (bool, error)

CheckPassword checks the password

func (*User) GenID

func (u *User) GenID() (err error)

GenID newid

func (User) Serialize

func (u User) Serialize() ([]byte, error)

Serialize gets a representation

func (*User) SetPassword

func (u *User) SetPassword(raw string) (err error)

SetPassword sets the user password (and hashes it)

Jump to

Keyboard shortcuts

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