Documentation
¶
Index ¶
Constants ¶
View Source
const (
// MaxPermissionCount 一个角色最多可以容纳的权限条数
MaxPermissionCount = 500
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateRoleRequest ¶
type CreateRoleRequest struct {
*token.Session `bson:"-" json:"-"`
Name string `bson:"name" json:"name,omitempty" validate:"required,lte=30"` // 应用名称
Description string `bson:"description" json:"description,omitempty" validate:"lte=400"` // 应用简单的描述
Permissions []*Permission `bson:"permissions" json:"permissions,omitempty"` // 读权限
}
CreateRoleRequest 创建应用请求
func NewCreateRoleRequest ¶
func NewCreateRoleRequest() *CreateRoleRequest
NewCreateRoleRequest 实例化请求
type DescribeRoleRequest ¶
type DescribeRoleRequest struct {
Name string `json:"name,omitempty" validate:"required,lte=64"`
}
DescribeRoleRequest role详情
type EffectType ¶
type EffectType uint
EffectType 授权效力包括两种:允许(Allow)和拒绝(Deny)
const ( // Allow 允许访问 Allow EffectType = iota + 1 // Deny 拒绝访问 Deny )
func (EffectType) String ¶
func (t EffectType) String() string
func (*EffectType) UnmarshalJSON ¶
func (t *EffectType) UnmarshalJSON(b []byte) error
UnmarshalJSON todo
type Permission ¶
type Permission struct {
Effect EffectType `bson:"effect" json:"effect,omitempty"` // 效力
ResourceName string `bson:"resource_name" json:"resource_name,omitempty"` // 资源列表
LabelKey string `bson:"label_key" json:"label_key,omitempty"` // 维度
LabelValues []string `bson:"label_values" json:"label_values,omitempty"` // 标识值
}
Permission 权限
type PermissionSet ¶
type PermissionSet struct {
*request.PageRequest
Total int64 `json:"total"`
Items []*Permission `json:"items"`
}
PermissionSet 用户列表
type QueryRoleRequest ¶
type QueryRoleRequest struct {
*request.PageRequest
*DescribeRoleRequest
Type Type
}
QueryRoleRequest 查询请求
func NewQueryRoleRequest ¶
func NewQueryRoleRequest(pageReq *request.PageRequest) *QueryRoleRequest
NewQueryRoleRequest 列表查询请求
type Role ¶
type Role struct {
ID string `bson:"_id" json:"id"` // 角色ID
Type Type `bson:"type" json:"type"` // 角色类型
CreateAt ftime.Time `bson:"create_at" json:"create_at,omitempty"` // 创建时间`
UpdateAt ftime.Time `bson:"update_at" json:"update_at,omitempty"` // 更新时间
CreaterID string `bson:"creater_id" json:"creater_id"` // 创建人
*CreateRoleRequest `bson:",inline"`
}
Role is rbac's role
type Service ¶
type Service interface {
CreateRole(t Type, req *CreateRoleRequest) (*Role, error)
QueryRole(req *QueryRoleRequest) (*Set, error)
DescribeRole(req *DescribeRoleRequest) (*Role, error)
DeleteRole(name string) error
}
Service 角色服务
type Set ¶
type Set struct {
*request.PageRequest
Total int64 `json:"total"`
Items []*Role `json:"items"`
}
Set 角色集合
Click to show internal directories.
Click to hide internal directories.