permission

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgNoPermission         = "权限验证未通过 (您当前无操作权限). "
	MsgInvalidPmsRoleType   = "权限角色类型非法. "
	MsgInvalidReqObjectType = "权限验证对象非法. "
	MsgInvalidReqDomType    = "无效的权限验证域. "
	MsgNeedRoot             = "需要root超级管理员权限. "
	MsgSysLocked            = "系统维护中... "
)

Variables

View Source
var Manager *pms

Functions

func InitManager

func InitManager()

Types

type Config

type Config struct {
	ResFilePath string
}

type Domain4Fe

type Domain4Fe []string

func Trans2Domain4Fe

func Trans2Domain4Fe(domType string, domId int) Domain4Fe

func (Domain4Fe) GetDomainTypeAndId

func (df Domain4Fe) GetDomainTypeAndId() (domType string, domId int, err error)

func (*Domain4Fe) ToString

func (df *Domain4Fe) ToString() string

type DomainLockOrUnlockEventMetadata

type DomainLockOrUnlockEventMetadata struct {
	TgtDomainType       PmsDomainType4Lock `json:"tgtDomainType"`
	TgtDomainId         int                `json:"tgtDomainId,omitempty"`
	TgtDomainNameDetail string             `json:"tgtDomainNameDetail"` // 目标Domain对象的详尽名称
	PerformedOperation  string             `json:"performedOperation"`
}

type InstancePmsRole

type InstancePmsRole struct {
	Id       int                         `json:"id"`
	RoleType int                         `json:"roleType"`
	Name     string                      `json:"name"`
	Desc     string                      `json:"desc"`
	Details  []PmsRoleDetail             `json:"details"`
	Grant    []*InstancePmsRoleGrantItem `json:"grant"`
}

type InstancePmsRoleGrantItem

type InstancePmsRoleGrantItem struct {
	Created int       `json:"created"`
	Domain  Domain4Fe `json:"domain"`
	UserIds []int     `json:"userIds"`
}

type InstancePmsRolesWithGrantInfo

type InstancePmsRolesWithGrantInfo struct {
	Iid   int                `json:"iid"`
	Roles []*InstancePmsRole `json:"roles"`
}
type MenuTreeItem struct {
	Name     string         `yaml:"name" json:"name"`
	Path     string         `yaml:"path" json:"path"`
	Icon     string         `yaml:"icon" json:"icon"`
	Children []MenuTreeItem `yaml:"children" json:"children,omitempty"`
}

type PmsDomainType4Lock

type PmsDomainType4Lock string
const (
	PmsSysDomainType PmsDomainType4Lock = pmsplugin.SystemDom
)

type PmsRoleDetail

type PmsRoleDetail struct {
	SubResources []string `json:"sub_resources"`
	Acts         []string `json:"acts"`
}

type PmsRuleController

type PmsRuleController interface {
	Create(data interface{}) error
	Update(data interface{}) error
	Delete(data interface{}) error
}

PmsRuleController ...

type PmsRuleControllerFactory

type PmsRuleControllerFactory interface {
	CreateController() PmsRuleController
}

PmsRuleControllerFactory: the interface of factory method

func NewPmsRuleControllerFactory

func NewPmsRuleControllerFactory(roleType int) PmsRuleControllerFactory

NewPmsRuleControllerFactory: Use a simple factory to encapsulate the factory method

type ReqDomainLockStatus

type ReqDomainLockStatus ReqLockDomain

type ReqLockDomain

type ReqLockDomain struct {
	TgtDomainType PmsDomainType4Lock `json:"tgtDomainType" validate:"required" form:"tgtDomainType"` // 目标Domain实体类型
	TgtDomainId   int                `json:"tgtDomainId" form:"tgtDomainId"`                         // 目标Domain实体的id, 注: 当TgtDomainType为 "system" 时, 将忽略该字段
}

type ReqUnlockDomain

type ReqUnlockDomain ReqLockDomain

type Resource

type Resource struct {
	Permission []MenuTreeItem
}

type RespDomainLockStatus

type RespDomainLockStatus struct {
	TgtDomainType  PmsDomainType4Lock `json:"tgtDomainType"` // 目标Domain实体类型
	TgtDomainId    int                `json:"tgtDomainId"`   // 目标Domain实体的id, 注: 当TgtDomainType为 "system" 时, 将忽略该字段
	TgtDomainName  string             `json:"tgtDomainName"` // 目标Domain实体的名称
	Locked         bool               `json:"locked"`        // 当前是否被锁定
	LockByUid      int                `json:"lockByUid"`
	LockByUsername string             `json:"lockByUsername"`
}

type Service

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

func New

func New(c *Config) *Service

func (*Service) AdminMenuList

func (s *Service) AdminMenuList() []MenuTreeItem

type UserPmsChecker

type UserPmsChecker interface {
	Check(reqPms view.ReqPermission) error // if err == nil, means reqPermission passed
	// contains filtered or unexported methods
}

UserPmsChecker ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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