Documentation ¶
Index ¶
- func AddSubjectGroup(subject, group, tenantId string) (bool, error)
- func AddSubjectResource(subject string, resourceTarget, action, tenantId, resourceId string) (bool, error)
- func CheckSubjectPermissions(subject, resource, action, tenantId string) bool
- func GetSubjectGroupIds(subject, tenantId string) ([]string, error)
- func GetSubjectResourceIds(subject string, tenantId string) (isSuperAdmin bool, ids []string, err error)
- func GetSubjectResources(subject, tenantId string) [][]string
- func Init()
- func NewAdapter(engine *xorm.Engine) (*adapter, error)
- func RemoveSubjectGroup(subject, group, tenantId string) (bool, error)
- func RemoveSubjectGroups(subject, tenantId string) (bool, error)
- func RemoveSubjectResource(subject string, resourceTarget, action, tenantId, resourceId string) (bool, error)
- func RemoveSubjectResources(subject string) (bool, error)
- func SetSuperAdmin(admin string)
- type CasbinPolicy
- type CasbinRelationship
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddSubjectGroup ¶
func AddSubjectResource ¶
func CheckSubjectPermissions ¶
func GetSubjectGroupIds ¶
func GetSubjectResourceIds ¶
func GetSubjectResources ¶
func NewAdapter ¶
func RemoveSubjectGroup ¶
func RemoveSubjectGroups ¶
func RemoveSubjectResource ¶
func RemoveSubjectResources ¶
func SetSuperAdmin ¶
func SetSuperAdmin(admin string)
Types ¶
type CasbinPolicy ¶
type CasbinPolicy struct { Id string `json:"id" xorm:"pk varchar(50)"` PolicyType int `json:"policyType" xorm:"comment('策略类型 1-p, 2-p2')"` // p p2 SubjectId string `json:"subjectId" xorm:"comment('策略主体ID')"` // 主体 Resource string `json:"resource" xorm:"comment('资源内容')"` // 资源 Action string `json:"action" xorm:"comment('资源使用行为')"` // 方法 Effect int `json:"effect" xorm:"comment('策略行为 1-allow,2-deny')"` // 1 allow / 2 deny Priority int `json:"priority" xorm:"comment('优先级')"` // 优先级 TenantId string `json:"tenantId" xorm:"comment('租户ID')"` ResourceId string `json:"resourceId" xorm:"varchar(50) comment('对应的资源ID')"` // 资源ID }
type CasbinRelationship ¶
type CasbinRelationship struct { Id string `json:"id,omitempty" xorm:"pk varchar(50)"` RelationType int `json:"relationType,omitempty" xorm:"comment('关系类型 1-g 2-g2')"` SubjectId string `json:"subjectId,omitempty" xorm:"comment('主体ID')"` ParentSubjectId string `json:"parentSubjectId,omitempty" xorm:"comment('继承主体ID')"` TenantId string `json:"tenantId" xorm:"comment('租户ID')"` }
Click to show internal directories.
Click to hide internal directories.