role

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName          = "role"
	DefaultNamespace = "default"
)

Variables

View Source
var (
	DescribeBy_name = map[int32]string{
		0: "UserName",
		1: "ID",
	}
	DescribeBy_value = map[string]int32{
		"UserName": 0,
		"ID":       1,
	}
)

Enum value maps for DescribeBy.

View Source
var File_apps_role_pb_role_proto protoreflect.FileDescriptor
View Source
var Service_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "keyauth.role.Service",
	HandlerType: (*ServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "QueryRole",
			Handler:    _Service_QueryRole_Handler,
		},
		{
			MethodName: "DescribeRole",
			Handler:    _Service_DescribeRole_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "apps/role/pb/role.proto",
}

Service_ServiceDesc is the grpc.ServiceDesc for Service service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterServiceServer

func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)

Types

type CreateRoleRequest

type CreateRoleRequest struct {

	// @gotags: json:"name"  bson:"name" validate:"required"
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name" bson:"name" validate:"required"`
	// @gotags: json:"description"  bson:"description"
	Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description" bson:"description"`
	// @gotags: json:"allow_All"  bson:"allow_All"
	Allow_All bool `protobuf:"varint,2,opt,name=allow_All,json=allowAll,proto3" json:"allow_All" bson:"allow_All"`
	// @gotags: json:"service_permissions"  bson:"service_permissions"
	ServicePermissions []*ServicePermission `` /* 132-byte string literal not displayed */
	// @gotags: json:"namespace"  bson:"namespace"
	Namespace string `protobuf:"bytes,8,opt,name=namespace,proto3" json:"namespace" bson:"namespace"`
	// contains filtered or unexported fields
}

func NewDefaultCreateRequest

func NewDefaultCreateRequest() *CreateRoleRequest

func (*CreateRoleRequest) AddPermission added in v1.4.0

func (r *CreateRoleRequest) AddPermission()

func (*CreateRoleRequest) Descriptor deprecated

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

Deprecated: Use CreateRoleRequest.ProtoReflect.Descriptor instead.

func (*CreateRoleRequest) GetAllow_All

func (x *CreateRoleRequest) GetAllow_All() bool

func (*CreateRoleRequest) GetDescription

func (x *CreateRoleRequest) GetDescription() string

func (*CreateRoleRequest) GetName

func (x *CreateRoleRequest) GetName() string

func (*CreateRoleRequest) GetNamespace

func (x *CreateRoleRequest) GetNamespace() string

func (*CreateRoleRequest) GetServicePermissions

func (x *CreateRoleRequest) GetServicePermissions() []*ServicePermission

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

func (*CreateRoleRequest) Validate

func (c *CreateRoleRequest) Validate() error

type DeleteRoleRequest

type DeleteRoleRequest struct {

	// @gotags: json:"id"
	Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id"`
	// @gotags: json:"namespace"
	Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace"`
	// contains filtered or unexported fields
}

func NewDeleteRoleRequestById

func NewDeleteRoleRequestById(id string) *DeleteRoleRequest

func (*DeleteRoleRequest) Descriptor deprecated

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

Deprecated: Use DeleteRoleRequest.ProtoReflect.Descriptor instead.

func (*DeleteRoleRequest) GetId

func (x *DeleteRoleRequest) GetId() string

func (*DeleteRoleRequest) GetNamespace

func (x *DeleteRoleRequest) GetNamespace() 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 DescribeBy

type DescribeBy int32
const (
	DescribeBy_UserName DescribeBy = 0
	DescribeBy_ID       DescribeBy = 1
)

func (DescribeBy) Descriptor

func (DescribeBy) Descriptor() protoreflect.EnumDescriptor

func (DescribeBy) Enum

func (x DescribeBy) Enum() *DescribeBy

func (DescribeBy) EnumDescriptor deprecated

func (DescribeBy) EnumDescriptor() ([]byte, []int)

Deprecated: Use DescribeBy.Descriptor instead.

func (DescribeBy) Number

func (x DescribeBy) Number() protoreflect.EnumNumber

func (DescribeBy) String

func (x DescribeBy) String() string

func (DescribeBy) Type

type DescribeRoleRequest

