Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterRPCServer(s grpc.ServiceRegistrar, srv RPCServer)
- type AddPermissionToRoleRequest
- func (*AddPermissionToRoleRequest) Descriptor() ([]byte, []int)deprecated
- func (x *AddPermissionToRoleRequest) GetCreateBy() string
- func (x *AddPermissionToRoleRequest) GetPermissions() []*Spec
- func (x *AddPermissionToRoleRequest) GetRoleId() string
- func (req *AddPermissionToRoleRequest) Length() int
- func (*AddPermissionToRoleRequest) ProtoMessage()
- func (x *AddPermissionToRoleRequest) ProtoReflect() protoreflect.Message
- func (x *AddPermissionToRoleRequest) Reset()
- func (x *AddPermissionToRoleRequest) String() string
- func (req *AddPermissionToRoleRequest) Validate() error
- type CreateRoleRequest
- func (*CreateRoleRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CreateRoleRequest) GetCreateBy() string
- func (x *CreateRoleRequest) GetDescription() string
- func (x *CreateRoleRequest) GetDomain() string
- func (x *CreateRoleRequest) GetMeta() map[string]string
- func (x *CreateRoleRequest) GetName() string
- func (x *CreateRoleRequest) GetSpecs() []*Spec
- func (x *CreateRoleRequest) GetType() RoleType
- func (*CreateRoleRequest) ProtoMessage()
- func (x *CreateRoleRequest) ProtoReflect() protoreflect.Message
- func (x *CreateRoleRequest) Reset()
- func (x *CreateRoleRequest) String() string
- func (req *CreateRoleRequest) Validate() error
- type DeleteRoleRequest
- func (*DeleteRoleRequest) Descriptor() ([]byte, []int)deprecated
- func (x *DeleteRoleRequest) GetDeletePolicy() bool
- func (x *DeleteRoleRequest) GetId() string
- func (*DeleteRoleRequest) ProtoMessage()
- func (x *DeleteRoleRequest) ProtoReflect() protoreflect.Message
- func (x *DeleteRoleRequest) Reset()
- func (x *DeleteRoleRequest) String() string
- type DescribePermissionRequest
- func (*DescribePermissionRequest) Descriptor() ([]byte, []int)deprecated
- func (x *DescribePermissionRequest) GetId() string
- func (*DescribePermissionRequest) ProtoMessage()
- func (x *DescribePermissionRequest) ProtoReflect() protoreflect.Message
- func (x *DescribePermissionRequest) Reset()
- func (x *DescribePermissionRequest) String() string
- type DescribeRoleRequest
- func (*DescribeRoleRequest) Descriptor() ([]byte, []int)deprecated
- func (x *DescribeRoleRequest) GetId() string
- func (x *DescribeRoleRequest) GetName() string
- func (x *DescribeRoleRequest) GetType() RoleType
- func (x *DescribeRoleRequest) GetWithPermissions() bool
- func (*DescribeRoleRequest) ProtoMessage()
- func (x *DescribeRoleRequest) ProtoReflect() protoreflect.Message
- func (x *DescribeRoleRequest) Reset()
- func (x *DescribeRoleRequest) String() string
- func (req *DescribeRoleRequest) Validate() error
- type EffectType
- func (EffectType) Descriptor() protoreflect.EnumDescriptor
- func (x EffectType) Enum() *EffectType
- func (EffectType) EnumDescriptor() ([]byte, []int)deprecated
- func (t EffectType) Equal(target EffectType) bool
- func (t EffectType) IsIn(targets ...EffectType) bool
- func (t EffectType) MarshalJSON() ([]byte, error)
- func (x EffectType) Number() protoreflect.EnumNumber
- func (x EffectType) String() string
- func (EffectType) Type() protoreflect.EnumType
- func (t *EffectType) UnmarshalJSON(b []byte) error
- type Permission
- func (*Permission) Descriptor() ([]byte, []int)deprecated
- func (x *Permission) GetCreateAt() int64
- func (x *Permission) GetId() string
- func (x *Permission) GetRoleId() string
- func (x *Permission) GetScope() string
- func (x *Permission) GetSpec() *Spec
- func (p *Permission) HasPerm(ed *endpoint.Endpoint) bool
- func (*Permission) ProtoMessage()
- func (x *Permission) ProtoReflect() protoreflect.Message
- func (x *Permission) Reset()
- func (x *Permission) String() string
- type PermissionSet
- func (s *PermissionSet) Add(items ...*Permission)
- func (*PermissionSet) Descriptor() ([]byte, []int)deprecated
- func (x *PermissionSet) GetItems() []*Permission
- func (x *PermissionSet) GetTotal() int64
- func (*PermissionSet) ProtoMessage()
- func (x *PermissionSet) ProtoReflect() protoreflect.Message
- func (x *PermissionSet) Reset()
- func (x *PermissionSet) String() string
- type QueryPermissionRequest
- func (*QueryPermissionRequest) Descriptor() ([]byte, []int)deprecated
- func (x *QueryPermissionRequest) GetNamespace() string
- func (x *QueryPermissionRequest) GetPage() *request.PageRequest
- func (x *QueryPermissionRequest) GetRoleId() string
- func (x *QueryPermissionRequest) GetSkipItems() bool
- func (x *QueryPermissionRequest) GetUsername() string
- func (*QueryPermissionRequest) ProtoMessage()
- func (x *QueryPermissionRequest) ProtoReflect() protoreflect.Message
- func (x *QueryPermissionRequest) Reset()
- func (x *QueryPermissionRequest) String() string
- func (req *QueryPermissionRequest) Validate() error
- type QueryRoleRequest
- func (*QueryRoleRequest) Descriptor() ([]byte, []int)deprecated
- func (x *QueryRoleRequest) GetDomain() string
- func (x *QueryRoleRequest) GetPage() *request.PageRequest
- func (x *QueryRoleRequest) GetType() RoleType
- func (x *QueryRoleRequest) GetWithPermission() bool
- func (*QueryRoleRequest) ProtoMessage()
- func (x *QueryRoleRequest) ProtoReflect() protoreflect.Message
- func (x *QueryRoleRequest) Reset()
- func (x *QueryRoleRequest) String() string
- func (req *QueryRoleRequest) Validate() error
- type RPCClient
- type RPCServer
- type RemovePermissionFromRoleRequest
- func (*RemovePermissionFromRoleRequest) Descriptor() ([]byte, []int)deprecated
- func (x *RemovePermissionFromRoleRequest) GetPermissionId() []string
- func (x *RemovePermissionFromRoleRequest) GetRemoveAll() bool
- func (x *RemovePermissionFromRoleRequest) GetRoleId() string
- func (*RemovePermissionFromRoleRequest) ProtoMessage()
- func (x *RemovePermissionFromRoleRequest) ProtoReflect() protoreflect.Message
- func (x *RemovePermissionFromRoleRequest) Reset()
- func (x *RemovePermissionFromRoleRequest) String() string
- func (req *RemovePermissionFromRoleRequest) Validate() error
- type Role
- func (*Role) Descriptor() ([]byte, []int)deprecated
- func (x *Role) GetCreateAt() int64
- func (x *Role) GetId() string
- func (x *Role) GetPermissions() []*Permission
- func (x *Role) GetScope() string
- func (x *Role) GetSpec() *CreateRoleRequest
- func (x *Role) GetUpdateAt() int64
- func (r *Role) HasPerm(ed *endpoint.Endpoint) *Permission
- func (*Role) ProtoMessage()
- func (x *Role) ProtoReflect() protoreflect.Message
- func (x *Role) Reset()
- func (x *Role) String() string
- type RoleSet
- func (s *RoleSet) Add(item *Role)
- func (*RoleSet) Descriptor() ([]byte, []int)deprecated
- func (x *RoleSet) GetItems() []*Role
- func (x *RoleSet) GetTotal() int64
- func (s *RoleSet) HasPerm(ed *endpoint.Endpoint) *Permission
- func (*RoleSet) ProtoMessage()
- func (x *RoleSet) ProtoReflect() protoreflect.Message
- func (x *RoleSet) Reset()
- func (x *RoleSet) String() string
- type RoleType
- func (RoleType) Descriptor() protoreflect.EnumDescriptor
- func (x RoleType) Enum() *RoleType
- func (RoleType) EnumDescriptor() ([]byte, []int)deprecated
- func (t RoleType) Equal(target RoleType) bool
- func (t RoleType) IsIn(targets ...RoleType) bool
- func (t RoleType) MarshalJSON() ([]byte, error)
- func (x RoleType) Number() protoreflect.EnumNumber
- func (x RoleType) String() string
- func (RoleType) Type() protoreflect.EnumType
- func (t *RoleType) UnmarshalJSON(b []byte) error
- type Service
- type Spec
- func (*Spec) Descriptor() ([]byte, []int)deprecated
- func (x *Spec) GetCreateBy() string
- func (x *Spec) GetDesc() string
- func (x *Spec) GetEffect() EffectType
- func (x *Spec) GetLabelKey() string
- func (x *Spec) GetLabelValues() []string
- func (x *Spec) GetMatchAll() bool
- func (x *Spec) GetResourceName() string
- func (x *Spec) GetServiceId() string
- func (req *Spec) HashID(roleId string) string
- func (*Spec) ProtoMessage()
- func (x *Spec) ProtoReflect() protoreflect.Message
- func (x *Spec) Reset()
- func (x *Spec) String() string
- type UnimplementedRPCServer
- func (UnimplementedRPCServer) DescribePermission(context.Context, *DescribePermissionRequest) (*Permission, error)
- func (UnimplementedRPCServer) DescribeRole(context.Context, *DescribeRoleRequest) (*Role, error)
- func (UnimplementedRPCServer) QueryPermission(context.Context, *QueryPermissionRequest) (*PermissionSet, error)
- func (UnimplementedRPCServer) QueryRole(context.Context, *QueryRoleRequest) (*RoleSet, error)
- type UnsafeRPCServer
- type UpdatePermissionRequest
- func (*UpdatePermissionRequest) Descriptor() ([]byte, []int)deprecated
- func (x *UpdatePermissionRequest) GetId() string
- func (x *UpdatePermissionRequest) GetLabelKey() string
- func (x *UpdatePermissionRequest) GetLabelValues() []string
- func (x *UpdatePermissionRequest) GetMatchAll() bool
- func (*UpdatePermissionRequest) ProtoMessage()
- func (x *UpdatePermissionRequest) ProtoReflect() protoreflect.Message
- func (x *UpdatePermissionRequest) Reset()
- func (x *UpdatePermissionRequest) String() string
- func (req *UpdatePermissionRequest) Validate() error
Constants ¶
const ( // AdminRoleName 管理员角色名称, 系统初始化时创建 ADMIN_ROLE_NAME = "admin" // VisitorRoleName 访客角色名称, 系统初始化时创建 VISITOR_ROLE_NAME = "visitor" )
const (
AppName = "role"
)
const (
// RoleMaxPermission 一个角色允许添加的最大权限数
RoleMaxPermission = 500
)
Variables ¶
var ( EffectType_name = map[int32]string{ 0: "ALLOW", 1: "DENY", } EffectType_value = map[string]int32{ "ALLOW": 0, "DENY": 1, } )
Enum value maps for EffectType.
var ( RoleType_name = map[int32]string{ 0: "BUILDIN", 1: "GLOBAL", 2: "CUSTOM", } RoleType_value = map[string]int32{ "BUILDIN": 0, "GLOBAL": 1, "CUSTOM": 2, } )
Enum value maps for RoleType.
var File_apps_role_pb_permission_proto protoreflect.FileDescriptor
var File_apps_role_pb_role_proto protoreflect.FileDescriptor
var File_apps_role_pb_rpc_proto protoreflect.FileDescriptor
var RPC_ServiceDesc = grpc.ServiceDesc{ ServiceName: "devcloud.mcenter.role.RPC", HandlerType: (*RPCServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "QueryRole", Handler: _RPC_QueryRole_Handler, }, { MethodName: "DescribeRole", Handler: _RPC_DescribeRole_Handler, }, { MethodName: "QueryPermission", Handler: _RPC_QueryPermission_Handler, }, { MethodName: "DescribePermission", Handler: _RPC_DescribePermission_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "apps/role/pb/rpc.proto", }
RPC_ServiceDesc is the grpc.ServiceDesc for RPC service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterRPCServer ¶
func RegisterRPCServer(s grpc.ServiceRegistrar, srv RPCServer)
Types ¶
type AddPermissionToRoleRequest ¶
type AddPermissionToRoleRequest struct { // 创建者ID // @gotags: json:"create_by" validate:"required" CreateBy string `protobuf:"bytes,3,opt,name=create_by,json=createBy,proto3" json:"create_by" validate:"required"` // @gotags: json:"role_id" validate:"required,lte=64" RoleId string `protobuf:"bytes,1,opt,name=role_id,json=roleId,proto3" json:"role_id" validate:"required,lte=64"` // @gotags: json:"permissions" validate:"required" Permissions []*Spec `protobuf:"bytes,2,rep,name=permissions,proto3" json:"permissions" validate:"required"` // contains filtered or unexported fields }
func NewAddPermissionToRoleRequest ¶
func NewAddPermissionToRoleRequest() *AddPermissionToRoleRequest
NewAddPermissionToRoleRequest todo
func (*AddPermissionToRoleRequest) Descriptor
deprecated
func (*AddPermissionToRoleRequest) Descriptor() ([]byte, []int)
Deprecated: Use AddPermissionToRoleRequest.ProtoReflect.Descriptor instead.
func (*AddPermissionToRoleRequest) GetCreateBy ¶
func (x *AddPermissionToRoleRequest) GetCreateBy() string
func (*AddPermissionToRoleRequest) GetPermissions ¶
func (x *AddPermissionToRoleRequest) GetPermissions() []*Spec
func (*AddPermissionToRoleRequest) GetRoleId ¶
func (x *AddPermissionToRoleRequest) GetRoleId() string
func (*AddPermissionToRoleRequest) Length ¶
func (req *AddPermissionToRoleRequest) Length() int
func (*AddPermissionToRoleRequest) ProtoMessage ¶
func (*AddPermissionToRoleRequest) ProtoMessage()
func (*AddPermissionToRoleRequest) ProtoReflect ¶
func (x *AddPermissionToRoleRequest) ProtoReflect() protoreflect.Message
func (*AddPermissionToRoleRequest) Reset ¶
func (x *AddPermissionToRoleRequest) Reset()
func (*AddPermissionToRoleRequest) String ¶
func (x *AddPermissionToRoleRequest) String() string
func (*AddPermissionToRoleRequest) Validate ¶
func (req *AddPermissionToRoleRequest) Validate() error
type CreateRoleRequest ¶
type CreateRoleRequest struct { // 所属域 // @gotags: bson:"domain" json:"domain" Domain string `protobuf:"bytes,1,opt,name=domain,proto3" json:"domain" bson:"domain"` // 创建者ID // @gotags: bson:"create_by" json:"create_by" CreateBy string `protobuf:"bytes,2,opt,name=create_by,json=createBy,proto3" json:"create_by" bson:"create_by"` // 角色类型 // @gotags: bson:"type" json:"type" Type RoleType `protobuf:"varint,3,opt,name=type,proto3,enum=devcloud.mcenter.role.RoleType" json:"type" bson:"type"` // 角色名称 // @gotags: bson:"name" json:"name" validate:"required,lte=30" Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name" bson:"name" validate:"required,lte=30"` // 角色描述 // @gotags: bson:"description" json:"description" validate:"lte=400" Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description" bson:"description" validate:"lte=400"` // 读权限 // @gotags: bson:"-" json:"specs,omitempty" Specs []*Spec `protobuf:"bytes,6,rep,name=specs,proto3" json:"specs,omitempty" bson:"-"` // 角色关联的其他信息,比如展示的视图 // @gotags: bson:"meta" json:"meta" validate:"lte=400" Meta map[string]string `` /* 170-byte string literal not displayed */ // contains filtered or unexported fields }
CreateRoleRequest 创建角色请求
func NewCreateRoleRequest ¶
func NewCreateRoleRequest() *CreateRoleRequest
NewCreateRoleRequest 实例化请求
func (*CreateRoleRequest) Descriptor
deprecated
func (*CreateRoleRequest) Descriptor() ([]byte, []int)
Deprecated: Use CreateRoleRequest.ProtoReflect.Descriptor instead.
func (*CreateRoleRequest) GetCreateBy ¶
func (x *CreateRoleRequest) GetCreateBy() string
func (*CreateRoleRequest) GetDescription ¶
func (x *CreateRoleRequest) GetDescription() string
func (*CreateRoleRequest) GetDomain ¶
func (x *CreateRoleRequest) GetDomain() string
func (*CreateRoleRequest) GetMeta ¶
func (x *CreateRoleRequest) GetMeta() map[string]string
func (*CreateRoleRequest) GetName ¶
func (x *CreateRoleRequest) GetName() string
func (*CreateRoleRequest) GetSpecs ¶
func (x *CreateRoleRequest) GetSpecs() []*Spec
func (*CreateRoleRequest) GetType ¶
func (x *CreateRoleRequest) GetType() RoleType
func (*CreateRoleRequest) ProtoMessage ¶
func (*CreateRoleRequest) ProtoMessage()
func (*CreateRoleRequest) ProtoReflect ¶
func (x *CreateRoleRequest) ProtoReflect() protoreflect.Message
func (*CreateRoleRequest) Reset ¶
func (x *CreateRoleRequest) Reset()
func (*CreateRoleRequest) String ¶
func (x *CreateRoleRequest) String() string
type DeleteRoleRequest ¶
type DeleteRoleRequest struct { // @gotags: json:"id" validate:"required,lte=64" Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" validate:"required,lte=64"` // @gotags: json:"delete_policy" DeletePolicy bool `protobuf:"varint,2,opt,name=delete_policy,json=deletePolicy,proto3" json:"delete_policy"` // contains filtered or unexported fields }
DeleteRoleRequest role删除
func (*DeleteRoleRequest) Descriptor
deprecated
func (*DeleteRoleRequest) Descriptor() ([]byte, []int)
Deprecated: Use DeleteRoleRequest.ProtoReflect.Descriptor instead.
func (*DeleteRoleRequest) GetDeletePolicy ¶
func (x *DeleteRoleRequest) GetDeletePolicy() bool
func (*DeleteRoleRequest) GetId ¶
func (x *DeleteRoleRequest) GetId() string
func (*DeleteRoleRequest) ProtoMessage ¶
func (*DeleteRoleRequest) ProtoMessage()
func (*DeleteRoleRequest) ProtoReflect ¶
func (x *DeleteRoleRequest) ProtoReflect() protoreflect.Message
func (*DeleteRoleRequest) Reset ¶
func (x *DeleteRoleRequest) Reset()
func (*DeleteRoleRequest) String ¶
func (x *DeleteRoleRequest) String() string
type DescribePermissionRequest ¶
type DescribePermissionRequest struct { // @gotags: json:"id" Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` // contains filtered or unexported fields }
DescribeRoleRequest role详情
func NewDescribePermissionRequestWithID ¶
func NewDescribePermissionRequestWithID(id string) *DescribePermissionRequest
func (*DescribePermissionRequest) Descriptor
deprecated
func (*DescribePermissionRequest) Descriptor() ([]byte, []int)
Deprecated: Use DescribePermissionRequest.ProtoReflect.Descriptor instead.
func (*DescribePermissionRequest) GetId ¶
func (x *DescribePermissionRequest) GetId() string
func (*DescribePermissionRequest) ProtoMessage ¶
func (*DescribePermissionRequest) ProtoMessage()
func (*DescribePermissionRequest) ProtoReflect ¶
func (x *DescribePermissionRequest) ProtoReflect() protoreflect.Message
func (*DescribePermissionRequest) Reset ¶
func (x *DescribePermissionRequest) Reset()
func (*DescribePermissionRequest) String ¶
func (x *DescribePermissionRequest) String() string
type DescribeRoleRequest ¶
type DescribeRoleRequest struct { // @gotags: json:"id" Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` // @gotags: json:"name,omitempty" validate:"required,lte=64" Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty" validate:"required,lte=64"` // @gotags: bson:"with_permissions" json:"with_permissions" WithPermissions bool `protobuf:"varint,3,opt,name=with_permissions,json=withPermissions,proto3" json:"with_permissions" bson:"with_permissions"` // @gotags: bson:"type" json:"type" Type RoleType `protobuf:"varint,4,opt,name=type,proto3,enum=devcloud.mcenter.role.RoleType" json:"type" bson:"type"` // contains filtered or unexported fields }
DescribeRoleRequest role详情
func NewDescribeRoleRequestWithID ¶
func NewDescribeRoleRequestWithID(id string) *DescribeRoleRequest
NewDescribeRoleRequestWithID todo
func NewDescribeRoleRequestWithName ¶
func NewDescribeRoleRequestWithName(name string) *DescribeRoleRequest
NewDescribeRoleRequestWithName todo
func (*DescribeRoleRequest) Descriptor
deprecated
func (*DescribeRoleRequest) Descriptor() ([]byte, []int)
Deprecated: Use DescribeRoleRequest.ProtoReflect.Descriptor instead.
func (*DescribeRoleRequest) GetId ¶
func (x *DescribeRoleRequest) GetId() string
func (*DescribeRoleRequest) GetName ¶
func (x *DescribeRoleRequest) GetName() string
func (*DescribeRoleRequest) GetType ¶
func (x *DescribeRoleRequest) GetType() RoleType
func (*DescribeRoleRequest) GetWithPermissions ¶
func (x *DescribeRoleRequest) GetWithPermissions() bool
func (*DescribeRoleRequest) ProtoMessage ¶
func (*DescribeRoleRequest) ProtoMessage()
func (*DescribeRoleRequest) ProtoReflect ¶
func (x *DescribeRoleRequest) ProtoReflect() protoreflect.Message
func (*DescribeRoleRequest) Reset ¶
func (x *DescribeRoleRequest) Reset()
func (*DescribeRoleRequest) String ¶
func (x *DescribeRoleRequest) String() string
func (*DescribeRoleRequest) Validate ¶
func (req *DescribeRoleRequest) Validate() error
Validate todo
type EffectType ¶
type EffectType int32
EffectType 授权效力包括两种:允许(Allow)和拒绝(Deny)
const ( // 允许访问 EffectType_ALLOW EffectType = 0 // 拒绝访问 EffectType_DENY EffectType = 1 )
func ParseEffectTypeFromString ¶
func ParseEffectTypeFromString(str string) (EffectType, error)
ParseEffectTypeFromString Parse EffectType from string
func (EffectType) Descriptor ¶
func (EffectType) Descriptor() protoreflect.EnumDescriptor
func (EffectType) Enum ¶
func (x EffectType) Enum() *EffectType
func (EffectType) EnumDescriptor
deprecated
func (EffectType) EnumDescriptor() ([]byte, []int)
Deprecated: Use EffectType.Descriptor instead.
func (EffectType) Number ¶
func (x EffectType) Number() protoreflect.EnumNumber
func (EffectType) String ¶
func (x EffectType) String() string
func (EffectType) Type ¶
func (EffectType) Type() protoreflect.EnumType
func (*EffectType) UnmarshalJSON ¶
func (t *EffectType) UnmarshalJSON(b []byte) error
UnmarshalJSON todo
type Permission ¶
type Permission struct { // id // @gotags: bson:"_id" json:"id" Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` // 创建时间 // @gotags: bson:"create_at" json:"create_at" CreateAt int64 `protobuf:"varint,2,opt,name=create_at,json=createAt,proto3" json:"create_at" bson:"create_at"` // 角色Id // @gotags: bson:"role_id" json:"role_id" RoleId string `protobuf:"bytes,3,opt,name=role_id,json=roleId,proto3" json:"role_id" bson:"role_id"` // 权限具体定义, 那个服务 的那个接口 // @gotags: bson:"spec" json:"spec" Spec *Spec `protobuf:"bytes,4,opt,name=spec,proto3" json:"spec" bson:"spec"` // 范围, 角色范围限制, 由策略引擎动态补充 // @gotags: bson:"-" json:"scope" Scope string `protobuf:"bytes,5,opt,name=scope,proto3" json:"scope" bson:"-"` // contains filtered or unexported fields }
Permission 权限
func NewDeaultPermission ¶
func NewDeaultPermission() *Permission
func NewPermission ¶
func NewPermission(roleId string, perms []*Spec) []*Permission
func (*Permission) Descriptor
deprecated
func (*Permission) Descriptor() ([]byte, []int)
Deprecated: Use Permission.ProtoReflect.Descriptor instead.
func (*Permission) GetCreateAt ¶
func (x *Permission) GetCreateAt() int64
func (*Permission) GetId ¶
func (x *Permission) GetId() string
func (*Permission) GetRoleId ¶
func (x *Permission) GetRoleId() string
func (*Permission) GetScope ¶
func (x *Permission) GetScope() string
func (*Permission) GetSpec ¶
func (x *Permission) GetSpec() *Spec
func (*Permission) ProtoMessage ¶
func (*Permission) ProtoMessage()
func (*Permission) ProtoReflect ¶
func (x *Permission) ProtoReflect() protoreflect.Message
func (*Permission) Reset ¶
func (x *Permission) Reset()
func (*Permission) String ¶
func (x *Permission) String() string
type PermissionSet ¶
type PermissionSet struct { // @gotags: bson:"total" json:"total" Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total" bson:"total"` // @gotags: bson:"items" json:"items" Items []*Permission `protobuf:"bytes,2,rep,name=items,proto3" json:"items" bson:"items"` // contains filtered or unexported fields }
PermissionSet 用户列表
func (*PermissionSet) Descriptor
deprecated
func (*PermissionSet) Descriptor() ([]byte, []int)
Deprecated: Use PermissionSet.ProtoReflect.Descriptor instead.
func (*PermissionSet) GetItems ¶
func (x *PermissionSet) GetItems() []*Permission
func (*PermissionSet) GetTotal ¶
func (x *PermissionSet) GetTotal() int64
func (*PermissionSet) ProtoMessage ¶
func (*PermissionSet) ProtoMessage()
func (*PermissionSet) ProtoReflect ¶
func (x *PermissionSet) ProtoReflect() protoreflect.Message
func (*PermissionSet) Reset ¶
func (x *PermissionSet) Reset()
func (*PermissionSet) String ¶
func (x *PermissionSet) String() string
type QueryPermissionRequest ¶
type QueryPermissionRequest struct { // @gotags: json:"page" Page *request.PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page"` // @gotags: json:"namespace" Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace"` // @gotags: json:"username" Username string `protobuf:"bytes,3,opt,name=username,proto3" json:"username"` // 查询角色权限 // @gotags: json:"role_id" RoleId string `protobuf:"bytes,4,opt,name=role_id,json=roleId,proto3" json:"role_id"` // 忽略数据 // @gotags: json:"skip_items" SkipItems bool `protobuf:"varint,5,opt,name=skip_items,json=skipItems,proto3" json:"skip_items"` // contains filtered or unexported fields }
QueryPermissionRequest 查询用户权限
func NewQueryPermissionRequest ¶
func NewQueryPermissionRequest() *QueryPermissionRequest
NewQueryPermissionRequest todo
func (*QueryPermissionRequest) Descriptor
deprecated
func (*QueryPermissionRequest) Descriptor() ([]byte, []int)
Deprecated: Use QueryPermissionRequest.ProtoReflect.Descriptor instead.
func (*QueryPermissionRequest) GetNamespace ¶
func (x *QueryPermissionRequest) GetNamespace() string
func (*QueryPermissionRequest) GetPage ¶
func (x *QueryPermissionRequest) GetPage() *request.PageRequest
func (*QueryPermissionRequest) GetRoleId ¶
func (x *QueryPermissionRequest) GetRoleId() string
func (*QueryPermissionRequest) GetSkipItems ¶
func (x *QueryPermissionRequest) GetSkipItems() bool
func (*QueryPermissionRequest) GetUsername ¶
func (x *QueryPermissionRequest) GetUsername() string
func (*QueryPermissionRequest) ProtoMessage ¶
func (*QueryPermissionRequest) ProtoMessage()
func (*QueryPermissionRequest) ProtoReflect ¶
func (x *QueryPermissionRequest) ProtoReflect() protoreflect.Message
func (*QueryPermissionRequest) Reset ¶
func (x *QueryPermissionRequest) Reset()
func (*QueryPermissionRequest) String ¶
func (x *QueryPermissionRequest) String() string
func (*QueryPermissionRequest) Validate ¶
func (req *QueryPermissionRequest) Validate() error
type QueryRoleRequest ¶
type QueryRoleRequest struct { // @gotags: json:"page" Page *request.PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page"` // @gotags: json:"type" Type *RoleType `protobuf:"varint,2,opt,name=type,proto3,enum=devcloud.mcenter.role.RoleType,oneof" json:"type"` // 属于那个域 // @gotags: json:"domain" Domain string `protobuf:"bytes,3,opt,name=domain,proto3" json:"domain"` // 是否需要查询permission // @gotags: json:"with_permission" WithPermission bool `protobuf:"varint,4,opt,name=with_permission,json=withPermission,proto3" json:"with_permission"` // contains filtered or unexported fields }
QueryRoleRequest 列表查询
func (*QueryRoleRequest) Descriptor
deprecated
func (*QueryRoleRequest) Descriptor() ([]byte, []int)
Deprecated: Use QueryRoleRequest.ProtoReflect.Descriptor instead.
func (*QueryRoleRequest) GetDomain ¶
func (x *QueryRoleRequest) GetDomain() string
func (*QueryRoleRequest) GetPage ¶
func (x *QueryRoleRequest) GetPage() *request.PageRequest
func (*QueryRoleRequest) GetType ¶
func (x *QueryRoleRequest) GetType() RoleType
func (*QueryRoleRequest) GetWithPermission ¶
func (x *QueryRoleRequest) GetWithPermission() bool
func (*QueryRoleRequest) ProtoMessage ¶
func (*QueryRoleRequest) ProtoMessage()
func (*QueryRoleRequest) ProtoReflect ¶
func (x *QueryRoleRequest) ProtoReflect() protoreflect.Message
func (*QueryRoleRequest) Reset ¶
func (x *QueryRoleRequest) Reset()
func (*QueryRoleRequest) String ¶
func (x *QueryRoleRequest) String() string
type RPCClient ¶
type RPCClient interface { // 角色本身查询 QueryRole(ctx context.Context, in *QueryRoleRequest, opts ...grpc.CallOption) (*RoleSet, error) DescribeRole(ctx context.Context, in *DescribeRoleRequest, opts ...grpc.CallOption) (*Role, error) // 权限的查询 QueryPermission(ctx context.Context, in *QueryPermissionRequest, opts ...grpc.CallOption) (*PermissionSet, error) DescribePermission(ctx context.Context, in *DescribePermissionRequest, opts ...grpc.CallOption) (*Permission, error) }
RPCClient is the client API for RPC service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewRPCClient ¶
func NewRPCClient(cc grpc.ClientConnInterface) RPCClient
type RPCServer ¶
type RPCServer interface { // 角色本身查询 QueryRole(context.Context, *QueryRoleRequest) (*RoleSet, error) DescribeRole(context.Context, *DescribeRoleRequest) (*Role, error) // 权限的查询 QueryPermission(context.Context, *QueryPermissionRequest) (*PermissionSet, error) DescribePermission(context.Context, *DescribePermissionRequest) (*Permission, error) // contains filtered or unexported methods }
RPCServer is the server API for RPC service. All implementations must embed UnimplementedRPCServer for forward compatibility
type RemovePermissionFromRoleRequest ¶
type RemovePermissionFromRoleRequest struct { // @gotags: json:"role_id" validate:"required,lte=64" RoleId string `protobuf:"bytes,1,opt,name=role_id,json=roleId,proto3" json:"role_id" validate:"required,lte=64"` // @gotags: json:"remove_all" RemoveAll bool `protobuf:"varint,2,opt,name=remove_all,json=removeAll,proto3" json:"remove_all"` // @gotags: json:"permission_id" PermissionId []string `protobuf:"bytes,3,rep,name=permission_id,json=permissionId,proto3" json:"permission_id"` // contains filtered or unexported fields }
func NewRemovePermissionFromRoleRequest ¶
func NewRemovePermissionFromRoleRequest() *RemovePermissionFromRoleRequest
NewRemovePermissionFromRoleRequest todo
func (*RemovePermissionFromRoleRequest) Descriptor
deprecated
func (*RemovePermissionFromRoleRequest) Descriptor() ([]byte, []int)
Deprecated: Use RemovePermissionFromRoleRequest.ProtoReflect.Descriptor instead.
func (*RemovePermissionFromRoleRequest) GetPermissionId ¶
func (x *RemovePermissionFromRoleRequest) GetPermissionId() []string
func (*RemovePermissionFromRoleRequest) GetRemoveAll ¶
func (x *RemovePermissionFromRoleRequest) GetRemoveAll() bool
func (*RemovePermissionFromRoleRequest) GetRoleId ¶
func (x *RemovePermissionFromRoleRequest) GetRoleId() string
func (*RemovePermissionFromRoleRequest) ProtoMessage ¶
func (*RemovePermissionFromRoleRequest) ProtoMessage()
func (*RemovePermissionFromRoleRequest) ProtoReflect ¶
func (x *RemovePermissionFromRoleRequest) ProtoReflect() protoreflect.Message
func (*RemovePermissionFromRoleRequest) Reset ¶
func (x *RemovePermissionFromRoleRequest) Reset()
func (*RemovePermissionFromRoleRequest) String ¶
func (x *RemovePermissionFromRoleRequest) String() string
func (*RemovePermissionFromRoleRequest) Validate ¶
func (req *RemovePermissionFromRoleRequest) Validate() error
type Role ¶
type Role struct { // 角色ID // @gotags: bson:"_id" json:"id" Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` // 创建时间 // @gotags: bson:"create_at" json:"create_at" CreateAt int64 `protobuf:"varint,2,opt,name=create_at,json=createAt,proto3" json:"create_at" bson:"create_at"` // 更新时间 // @gotags: bson:"update_at" json:"update_at" UpdateAt int64 `protobuf:"varint,3,opt,name=update_at,json=updateAt,proto3" json:"update_at" bson:"update_at"` // 范围, 角色范围限制, 由策略引擎动态补充 // @gotags: bson:"-" json:"scope" Scope string `protobuf:"bytes,4,opt,name=scope,proto3" json:"scope" bson:"-"` // 角色描述信息 // @gotags: bson:"spec" json:"spec" Spec *CreateRoleRequest `protobuf:"bytes,5,opt,name=spec,proto3" json:"spec" bson:"spec"` // 角色描述信息, permission 是动态补充 // @gotags: bson:"-" json:"permissions" Permissions []*Permission `protobuf:"bytes,6,rep,name=permissions,proto3" json:"permissions" bson:"-"` // contains filtered or unexported fields }
Role is rbac's role
func (*Role) Descriptor
deprecated
func (*Role) GetCreateAt ¶
func (*Role) GetPermissions ¶
func (x *Role) GetPermissions() []*Permission
func (*Role) GetSpec ¶
func (x *Role) GetSpec() *CreateRoleRequest
func (*Role) GetUpdateAt ¶
func (*Role) ProtoMessage ¶
func (*Role) ProtoMessage()
func (*Role) ProtoReflect ¶
func (x *Role) ProtoReflect() protoreflect.Message
type RoleSet ¶
type RoleSet struct { // @gotags: bson:"total" json:"total" Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total" bson:"total"` // @gotags: bson:"items" json:"items" Items []*Role `protobuf:"bytes,2,rep,name=items,proto3" json:"items" bson:"items"` // contains filtered or unexported fields }
func (*RoleSet) Descriptor
deprecated
func (*RoleSet) ProtoMessage ¶
func (*RoleSet) ProtoMessage()
func (*RoleSet) ProtoReflect ¶
func (x *RoleSet) ProtoReflect() protoreflect.Message
type RoleType ¶
type RoleType int32
RoleType 角色
func ParseRoleTypeFromString ¶
ParseRoleTypeFromString Parse RoleType from string
func (RoleType) Descriptor ¶
func (RoleType) Descriptor() protoreflect.EnumDescriptor
func (RoleType) EnumDescriptor
deprecated
func (RoleType) Number ¶
func (x RoleType) Number() protoreflect.EnumNumber
func (RoleType) Type ¶
func (RoleType) Type() protoreflect.EnumType
func (*RoleType) UnmarshalJSON ¶
UnmarshalJSON todo
type Service ¶
type Service interface { CreateRole(context.Context, *CreateRoleRequest) (*Role, error) DeleteRole(context.Context, *DeleteRoleRequest) (*Role, error) AddPermissionToRole(context.Context, *AddPermissionToRoleRequest) (*PermissionSet, error) RemovePermissionFromRole(context.Context, *RemovePermissionFromRoleRequest) (*PermissionSet, error) UpdatePermission(context.Context, *UpdatePermissionRequest) (*Permission, error) RPCServer }
type Spec ¶
type Spec struct { // 创建人 // @gotags: bson:"create_by" json:"create_by" CreateBy string `protobuf:"bytes,1,opt,name=create_by,json=createBy,proto3" json:"create_by" bson:"create_by"` // 权限描述 // @gotags: bson:"desc" json:"desc" Desc string `protobuf:"bytes,2,opt,name=desc,proto3" json:"desc" bson:"desc"` // 效力 // @gotags: bson:"effect" json:"effect" Effect EffectType `protobuf:"varint,4,opt,name=effect,proto3,enum=devcloud.mcenter.role.EffectType" json:"effect" bson:"effect"` // 服务ID // @gotags: bson:"service_id" json:"service_id" ServiceId string `protobuf:"bytes,5,opt,name=service_id,json=serviceId,proto3" json:"service_id" bson:"service_id"` // 资源列表 // @gotags: bson:"resource_name" json:"resource_name" ResourceName string `protobuf:"bytes,6,opt,name=resource_name,json=resourceName,proto3" json:"resource_name" bson:"resource_name"` // 维度, action // @gotags: bson:"label_key" json:"label_key" LabelKey string `protobuf:"bytes,7,opt,name=label_key,json=labelKey,proto3" json:"label_key" bson:"label_key"` // 适配所有值 // @gotags: bson:"match_all" json:"match_all" MatchAll bool `protobuf:"varint,8,opt,name=match_all,json=matchAll,proto3" json:"match_all" bson:"match_all"` // 标识值, [list, create, update, get] // @gotags: bson:"label_values" json:"label_values" LabelValues []string `protobuf:"bytes,9,rep,name=label_values,json=labelValues,proto3" json:"label_values" bson:"label_values"` // contains filtered or unexported fields }
用户对那个服务的那个接口 由访问权限 用户的功能的直接绑定? 后面服务更新,添加一个接口 如何才能解构 功能与权限的直接绑定? Lable, 采用标签进行解构 注册上来一个功能条目: 服务 接口 resource:a, action:list , role: permisson: a:list 由收起(a:*)
func (*Spec) Descriptor
deprecated
func (*Spec) GetCreateBy ¶
func (*Spec) GetEffect ¶
func (x *Spec) GetEffect() EffectType
func (*Spec) GetLabelKey ¶
func (*Spec) GetLabelValues ¶
func (*Spec) GetMatchAll ¶
func (*Spec) GetResourceName ¶
func (*Spec) GetServiceId ¶
func (*Spec) ProtoMessage ¶
func (*Spec) ProtoMessage()
func (*Spec) ProtoReflect ¶
func (x *Spec) ProtoReflect() protoreflect.Message
type UnimplementedRPCServer ¶
type UnimplementedRPCServer struct { }
UnimplementedRPCServer must be embedded to have forward compatible implementations.
func (UnimplementedRPCServer) DescribePermission ¶
func (UnimplementedRPCServer) DescribePermission(context.Context, *DescribePermissionRequest) (*Permission, error)
func (UnimplementedRPCServer) DescribeRole ¶
func (UnimplementedRPCServer) DescribeRole(context.Context, *DescribeRoleRequest) (*Role, error)
func (UnimplementedRPCServer) QueryPermission ¶
func (UnimplementedRPCServer) QueryPermission(context.Context, *QueryPermissionRequest) (*PermissionSet, error)
func (UnimplementedRPCServer) QueryRole ¶
func (UnimplementedRPCServer) QueryRole(context.Context, *QueryRoleRequest) (*RoleSet, error)
type UnsafeRPCServer ¶
type UnsafeRPCServer interface {
// contains filtered or unexported methods
}
UnsafeRPCServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to RPCServer will result in compilation errors.
type UpdatePermissionRequest ¶
type UpdatePermissionRequest struct { // permission id // @gotags: json:"id" validate:"required,lte=64" Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" validate:"required,lte=64"` // 维度 // @gotags: json:"label_key" LabelKey string `protobuf:"bytes,2,opt,name=label_key,json=labelKey,proto3" json:"label_key"` // 适配所有值 // @gotags: json:"match_all" MatchAll bool `protobuf:"varint,3,opt,name=match_all,json=matchAll,proto3" json:"match_all"` // 标识值 // @gotags: json:"label_values" LabelValues []string `protobuf:"bytes,4,rep,name=label_values,json=labelValues,proto3" json:"label_values"` // contains filtered or unexported fields }
func (*UpdatePermissionRequest) Descriptor
deprecated
func (*UpdatePermissionRequest) Descriptor() ([]byte, []int)
Deprecated: Use UpdatePermissionRequest.ProtoReflect.Descriptor instead.
func (*UpdatePermissionRequest) GetId ¶
func (x *UpdatePermissionRequest) GetId() string
func (*UpdatePermissionRequest) GetLabelKey ¶
func (x *UpdatePermissionRequest) GetLabelKey() string
func (*UpdatePermissionRequest) GetLabelValues ¶
func (x *UpdatePermissionRequest) GetLabelValues() []string
func (*UpdatePermissionRequest) GetMatchAll ¶
func (x *UpdatePermissionRequest) GetMatchAll() bool
func (*UpdatePermissionRequest) ProtoMessage ¶
func (*UpdatePermissionRequest) ProtoMessage()
func (*UpdatePermissionRequest) ProtoReflect ¶
func (x *UpdatePermissionRequest) ProtoReflect() protoreflect.Message
func (*UpdatePermissionRequest) Reset ¶
func (x *UpdatePermissionRequest) Reset()
func (*UpdatePermissionRequest) String ¶
func (x *UpdatePermissionRequest) String() string
func (*UpdatePermissionRequest) Validate ¶
func (req *UpdatePermissionRequest) Validate() error