policy

package
v0.0.0-...-ac3b76c Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONF_PATH     = "configs/casbin"
	RBAC_DEFAULT  = "rbac_default"
	RBAC_DOMAINS  = "rbac_domains"
	RBAC_RESOURCE = "rbac_resource_roles"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CasbinService

type CasbinService struct {
	Type      string   // 规则类型
	DB        *gorm.DB // 数据库句柄
	Prefix    string   // 自定义表前缀
	TableName string   // 自定义表名
}

func (*CasbinService) AddPolicy

func (c *CasbinService) AddPolicy(rivals ...interface{}) bool

AddPolicy 添加策略 sub(角色), obj(路径), act(方法)

func (*CasbinService) Checked

func (c *CasbinService) Checked(rivals ...interface{}) bool

Checked 策略验证 sub(角色), obj(路径), act(方法)

func (*CasbinService) Init

func (c *CasbinService) Init()

init 自动初始化

func (*CasbinService) RemovePolicy

func (c *CasbinService) RemovePolicy(rivals ...interface{}) bool

RemovePolicy 删除策略 sub(角色), obj(路径), act(方法)

Jump to

Keyboard shortcuts

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