mock

package
v0.0.0-...-2fc7590 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GinCtxWithKeys

func GinCtxWithKeys(keys []string, values ...interface{}) *gin.Context

GinCtxWithKeys returns new gin context with keys

func HeaderInvalid

func HeaderInvalid() string

HeaderInvalid is used for jwt testing

func HeaderValid

func HeaderValid() string

HeaderValid is used for jwt testing

func Str2Ptr

func Str2Ptr(s string) *string

Str2Ptr converts string to pointer

func TestTime

func TestTime(year int) time.Time

TestTime is used for testing time fields

func TestTimePtr

func TestTimePtr(year int) *time.Time

TestTimePtr is used for testing pointer time fields

Types

type Auth

type Auth struct {
	UserFn func(*gin.Context) *model.AuthUser
}

Auth mock

func (*Auth) User

func (a *Auth) User(c *gin.Context) *model.AuthUser

User mock

type JWT

type JWT struct {
	GenerateTokenFn func(*model.User) (string, string, error)
}

JWT mock

func (*JWT) GenerateToken

func (j *JWT) GenerateToken(u *model.User) (string, string, error)

GenerateToken mock

type RBAC

type RBAC struct {
	EnforceRoleFn     func(*gin.Context, model.AccessRole) bool
	EnforceUserFn     func(*gin.Context, int) bool
	EnforceCompanyFn  func(*gin.Context, int) bool
	EnforceLocationFn func(*gin.Context, int) bool
	AccountCreateFn   func(*gin.Context, int, int, int) bool
	IsLowerRoleFn     func(*gin.Context, model.AccessRole) bool
}

RBAC Mock

func (*RBAC) AccountCreate

func (a *RBAC) AccountCreate(c *gin.Context, roleID, companyID, locationID int) bool

AccountCreate mock

func (*RBAC) EnforceCompany

func (a *RBAC) EnforceCompany(c *gin.Context, id int) bool

EnforceCompany mock

func (*RBAC) EnforceLocation

func (a *RBAC) EnforceLocation(c *gin.Context, id int) bool

EnforceLocation mock

func (*RBAC) EnforceRole

func (a *RBAC) EnforceRole(c *gin.Context, role model.AccessRole) bool

EnforceRole mock

func (*RBAC) EnforceUser

func (a *RBAC) EnforceUser(c *gin.Context, id int) bool

EnforceUser mock

func (*RBAC) IsLowerRole

func (a *RBAC) IsLowerRole(c *gin.Context, role model.AccessRole) bool

IsLowerRole mock

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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