usermodel

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadAuth = errors.New("Authentication incorrect")

ErrBadAuth is returned when a user name / passwordcombintaion is incorrect

View Source
var ErrEmailExists = errors.New("Email exists")

ErrEmailExists is self-explanatory

Functions

This section is empty.

Types

type UserModel

type UserModel struct {
	DB *domain.DB
	// contains filtered or unexported fields
}

UserModel represents the model for app

func (*UserModel) Create

func (m *UserModel) Create(email, password string) (domain.User, error)

Create creates a new user

func (*UserModel) DeleteAdmin

func (m *UserModel) DeleteAdmin(userID domain.UserID) error

DeleteAdmin removes the user id from the tableof admin users for this server.

func (*UserModel) GetAll

func (m *UserModel) GetAll() ([]domain.User, error)

GetAll returns all users.

func (*UserModel) GetAllAdmins

func (m *UserModel) GetAllAdmins() ([]domain.UserID, error)

GetAllAdmins returns the list of user ids that are admins

func (*UserModel) GetFromEmail

func (m *UserModel) GetFromEmail(email string) (domain.User, error)

GetFromEmail returns a user it retunrs sql.ErrNoRows if not found

func (*UserModel) GetFromEmailPassword

func (m *UserModel) GetFromEmailPassword(email, password string) (domain.User, error)

GetFromEmailPassword is the proverbial authentication function

func (*UserModel) GetFromID

func (m *UserModel) GetFromID(userID domain.UserID) (domain.User, error)

GetFromID returns a user it retunrs sql.ErrNoRows if not found

func (*UserModel) IsAdmin

func (m *UserModel) IsAdmin(userID domain.UserID) bool

IsAdmin tells you if the user is an admin on DropServer

func (*UserModel) MakeAdmin

func (m *UserModel) MakeAdmin(userID domain.UserID) error

MakeAdmin adds the user_id to the table of DropServer admin users

func (*UserModel) PrepareStatements

func (m *UserModel) PrepareStatements()

PrepareStatements prepares the statements

func (*UserModel) UpdatePassword

func (m *UserModel) UpdatePassword(userID domain.UserID, password string) error

UpdatePassword updates the password for the user.

Jump to

Keyboard shortcuts

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