rbac

package
v0.8.16 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package rbac 简单的 RBAC 权限规则实现

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteRoleHandle

func DeleteRoleHandle(g *RoleGroup, idName string, ctx *web.Context) web.Responser

DeleteRoleHandle 删除角色

idName 路由地址中表示角色 ID 的参数名称;

func GetResourcesHandle

func GetResourcesHandle(g *RoleGroup, ctx *web.Context) web.Responser

GetResourcesHandle 获取所有的资源信息

func GetRoleResourcesHandle

func GetRoleResourcesHandle(g *RoleGroup, idName string, ctx *web.Context) web.Responser

GetRoleResourcesHandle 获得角色资源

idName 路由地址中表示角色 ID 的参数名称;

func GetRolesHandle

func GetRolesHandle(g *RoleGroup, _ *web.Context) web.Responser

GetRolesHandle 向客户端输出 g 中保存的所有角色列表

func Install

func Install(mod *cmfx.Module)

func PostRolesHandle

func PostRolesHandle(g *RoleGroup, ctx *web.Context) web.Responser

PostRolesHandle 向 g 中添加角色

func PutRoleHandle

func PutRoleHandle(g *RoleGroup, idName string, ctx *web.Context) web.Responser

PutRoleHandle 修改角色信息

idName 路由地址中表示角色 ID 的参数名称;

func PutRoleResourcesHandle

func PutRoleResourcesHandle(g *RoleGroup, idName string, ctx *web.Context) web.Responser

PutRoleResourcesHandle 重新设置权限组的可访问资源

idName 路由地址中表示角色 ID 的参数名称;

Types

type RBAC

type RBAC = rbac.RBAC[int64]

func New

func New(mod *cmfx.Module, f rbac.GetUIDFunc[int64]) *RBAC

New 声明一个以 int64 作为用户唯一 ID 的 RBAC

type ResourceGroup

type ResourceGroup = rbac.ResourceGroup[int64]

type Role

type Role = rbac.Role[int64]

type RoleGroup

type RoleGroup = rbac.RoleGroup[int64]

type RoleTO

type RoleTO struct {
	XMLName struct{} `json:"-" xml:"role" cbor:"-" yaml:"-"`
	Name    string   `json:"name" xml:"name" cbor:"name" yaml:"name" comment:"role name"`
	Desc    string   `json:"description" xml:"description" cbor:"description" yaml:"description" comment:"role description"`
	Parent  string   `json:"parent,omitempty" xml:"parent,attr,omitempty" cbor:"parent,omitempty" yaml:"parent,omitempty" comment:"role parent"`
}

RoleTO 角色信息

func (*RoleTO) Filter

func (r *RoleTO) Filter(v *web.FilterContext)

type RoleVO

type RoleVO struct {
	XMLName struct{} `json:"-" xml:"role" cbor:"-" yaml:"-"`
	ID      string   `json:"id,omitempty" xml:"id,attr,omitempty" cbor:"id,omitempty" yaml:"id,omitempty" comment:"role id"`
	Name    string   `json:"name" xml:"name" cbor:"name" yaml:"name" comment:"role name"`
	Desc    string   `json:"description" xml:"description" cbor:"description" yaml:"description" comment:"role description"`
	Parent  string   `json:"parent,omitempty" xml:"parent,attr,omitempty" cbor:"parent,omitempty" yaml:"parent,omitempty" comment:"role parent"`
}

RoleVO 角色信息

Jump to

Keyboard shortcuts

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