Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthCollection ¶
type AuthCollection struct { Table string // contains filtered or unexported fields }
权限数据集合
func (*AuthCollection) AddAuth ¶
func (this *AuthCollection) AddAuth(r *AuthRow)
func (*AuthCollection) AddVeto ¶
func (this *AuthCollection) AddVeto(r *AuthRow)
func (*AuthCollection) HasPermition ¶
func (this *AuthCollection) HasPermition(parameters map[string]interface{}) bool
type AuthColumn ¶
type AuthColumn struct { Field *AuthField //对应的字段 Type ValueType //值类型 Value string //取值 Negation bool //取反 }
权限列取值
func (*AuthColumn) Validate ¶
func (this *AuthColumn) Validate(obj interface{}) bool
type AuthEngine ¶
type AuthEngine struct { TableMeta TableMetaReader `Inject:""` RoleMeta RoleReader `Inject:""` }
权限引擎
func (*AuthEngine) ExistTable ¶
func (this *AuthEngine) ExistTable(tablename string) bool
func (*AuthEngine) HasPermition ¶
func (this *AuthEngine) HasPermition(tableTrigger string, parameters map[string]interface{}, roles ...string) bool
tableTrigger 触发标识,用于识别出对应的权限表 parameters 参数 roles 角色列表 如果触发的是不存在的权限控制,则认为拥有权限。如同空气不被控制,获取空气就认为是拥有权限的
type AuthRow ¶
type AuthRow map[string]*AuthColumn //所有列的值
权限数据
func (*AuthRow) AddColumn ¶
func (this *AuthRow) AddColumn(col *AuthColumn)
func (*AuthRow) HasPermition ¶
type AuthTable ¶
type AuthTable struct { Code string //编码 Label string //名称 Fields []AuthField AuthPolicy Policy //执行策略,1、拒绝 2、过滤 3、混淆 }
权限表定义
type Role ¶
type Role struct { Code string //编码、字段名称 Label string //名称 ParentRole *Role //父类角色 ManagedRole *Role //受管理角色 // contains filtered or unexported fields }
角色 1、由权限集合构成 2、可以继承角色,扩充被继承的角色 3、可以设置管控角色,角色的权限受制于管控角色 角色 管控角色 结果
T T T F T F T F F F F F
func (*Role) HasPermition ¶
type ValueType ¶
type ValueType string
VT 值的类型
const ( VT_SINGLES ValueType = "S" //单个值 VT_SET ValueType = "T" //集合或者叫枚举 VT_RANGE ValueType = "R" //区间 [起始值;结束值] VT_REGEX ValueType = "X" //正则表达式,复合正则表达式的允许 VT_ALL ValueType = "*" //允许所有值 VT_MICRO ValueType = "&" //宏,需要解释。例如 本部门、上级部门等 VT_STARTWITH ValueType = "B" //以指定的值开头 VT_ENDWITH ValueType = "E" //以指定的值为结尾 )
type YamlFileTableMeta ¶
type YamlFileTableMeta struct {
// contains filtered or unexported fields
}
func (*YamlFileTableMeta) GetTable ¶
func (this *YamlFileTableMeta) GetTable(table string) *AuthTable
func (*YamlFileTableMeta) Load ¶
func (this *YamlFileTableMeta) Load(f string)
Click to show internal directories.
Click to hide internal directories.