Documentation ¶
Index ¶
- type CasbinRule
- type Default
- func (u *Default) AddPermission(permissionId string, paths, methods []string) error
- func (u *Default) AddRole(roleId string, permissions []string) (err error)
- func (u *Default) AddUserPermissions(userId string, permissionIds []string) (err error)
- func (u *Default) AddUserRoles(userId string, roleIds []string) (err error)
- func (u *Default) CheckPermission(userId string, permission string) bool
- func (u *Default) CheckPolicy(sub string, path string, method string) bool
- func (u *Default) DeleteUserGroupingPolicy(userId string) (err error)
- func (u *Default) LoadPolicy() error
- func (u *Default) RemovePermission(permissionId string, removeBinding bool) (err error)
- func (u *Default) RemoveRole(roleId string, removeBinding bool) (err error)
- func (u *Default) SavePolicy() error
- type Rbac
- type Synced
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CasbinRule ¶
type CasbinRule struct { ID uint `gorm:"primaryKey;autoIncrement"` Ptype string `gorm:"size:100;uniqueIndex:unique_index"` V0 string `gorm:"size:100;uniqueIndex:unique_index"` V1 string `gorm:"size:100;uniqueIndex:unique_index"` V2 string `gorm:"size:100;uniqueIndex:unique_index"` V3 string `gorm:"size:100;uniqueIndex:unique_index"` V4 string `gorm:"size:100;uniqueIndex:unique_index"` V5 string `gorm:"size:100;uniqueIndex:unique_index"` }
func (CasbinRule) TableName ¶
func (CasbinRule) TableName() string
type Default ¶
type Default struct { Rbac // contains filtered or unexported fields }
func (*Default) AddPermission ¶
AddPermission 批量添加权限
func (*Default) AddUserPermissions ¶
AddUserPermissions 批量添加权限
func (*Default) AddUserRoles ¶
AddUserRoles 批量添加角色
func (*Default) CheckPermission ¶
CheckPermission 检测权限
func (*Default) CheckPolicy ¶
CheckPolicy 检测策略规则 sub: user_id|role_id|permission_id
func (*Default) DeleteUserGroupingPolicy ¶
DeleteUserGroupingPolicy 批量删除用户角色和权限
func (*Default) RemovePermission ¶
RemovePermission 批量删除权限 permission 权限标识 removeBinding 是否删除角色绑定的权限
func (*Default) RemoveRole ¶
RemoveRole 批量删除角色
func (*Default) SavePolicy ¶
type Rbac ¶
type Rbac struct { CasbinRule CasbinRule PermissionPrefix string RolePrefix string UserPrefix string }
type Synced ¶
type Synced struct { Rbac // contains filtered or unexported fields }
func (*Synced) CheckPermission ¶ added in v0.1.7
CheckPermission 检测权限
func (*Synced) CheckPolicy ¶
CheckPolicy 检测策略规则 sub: user_id|role_id|permission_id
Click to show internal directories.
Click to hide internal directories.