type DescribeRoleRequest struct {

	// @gotags: json:"id"
	Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id"`
	// @gotags: json:"namespace"
	Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace"`
	// 关键字参数
	// @gotags: json:"role_name"
	RoleName string `protobuf:"bytes,2,opt,name=role_name,json=roleName,proto3" json:"role_name"`
	// @gotags: json:"describe_by"
	DescribeBy DescribeBy `protobuf:"varint,4,opt,name=describe_by,json=describeBy,proto3,enum=keyauth.role.DescribeBy" json:"describe_by"`
	// contains filtered or unexported fields
}

func NewDeleteById

func NewDeleteById(req *DeleteRoleRequest) *DescribeRoleRequest

func NewDescribeRequest

func NewDescribeRequest() *DescribeRoleRequest

func NewDescribeRoleRequest

func NewDescribeRoleRequest(id string) *DescribeRoleRequest

func NewUpdateById

func NewUpdateById(req *UpdateRoleRequest) *DescribeRoleRequest

func (*DescribeRoleRequest) Descriptor deprecated

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

Deprecated: Use DescribeRoleRequest.ProtoReflect.Descriptor instead.

func (*DescribeRoleRequest) GetDescribeBy

func (x *DescribeRoleRequest) GetDescribeBy() DescribeBy

func (*DescribeRoleRequest) GetId

func (x *DescribeRoleRequest) GetId() string

func (*DescribeRoleRequest) GetNamespace

func (x *DescribeRoleRequest) GetNamespace() string

func (*DescribeRoleRequest) GetRoleName

func (x *DescribeRoleRequest) GetRoleName() string

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 (d *DescribeRoleRequest) Validate() error

type PermissionRequest

type PermissionRequest struct {

	// @gotags: json:"resource_name"  bson:"resource_name" validate:"required"
	ResourceName string `` /* 128-byte string literal not displayed */
	// @gotags: json:"service_name"  bson:"service_name" validate:"required"
	ServiceName string `protobuf:"bytes,2,opt,name=service_name,json=serviceName,proto3" json:"service_name" bson:"service_name" validate:"required"`
	// @gotags: json:"action"  bson:"action" validate:"required"
	Action string `protobuf:"bytes,3,opt,name=action,proto3" json:"action" bson:"action" validate:"required"`
	// contains filtered or unexported fields
}

func NewPermission

func NewPermission(service, resource, action string) *PermissionRequest

func (*PermissionRequest) Descriptor deprecated

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

Deprecated: Use PermissionRequest.ProtoReflect.Descriptor instead.

func (*PermissionRequest) GetAction

func (x *PermissionRequest) GetAction() string

func (*PermissionRequest) GetResourceName

func (x *PermissionRequest) GetResourceName() string

func (*PermissionRequest) GetServiceName

func (x *PermissionRequest) GetServiceName() string

func (*PermissionRequest) ProtoMessage

func (*PermissionRequest) ProtoMessage()

func (*PermissionRequest) ProtoReflect

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

func (*PermissionRequest) Reset

func (x *PermissionRequest) Reset()

func (*PermissionRequest) String

func (x *PermissionRequest) String() string

type QueryRoleRequest

type QueryRoleRequest struct {

	// 分页参数
	// @gotags: json:"page"
	Page *request.PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page"`
	// 关键字参数
	// @gotags: json:"role_names"
	RoleNames []string `protobuf:"bytes,2,rep,name=role_names,json=roleNames,proto3" json:"role_names"`
	// @gotags: json:"namespace"
	Namespace string `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace"`
	// contains filtered or unexported fields
}

func NewQueryRoleRequest

func NewQueryRoleRequest(roles []string) *QueryRoleRequest

func NewQueryRoleRequestFromHTTP

func NewQueryRoleRequestFromHTTP(r *http.Request) *QueryRoleRequest

func (*QueryRoleRequest) Descriptor deprecated

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

Deprecated: Use QueryRoleRequest.ProtoReflect.Descriptor instead.

func (*QueryRoleRequest) GetNamespace

func (x *QueryRoleRequest) GetNamespace() string

func (*QueryRoleRequest) GetPage

func (x *QueryRoleRequest) GetPage() *request.PageRequest

func (*QueryRoleRequest) GetRoleNames

func (x *QueryRoleRequest) GetRoleNames() []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 ResourcePermission

type ResourcePermission struct {

	// @gotags: json:"resource_name"  bson:"resource_name"
	ResourceName string `protobuf:"bytes,1,opt,name=resource_name,json=resourceName,proto3" json:"resource_name" bson:"resource_name"`
	// @gotags: json:"ations"  bson:"actions"
	Actions []string `protobuf:"bytes,2,rep,name=actions,proto3" json:"ations" bson:"actions"`
	// contains filtered or unexported fields
}

