rbac

package
v2.1.52 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RootRole  = "root"
	GuestRole = "guest"
)
View Source
const (
	AllAction  = "*"
	ReadAction = "read"
)

Variables

This section is empty.

Functions

func GetAPIGroupName

func GetAPIGroupName(path string) (string, error)

func GetAPIGroupNames

func GetAPIGroupNames(g *gin.Engine) []string

func HTTPMethodToAction

func HTTPMethodToAction(method string) string

func InitRBAC

func InitRBAC(e *casbin.Enforcer, g *gin.Engine, db *gorm.DB) error

func NewEnforcer

func NewEnforcer(gdb *gorm.DB) (*casbin.Enforcer, error)

Types

type Permission

type Permission struct {
	Object string `json:"object" binding:"required"`
	Action string `json:"action" binding:"required,oneof=read *"`
}

func GetPermissions

func GetPermissions(g *gin.Engine) []Permission

Jump to

Keyboard shortcuts

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