role

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: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Form

type Form struct {
	ID          string   `schema:"id" json:"id"`
	Name        string   `schema:"name" json:"name"`
	Permissions []string `schema:"permissions[]" json:"permissions"`
	Roles       []string `schema:"roles[]" json:"roles"`
	// contains filtered or unexported fields
}

func (*Form) Validate

func (f *Form) Validate() error

type QueryParams

type QueryParams struct {
	Name    string   `json:"name"`
	Exclude []string `json:"exclude[]"`
}

func (*QueryParams) ListQueryMods

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

func (*QueryParams) QueryMods

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

func (*QueryParams) Validate

func (qps *QueryParams) Validate() error

type Resource

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

func New

func New(enforcer *casbin.Enforcer, service Service) *Resource

func (*Resource) RegisterRoutes

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

type Role

type Role struct {
	models.AuthItem
	Permissions []string `json:"permissions"`
	Roles       []string `json:"roles"`
}

type Service

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

func NewService

func NewService(db *sqlex.DB, enforcer *casbin.Enforcer) Service

Jump to

Keyboard shortcuts

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