资源操作权限

func (*ResourcePermission) Descriptor deprecated

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

Deprecated: Use ResourcePermission.ProtoReflect.Descriptor instead.

func (*ResourcePermission) GetActions

func (x *ResourcePermission) GetActions() []string

func (*ResourcePermission) GetResourceName

func (x *ResourcePermission) GetResourceName() string

func (*ResourcePermission) HasResourcePermission

func (p *ResourcePermission) HasResourcePermission(per *PermissionRequest) bool

func (*ResourcePermission) ProtoMessage

func (*ResourcePermission) ProtoMessage()

func (*ResourcePermission) ProtoReflect

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

func (*ResourcePermission) Reset

func (x *ResourcePermission) Reset()

func (*ResourcePermission) String

func (x *ResourcePermission) String() string

type Role

type Role struct {

	// @gotags: json:"id"  bson:"_id"
	Id string `protobuf:"bytes,9,opt,name=id,proto3" json:"id" bson:"_id"`
	// @gotags: json:"create_at"  bson:"create_at"
	CreateAt int64 `protobuf:"varint,2,opt,name=create_at,json=createAt,proto3" json:"create_at" bson:"create_at"`
	// @gotags: json:"create_by"  bson:"create_by"
	CreateBy string `protobuf:"bytes,3,opt,name=create_by,json=createBy,proto3" json:"create_by" bson:"create_by"`
	// @gotags: json:"update_at"  bson:"update_at"
	UpdateAt int64 `protobuf:"varint,4,opt,name=update_at,json=updateAt,proto3" json:"update_at" bson:"update_at"`
	// @gotags: json:"spec"  bson:"spec"
	Spec *CreateRoleRequest `protobuf:"bytes,5,opt,name=spec,proto3" json:"spec" bson:"spec"`
	// contains filtered or unexported fields
}

func NewDefaultRole

func NewDefaultRole(req *CreateRoleRequest) *Role

func NewRole

func NewRole() *Role

func (*Role) Descriptor deprecated

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

Deprecated: Use Role.ProtoReflect.Descriptor instead.

func (*Role) GetCreateAt

func (x *Role) GetCreateAt() int64

func (*Role) GetCreateBy

func (x *Role) GetCreateBy() string

func (*Role) GetId

func (x *Role) GetId() string

func (*Role) GetSpec

func (x *Role) GetSpec() *CreateRoleRequest

func (*Role) GetUpdateAt

func (x *Role) GetUpdateAt() int64

func (*Role) HasRolePermission

func (r *Role) HasRolePermission(per *PermissionRequest) bool

func (*Role) Patch

func (r *Role) Patch(req *UpdateRoleRequest) error

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

func (*Role) Update

func (r *Role) Update(req *UpdateRoleRequest)

type RoleResponse

type RoleResponse struct {

	// @gotags: json:"description"  bson:"description"
	Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description" bson:"description"`
	// @gotags: json:"role_name"  bson:"role_name"
	RoleName string `protobuf:"bytes,2,opt,name=role_name,json=roleName,proto3" json:"role_name" bson:"role_name"`
	// contains filtered or unexported fields
}

func (*RoleResponse) Descriptor deprecated

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

Deprecated: Use RoleResponse.ProtoReflect.Descriptor instead.

func (*RoleResponse) GetDescription

func (x *RoleResponse) GetDescription() string

func (*RoleResponse) GetRoleName

func (x *RoleResponse) GetRoleName() string

func (*RoleResponse) ProtoMessage

func (*RoleResponse) ProtoMessage()

func (*RoleResponse) ProtoReflect

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

func (*RoleResponse) Reset

func (x *RoleResponse) Reset()

func (*RoleResponse) String

func (x *RoleResponse) String() string

type RoleSet

type RoleSet struct {

	// @gotags: json:"total"  bson:"total"
	Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total" bson:"total"`
	// @gotags: json:"items"  bson:"items"
	Items []*Role `protobuf:"bytes,2,rep,name=items,proto3" json:"items" bson:"items"`
	// contains filtered or unexported fields
}

func NewRoleSet

func NewRoleSet() *RoleSet

func (*RoleSet) Add

func (s *RoleSet) Add(r *Role)

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) GetTotal

func (x *RoleSet) GetTotal() int64

func (*RoleSet) NewPermission

