user

package
v0.0.0-...-57b518e Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIncorrectPassword = echo.NewHTTPError(http.StatusBadRequest, "incorrect old password")
	ErrInsecurePassword  = echo.NewHTTPError(http.StatusBadRequest, "insecure password")
)

Custom errors

Functions

This section is empty.

Types

type Service

type Service interface {
	Update(c echo.Context, userUUID uuid.UUID, orgID int, fieldsToUpdate map[string]string) error
	FetchUserByUUID(c echo.Context, userUUID uuid.UUID, orgID int) (*authapi.User, error)
	FetchUserByID(c echo.Context, userID int) (*authapi.User, error)
	FetchByEmail(echo.Context, string) (*authapi.User, error)
	FetchByExternalID(c echo.Context, externalID string) (*authapi.User, error)
	List(c echo.Context, orgID int) ([]authapi.User, error)
	ListRoles(echo.Context) ([]authapi.Role, error)
	UpdateRole(c echo.Context, level int, profileID int) error
}

type User

type User struct {
	// contains filtered or unexported fields
}

func Initialize

func Initialize(db *sqlx.DB) User

Initialize initalizes user service with defaults

func New

func New(db *sqlx.DB, pdb UserDB) User

New creates new user application service

func (User) FetchByEmail

func (u User) FetchByEmail(c echo.Context, email string) (*authapi.User, error)

func (User) FetchByExternalID

func (u User) FetchByExternalID(c echo.Context, externalID string) (*authapi.User, error)

func (User) FetchUserByID

func (u User) FetchUserByID(c echo.Context, userID int) (*authapi.User, error)

func (User) FetchUserByUUID

func (u User) FetchUserByUUID(c echo.Context, userUUID uuid.UUID, orgID int) (*authapi.User, error)

func (User) List

func (u User) List(c echo.Context, orgID int) ([]authapi.User, error)

func (User) ListRoles

func (u User) ListRoles(c echo.Context) ([]authapi.Role, error)

func (User) Update

func (u User) Update(c echo.Context, userUUID uuid.UUID, orgID int, fieldsToUpdate map[string]string) error

func (User) UpdateRole

func (u User) UpdateRole(c echo.Context, level int, profileID int) error

type UserDB

type UserDB interface {
	Update(db sqlx.DB, user authapi.User) error
	FetchUserByUUID(db sqlx.DB, userUUID uuid.UUID, orgID int) (*authapi.User, error)
	FetchByEmail(sqlx.DB, string) (*authapi.User, error)
	FetchByExternalID(db sqlx.DB, externalID string) (*authapi.User, error)
	FetchUserByID(db sqlx.DB, userID int) (*authapi.User, error)
	List(db sqlx.DB, orgID int) ([]authapi.User, error)
	UpdateRole(sqlx.DB, int, int) error
	ListRoles(sqlx.DB) ([]authapi.Role, error)
}

Directories

Path Synopsis
platform

Jump to

Keyboard shortcuts

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