authz

package
v0.0.0-...-5e9aa0f Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Form

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

func (*Form) Validate

func (f *Form) Validate() error

type Permission

type Permission struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

type QueryParams

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

func (QueryParams) Validate

func (qp QueryParams) Validate() error

type Resource

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

func New

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

func (*Resource) RegisterRoutes

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

type Role

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

type Service

type Service interface {
	Count() (uint64, error)
	Query(limit, offset uint64, qps *QueryParams) ([]rbac.Item, error)
	Get(id string) (*Role, error)
	Create(form *Form) (*Role, error)
	Delete(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