func (r *RoleSet) NewPermission(per *PermissionRequest) (bool, *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 Service

type Service interface {
	ServiceServer
	CreateRole(context.Context, *CreateRoleRequest) (*Role, error)
	UpdateRole(context.Context, *UpdateRoleRequest) (*Role, error)
	DeleteRole(context.Context, *DeleteRoleRequest) (*Role, error)
}

type ServiceClient

type ServiceClient interface {
	QueryRole(ctx context.Context, in *QueryRoleRequest, opts ...grpc.CallOption) (*RoleSet, error)
	DescribeRole(ctx context.Context, in *DescribeRoleRequest, opts ...grpc.CallOption) (*Role, error)
}

ServiceClient is the client API for Service 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 NewServiceClient

func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient

type ServicePermission

type ServicePermission struct {

	// @gotags: json:"service_name"  bson:"service_name" validate:"required"
	ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name" bson:"service_name" validate:"required"`
	// @gotags: json:"resource_permissions"  bson:"resource_permissions" validate:"required"
	ResourcePermissions []*ResourcePermission `` /* 156-byte string literal not displayed */
	// contains filtered or unexported fields
}

服务操作权限

func (*ServicePermission) Descriptor deprecated

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

Deprecated: Use ServicePermission.ProtoReflect.Descriptor instead.

func (*ServicePermission) GetResourcePermissions

func (x *ServicePermission) GetResourcePermissions() []*ResourcePermission

func (*ServicePermission) GetServiceName

func (x *ServicePermission) GetServiceName() string

func (*ServicePermission) HasServicePermission

func (p *ServicePermission) HasServicePermission(per *PermissionRequest) bool

func (*ServicePermission) ProtoMessage

func (*ServicePermission) ProtoMessage()

func (*ServicePermission) ProtoReflect

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

func (*ServicePermission) Reset

func (x *ServicePermission) Reset()

func (*ServicePermission) String

func (x *ServicePermission) String() string

type ServiceServer

type ServiceServer interface {
	QueryRole(context.Context, *QueryRoleRequest) (*RoleSet, error)
	DescribeRole(context.Context, *DescribeRoleRequest) (*Role, error)
	// contains filtered or unexported methods
}

ServiceServer is the server API for Service service. All implementations must embed UnimplementedServiceServer for forward compatibility

type UnimplementedServiceServer

type UnimplementedServiceServer struct {
}

UnimplementedServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedServiceServer) DescribeRole

func (UnimplementedServiceServer) QueryRole

type UnsafeServiceServer

type UnsafeServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ServiceServer will result in compilation errors.

type UpdateRoleRequest

type UpdateRoleRequest struct {

	// user id
	// @gotags: json:"id"
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"`
	// 更新模式
	// @gotags: json:"update_mode"
	UpdateMode request1.UpdateMode `protobuf:"varint,2,opt,name=update_mode,json=updateMode,proto3,enum=infraboard.mcube.request.UpdateMode" json:"update_mode"`
	// 更新时间
	// @gotags: json:"update_at"
	UpdateAt int64              `protobuf:"varint,4,opt,name=update_at,json=updateAt,proto3" json:"update_at"`
	Spec     *CreateRoleRequest `protobuf:"bytes,5,opt,name=spec,proto3" json:"spec,omitempty"`
	// contains filtered or unexported fields
}

func NewPatchRoleRequest

func NewPatchRoleRequest(id string) *UpdateRoleRequest

func NewPutRoleRequest

func NewPutRoleRequest(id string) *UpdateRoleRequest

func (*UpdateRoleRequest) Descriptor deprecated

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

Deprecated: Use UpdateRoleRequest.ProtoReflect.Descriptor instead.

func (*UpdateRoleRequest) GetId

func (x *UpdateRoleRequest) GetId() string

func (*UpdateRoleRequest) GetSpec

func (x *UpdateRoleRequest) GetSpec() *CreateRoleRequest

func (*UpdateRoleRequest) GetUpdateAt

func (x *UpdateRoleRequest) GetUpdateAt() int64

func (*UpdateRoleRequest) GetUpdateMode

func (x *UpdateRoleRequest) GetUpdateMode() request1.UpdateMode

func (*UpdateRoleRequest) ProtoMessage

func (*UpdateRoleRequest) ProtoMessage()

func (*UpdateRoleRequest) ProtoReflect

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

func (*UpdateRoleRequest) Reset

func (x *UpdateRoleRequest) Reset()

func (*UpdateRoleRequest) String

func (x *UpdateRoleRequest) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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