user

package
v0.0.0-...-55c8b89 Latest Latest
Warning

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

Go to latest
Published: May 11, 2020 License: BSD-3-Clause Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Form

type Form struct {
	Username string   `schema:"username" json:"username"`
	Email    string   `schema:"email" json:"email"`
	Password string   `schema:"password" json:"password"`
	State    int      `schema:"state" json:"state"`
	Roles    []string `schema:"roles[]" json:"roles"`
	// contains filtered or unexported fields
}

func (*Form) Validate

func (f *Form) Validate() error

type QueryParams

type QueryParams struct {
	api.QueryParams
	Username string `schema:"username" json:"username"`
	Email    string `schema:"email" json:"email"`
	State    int    `schema:"state" json:"state"`
}

func (*QueryParams) ListQueryMods

func (qps *QueryParams) ListQueryMods(limit, offset int) []qm.QueryMod

func (*QueryParams) QueryMods

func (qps *QueryParams) QueryMods() (mods []qm.QueryMod)

func (*QueryParams) Validate

func (qps *QueryParams) Validate() error

type Resource

type Resource struct {
	*api.Application
	// contains filtered or unexported fields
}

func New

func New(
	app *api.Application,
	captchaManager *captchas.Manager,
	jwtManager *core.JWTManager,
	enforcer *casbin.Enforcer,
	service Service,
) *Resource

func (*Resource) RegisterRoutes

func (r *Resource) RegisterRoutes(router clevergo.IRouter)

type Service

type Service interface {
	Count(ctx context.Context, qps *QueryParams) (int64, error)
	Query(ctx context.Context, limit, offset int, qps *QueryParams) (models.UserSlice, error)
	Create(ctx context.Context, form *Form) (*User, error)
	Update(ctx context.Context, id uint64, form *Form) (*User, error)
	Get(ctx context.Context, id uint64) (*User, error)
	Delete(ctx context.Context, id uint64) error
	Logout() error
}

func NewService

func NewService(enforcer *casbin.Enforcer) Service

type User

type User struct {
	models.User
	HashedPassword string   `json:"-"`
	Roles          []string `json:"roles"`
	Permissions    []string `json:"permissions"`
}

Jump to

Keyboard shortcuts

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