role

package
v0.0.0-...-f4276bb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2023 License: MIT Imports: 9 Imported by: 0

README

角色管理

  • 名称
  • Endpoint Match(Label), Service:resource:action, cmdb:secret list

Documentation

Index

Constants

View Source
const (
	Rpc_CreateRole_FullMethodName = "/go11.devcloud_mini.role.Rpc/CreateRole"
	Rpc_QueryRole_FullMethodName  = "/go11.devcloud_mini.role.Rpc/QueryRole"
)
View Source
const AppName = "roles"

Variables

View Source
var File_mcenter_apps_role_pb_model_proto protoreflect.FileDescriptor
View Source
var File_mcenter_apps_role_pb_rpc_proto protoreflect.FileDescriptor
View Source
var Rpc_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "go11.devcloud_mini.role.Rpc",
	HandlerType: (*RpcServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateRole",
			Handler:    _Rpc_CreateRole_Handler,
		},
		{
			MethodName: "QueryRole",
			Handler:    _Rpc_QueryRole_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "mcenter/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 Permission

type Permission struct {

	// 服务
	// @gotags: json:"service" bson:"service" validate:"required"
	Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service" bson:"service" validate:"required"`
	// 资源
	// @gotags: json:"resource" bson:"resource" validate:"required"
	Resource string `protobuf:"bytes,2,opt,name=resource,proto3" json:"resource" bson:"resource" validate:"required"`
	// 操作
	// @gotags: json:"action" bson:"action" validate:"required"
	Action []string `protobuf:"bytes,3,rep,name=action,proto3" json:"action" bson:"action" validate:"required"`
	// contains filtered or unexported fields
}

cmdb sercret list

func (*Permission) Descriptor deprecated

func (*Permission) Descriptor() ([]byte, []int)

Deprecated: Use Permission.ProtoReflect.Descriptor instead.

func (*Permission) GetAction

func (x *Permission) GetAction() []string

func (*Permission) GetResource

func (x *Permission) GetResource() string

func (*Permission) GetService

func (x *Permission) GetService() string

func (*Permission) HasAction

func (p *Permission) HasAction(aciton string) bool

func (*Permission) HasPerm

func (p *Permission) HasPerm(service, resource, action string) bool

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 QueryRoleRequest

type QueryRoleRequest struct {

	// 哪些Id
	RoleIds []string `protobuf:"bytes,1,rep,name=role_ids,json=roleIds,proto3" json:"role_ids,omitempty"`
	// contains filtered or unexported fields
}

func (*QueryRoleRequest) Descriptor deprecated

func (*QueryRoleRequest) Descriptor() ([]byte, []int)

Deprecated: Use QueryRoleRequest.ProtoReflect.Descriptor instead.

func (*QueryRoleRequest) GetRoleIds

func (x *QueryRoleRequest) GetRoleIds() []string

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 Role

type Role struct {

	// 元数据信息
	// @gotags: json:"meta" bson:",inline"
	Meta *resource.Meta `protobuf:"bytes,1,opt,name=meta,proto3" json:"meta" bson:",inline"`
	// 角色定义
	// @gotags: json:"spec" bson:",inline"
	Spec *RoleSpec `protobuf:"bytes,2,opt,name=spec,proto3" json:"spec" bson:",inline"`
	// contains filtered or unexported fields
}

func NewRole

func NewRole(spec *RoleSpec) *Role

func (*Role) Descriptor deprecated

func (*Role) Descriptor() ([]byte, []int)

Deprecated: Use Role.ProtoReflect.Descriptor instead.

func (*Role) GetMeta

func (x *Role) GetMeta() *resource.Meta

func (*Role) GetSpec

func (x *Role) GetSpec() *RoleSpec

func (*Role) HasPerm

func (r *Role) HasPerm(service, resource, action string) bool

func (*Role) ProtoMessage

func (*Role) ProtoMessage()

func (*Role) ProtoReflect

func (x *Role) ProtoReflect() protoreflect.Message

func (*Role) Reset

func (x *Role) Reset()

func (*Role) String

func (x *Role) String() string

type RoleSet

type RoleSet struct {
	Items []*Role `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
	// contains filtered or unexported fields
}

func (*RoleSet) Descriptor deprecated

func (*RoleSet) Descriptor() ([]byte, []int)

Deprecated: Use RoleSet.ProtoReflect.Descriptor instead.

func (*RoleSet) GetItems

func (x *RoleSet) GetItems() []*Role

func (*RoleSet) ProtoMessage

func (*RoleSet) ProtoMessage()

func (*RoleSet) ProtoReflect

func (x *RoleSet) ProtoReflect() protoreflect.Message

func (*RoleSet) Reset

func (x *RoleSet) Reset()

func (*RoleSet) String

func (x *RoleSet) String() string

type RoleSpec

type RoleSpec struct {

	// 角色的权限列表
	// @gotags: json:"name" bson:"name"
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name" bson:"name"`
	// 角色的权限列表
	// @gotags: json:"description" bson:"description"
	Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description" bson:"description"`
	// 角色的权限列表
	// @gotags: json:"permissons" bson:"permissons"
	Permissons []*Permission `protobuf:"bytes,4,rep,name=permissons,proto3" json:"permissons" bson:"permissons"`
	// contains filtered or unexported fields
}

func (*RoleSpec) Descriptor deprecated

func (*RoleSpec) Descriptor() ([]byte, []int)

Deprecated: Use RoleSpec.ProtoReflect.Descriptor instead.

func (*RoleSpec) GetDescription

func (x *RoleSpec) GetDescription() string

func (*RoleSpec) GetName

func (x *RoleSpec) GetName() string

func (*RoleSpec) GetPermissons

func (x *RoleSpec) GetPermissons() []*Permission

func (*RoleSpec) ProtoMessage

func (*RoleSpec) ProtoMessage()

func (*RoleSpec) ProtoReflect

func (x *RoleSpec) ProtoReflect() protoreflect.Message

func (*RoleSpec) Reset

func (x *RoleSpec) Reset()

func (*RoleSpec) String

func (x *RoleSpec) String() string

type RpcClient

type RpcClient interface {
	// 创建角色
	CreateRole(ctx context.Context, in *RoleSpec, opts ...grpc.CallOption) (*Role, error)
	// 查询角色列表
	QueryRole(ctx context.Context, in *QueryRoleRequest, opts ...grpc.CallOption) (*RoleSet, 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 {
	// 创建角色
	CreateRole(context.Context, *RoleSpec) (*Role, error)
	// 查询角色列表
	QueryRole(context.Context, *QueryRoleRequest) (*RoleSet, error)
	// contains filtered or unexported methods
}

RpcServer is the server API for Rpc service. All implementations must embed UnimplementedRpcServer for forward compatibility

type Service

type Service interface {
	RpcServer
}

type UnimplementedRpcServer

type UnimplementedRpcServer struct {
}

UnimplementedRpcServer must be embedded to have forward compatible implementations.

func (UnimplementedRpcServer) CreateRole

func (UnimplementedRpcServer) QueryRole

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL