user

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2022 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName = "user"
)
View Source
const (
	// DefaultExiresDays 默认多少天无登录系统就冻结该用户
	DefaultExiresDays = 90
)

Variables

View Source
var (
	Gender_name = map[int32]string{
		0: "UNKNOWN",
		1: "MALE",
		2: "FEMALE",
	}
	Gender_value = map[string]int32{
		"UNKNOWN": 0,
		"MALE":    1,
		"FEMALE":  2,
	}
)

Enum value maps for Gender.

View Source
var (
	CreateType_name = map[int32]string{
		0: "USER_REGISTRY",
		1: "DOMAIN_CREATED",
		2: "LDAP_SYNC",
		3: "WXWORK_SYNC",
	}
	CreateType_value = map[string]int32{
		"USER_REGISTRY":  0,
		"DOMAIN_CREATED": 1,
		"LDAP_SYNC":      2,
		"WXWORK_SYNC":    3,
	}
)

Enum value maps for CreateType.

View Source
var File_apps_user_pb_enum_proto protoreflect.FileDescriptor
View Source
var File_apps_user_pb_request_proto protoreflect.FileDescriptor
View Source
var File_apps_user_pb_service_proto protoreflect.FileDescriptor
View Source
var File_apps_user_pb_user_proto protoreflect.FileDescriptor
View Source
var Service_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "infraboard.keyauth.user.Service",
	HandlerType: (*ServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "QueryAccount",
			Handler:    _Service_QueryAccount_Handler,
		},
		{
			MethodName: "DescribeAccount",
			Handler:    _Service_DescribeAccount_Handler,
		},
		{
			MethodName: "CreateAccount",
			Handler:    _Service_CreateAccount_Handler,
		},
		{
			MethodName: "BlockAccount",
			Handler:    _Service_BlockAccount_Handler,
		},
		{
			MethodName: "UnBlockAccount",
			Handler:    _Service_UnBlockAccount_Handler,
		},
		{
			MethodName: "DeleteAccount",
			Handler:    _Service_DeleteAccount_Handler,
		},
		{
			MethodName: "UpdateAccountProfile",
			Handler:    _Service_UpdateAccountProfile_Handler,
		},
		{
			MethodName: "UpdateAccountPassword",
			Handler:    _Service_UpdateAccountPassword_Handler,
		},
		{
			MethodName: "GeneratePassword",
			Handler:    _Service_GeneratePassword_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "apps/user/pb/service.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 HttpEntry

func HttpEntry() *http.EntrySet

HttpEntry todo

func RegisterServiceServer

func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)

Types

type BlockAccountRequest

type BlockAccountRequest struct {

	// @gotags: json:"account"
	Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account"`
	// @gotags: json:"reason"
	Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason"`
	// contains filtered or unexported fields
}

BlockAccountRequest 冻结用户

func NewBlockAccountRequest

func NewBlockAccountRequest(account, reason string) *BlockAccountRequest

NewBlockAccountRequest todo

func (*BlockAccountRequest) Descriptor deprecated

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

Deprecated: Use BlockAccountRequest.ProtoReflect.Descriptor instead.

func (*BlockAccountRequest) GetAccount

func (x *BlockAccountRequest) GetAccount() string

func (*BlockAccountRequest) GetReason

func (x *BlockAccountRequest) GetReason() string

func (*BlockAccountRequest) ProtoMessage

func (*BlockAccountRequest) ProtoMessage()

func (*BlockAccountRequest) ProtoReflect

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

func (*BlockAccountRequest) Reset

func (x *BlockAccountRequest) Reset()

func (*BlockAccountRequest) String

func (x *BlockAccountRequest) String() string

func (*BlockAccountRequest) Validate

func (req *BlockAccountRequest) Validate() error

type CreateAccountRequest

type CreateAccountRequest struct {

	// 域信息
	// @gotags: json:"domain" validate:"required"
	Domain string `protobuf:"bytes,9,opt,name=domain,proto3" json:"domain" validate:"required"`
	// 创建方式
	// @gotags: json:"create_type"
	CreateType CreateType `protobuf:"varint,1,opt,name=create_type,json=createType,proto3,enum=infraboard.keyauth.user.CreateType" json:"create_type"`
	// 用户类型
	// @gotags: json:"user_type"
	UserType types.UserType `protobuf:"varint,2,opt,name=user_type,json=userType,proto3,enum=infraboard.keyauth.user.UserType" json:"user_type"`
	// 用户所属部门
	// @gotags: json:"department_id" validate:"lte=200"
	DepartmentId string `protobuf:"bytes,3,opt,name=department_id,json=departmentId,proto3" json:"department_id" validate:"lte=200"`
	// 用户账号名称
	// @gotags: json:"account" validate:"required,lte=60"
	Account string `protobuf:"bytes,4,opt,name=account,proto3" json:"account" validate:"required,lte=60"`
	// 用户多久未登录时(天), 冻结改用户, 防止僵尸用户的账号被利用'
	// @gotags: json:"expires_days"
	ExpiresDays int32 `protobuf:"varint,5,opt,name=expires_days,json=expiresDays,proto3" json:"expires_days"`
	// 用户描述
	// @gotags: json:"description"
	Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description"`
	// 数据
	// @gotags: json:"profile"
	Profile *Profile `protobuf:"bytes,7,opt,name=profile,proto3" json:"profile"`
	// 密码相关信息
	// @gotags: json:"password" validate:"required,lte=80"
	Password string `protobuf:"bytes,8,opt,name=password,proto3" json:"password" validate:"required,lte=80"`
	// contains filtered or unexported fields
}

CreateAccountRequest 创建用户请求

func NewCreateUserRequest

func NewCreateUserRequest() *CreateAccountRequest

NewCreateUserRequest 创建请求

func NewCreateUserRequestWithLDAPSync

func NewCreateUserRequestWithLDAPSync(username, password string) *CreateAccountRequest

NewCreateUserRequestWithLDAPSync todo

func NewCreateUserRequestWithWXWORKSync

func NewCreateUserRequestWithWXWORKSync(username, password string) *CreateAccountRequest

NewCreateUserRequestWithWXWORKSync todo

func (*CreateAccountRequest) Descriptor deprecated

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

Deprecated: Use CreateAccountRequest.ProtoReflect.Descriptor instead.

func (*CreateAccountRequest) GetAccount

func (x *CreateAccountRequest) GetAccount() string

func (*CreateAccountRequest) GetCreateType

func (x *CreateAccountRequest) GetCreateType() CreateType

func (*CreateAccountRequest) GetDepartmentId

func (x *CreateAccountRequest) GetDepartmentId() string

func (*CreateAccountRequest) GetDescription

func (x *CreateAccountRequest) GetDescription() string

func (*CreateAccountRequest) GetDomain

func (x *CreateAccountRequest) GetDomain() string

func (*CreateAccountRequest) GetExpiresDays

func (x *CreateAccountRequest) GetExpiresDays() int32

func (*CreateAccountRequest) GetPassword

func (x *CreateAccountRequest) GetPassword() string

func (*CreateAccountRequest) GetProfile

func (x *CreateAccountRequest) GetProfile() *Profile

func (*CreateAccountRequest) GetUserType

func (x *CreateAccountRequest) GetUserType() types.UserType

func (*CreateAccountRequest) ProtoMessage

func (*CreateAccountRequest) ProtoMessage()

func (*CreateAccountRequest) ProtoReflect

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

func (*CreateAccountRequest) Reset

func (x *CreateAccountRequest) Reset()

func (*CreateAccountRequest) String

func (x *CreateAccountRequest) String() string

func (*CreateAccountRequest) Validate

func (req *CreateAccountRequest) Validate() error

Validate 校验请求是否合法

type CreateType

type CreateType int32
const (
	// UserRegistry (user_registry) 用户自己注册的用户
	CreateType_USER_REGISTRY CreateType = 0
	// DOMAIN_CREATED (domain_admin) 域管理员创建的用户
	CreateType_DOMAIN_CREATED CreateType = 1
	// LDAPSync (ldap_sync) LDAP同步的用户
	CreateType_LDAP_SYNC CreateType = 2
	// 企业微信同步的用户;
	CreateType_WXWORK_SYNC CreateType = 3
)

func ParseCreateTypeFromString

func ParseCreateTypeFromString(str string) (CreateType, error)

ParseCreateTypeFromString Parse CreateType from string

func (CreateType) Descriptor

func (CreateType) Descriptor() protoreflect.EnumDescriptor

func (CreateType) Enum

func (x CreateType) Enum() *CreateType

func (CreateType) EnumDescriptor deprecated

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

Deprecated: Use CreateType.Descriptor instead.

func (CreateType) Equal

func (t CreateType) Equal(target CreateType) bool

Equal type compare

func (CreateType) IsIn

func (t CreateType) IsIn(targets ...CreateType) bool

IsIn todo

func (CreateType) MarshalJSON

func (t CreateType) MarshalJSON() ([]byte, error)

MarshalJSON todo

func (CreateType) Number

func (x CreateType) Number() protoreflect.EnumNumber

func (CreateType) String

func (x CreateType) String() string

func (CreateType) Type

func (*CreateType) UnmarshalJSON

func (t *CreateType) UnmarshalJSON(b []byte) error

UnmarshalJSON todo

type DeleteAccountRequest

type DeleteAccountRequest struct {

	// @gotags: json:"account"
	Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account"`
	// contains filtered or unexported fields
}

DeleteAccountRequest 删除账户

func (*DeleteAccountRequest) Descriptor deprecated

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

Deprecated: Use DeleteAccountRequest.ProtoReflect.Descriptor instead.

func (*DeleteAccountRequest) GetAccount

func (x *DeleteAccountRequest) GetAccount() string

func (*DeleteAccountRequest) ProtoMessage

func (*DeleteAccountRequest) ProtoMessage()

func (*DeleteAccountRequest) ProtoReflect

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

func (*DeleteAccountRequest) Reset

func (x *DeleteAccountRequest) Reset()

func (*DeleteAccountRequest) String

func (x *DeleteAccountRequest) String() string

type DescribeAccountRequest

type DescribeAccountRequest struct {

	// 用户账号名称
	// @gotags: json:"account" validate:"required,lte=60"
	Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account" validate:"required,lte=60"`
	// contains filtered or unexported fields
}

DescribeAccountRequest 查询用户详情请求

func NewDescriptAccountRequest

func NewDescriptAccountRequest() *DescribeAccountRequest

NewDescriptAccountRequest 查询详情请求

func NewDescriptAccountRequestWithAccount

func NewDescriptAccountRequestWithAccount(accout string) *DescribeAccountRequest

NewDescriptAccountRequestWithAccount 查询详情请求

func (*DescribeAccountRequest) Descriptor deprecated

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

Deprecated: Use DescribeAccountRequest.ProtoReflect.Descriptor instead.

func (*DescribeAccountRequest) GetAccount

func (x *DescribeAccountRequest) GetAccount() string

func (*DescribeAccountRequest) ProtoMessage

func (*DescribeAccountRequest) ProtoMessage()

func (*DescribeAccountRequest) ProtoReflect

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

func (*DescribeAccountRequest) Reset

func (x *DescribeAccountRequest) Reset()

func (*DescribeAccountRequest) String

func (x *DescribeAccountRequest) String() string

func (*DescribeAccountRequest) Validate

func (req *DescribeAccountRequest) Validate() error

Validate 校验详情查询

type Gender

type Gender int32
const (
	Gender_UNKNOWN Gender = 0
	Gender_MALE    Gender = 1
	Gender_FEMALE  Gender = 2
)

func ParseGenderFromString

func ParseGenderFromString(str string) (Gender, error)

ParseGenderFromString Parse Gender from string

func (Gender) Descriptor

func (Gender) Descriptor() protoreflect.EnumDescriptor

func (Gender) Enum

func (x Gender) Enum() *Gender

func (Gender) EnumDescriptor deprecated

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

Deprecated: Use Gender.Descriptor instead.

func (Gender) Equal

func (t Gender) Equal(target Gender) bool

Equal type compare

func (Gender) IsIn

func (t Gender) IsIn(targets ...Gender) bool

IsIn todo

func (Gender) MarshalJSON

func (t Gender) MarshalJSON() ([]byte, error)

MarshalJSON todo

func (Gender) Number

func (x Gender) Number() protoreflect.EnumNumber

func (Gender) String

func (x Gender) String() string

func (Gender) Type

func (Gender) Type() protoreflect.EnumType

func (*Gender) UnmarshalJSON

func (t *Gender) UnmarshalJSON(b []byte) error

UnmarshalJSON todo

type GeneratePasswordRequest

type GeneratePasswordRequest struct {

	// @gotags: json:"length"
	Length int32 `protobuf:"varint,1,opt,name=length,proto3" json:"length"`
	// @gotags: json:"domain"
	Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain"`
	// contains filtered or unexported fields
}

GeneratePasswordRequest todo

func NewGeneratePasswordRequest

func NewGeneratePasswordRequest() *GeneratePasswordRequest

NewGeneratePasswordRequest todo

func (*GeneratePasswordRequest) Descriptor deprecated

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

Deprecated: Use GeneratePasswordRequest.ProtoReflect.Descriptor instead.

func (*GeneratePasswordRequest) GetDomain

func (x *GeneratePasswordRequest) GetDomain() string

func (*GeneratePasswordRequest) GetLength

func (x *GeneratePasswordRequest) GetLength() int32

func (*GeneratePasswordRequest) ProtoMessage

func (*GeneratePasswordRequest) ProtoMessage()

func (*GeneratePasswordRequest) ProtoReflect

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

func (*GeneratePasswordRequest) Reset

func (x *GeneratePasswordRequest) Reset()

func (*GeneratePasswordRequest) String

func (x *GeneratePasswordRequest) String() string

type GeneratePasswordResponse

type GeneratePasswordResponse struct {

	// @gotags: json:"password"
	Password string `protobuf:"bytes,1,opt,name=password,proto3" json:"password"`
	// contains filtered or unexported fields
}

GeneratePasswordResponse todo

func NewGeneratePasswordResponse

func NewGeneratePasswordResponse(password string) *GeneratePasswordResponse

NewGeneratePasswordResponse todo

func (*GeneratePasswordResponse) Descriptor deprecated

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

Deprecated: Use GeneratePasswordResponse.ProtoReflect.Descriptor instead.

func (*GeneratePasswordResponse) GetPassword

func (x *GeneratePasswordResponse) GetPassword() string

func (*GeneratePasswordResponse) ProtoMessage

func (*GeneratePasswordResponse) ProtoMessage()

func (*GeneratePasswordResponse) ProtoReflect

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

func (*GeneratePasswordResponse) Reset

func (x *GeneratePasswordResponse) Reset()

func (*GeneratePasswordResponse) String

func (x *GeneratePasswordResponse) String() string

type Password

type Password struct {

	// hash过后的密码
	// @gotags: bson:"password" json:"password,omitempty"
	Password string `protobuf:"bytes,1,opt,name=password,proto3" json:"password,omitempty" bson:"password"`
	// 密码创建时间
	// @gotags: bson:"create_at" json:"create_at,omitempty"
	CreateAt int64 `protobuf:"varint,2,opt,name=create_at,json=createAt,proto3" json:"create_at,omitempty" bson:"create_at"`
	// 密码更新时间
	// @gotags: bson:"update_at" json:"update_at,omitempty"
	UpdateAt int64 `protobuf:"varint,3,opt,name=update_at,json=updateAt,proto3" json:"update_at,omitempty" bson:"update_at"`
	// 密码需要被重置
	// @gotags: bson:"need_reset" json:"need_reset"
	NeedReset bool `protobuf:"varint,4,opt,name=need_reset,json=needReset,proto3" json:"need_reset" bson:"need_reset"`
	// 需要重置的原因
	// @gotags: bson:"reset_reason" json:"reset_reason"
	ResetReason string `protobuf:"bytes,5,opt,name=reset_reason,json=resetReason,proto3" json:"reset_reason" bson:"reset_reason"`
	// 历史密码
	// @gotags: bson:"history" json:"history,omitempty"
	History []string `protobuf:"bytes,6,rep,name=history,proto3" json:"history,omitempty" bson:"history"`
	// 是否过期
	// @gotags: bson:"-" json:"is_expired"
	IsExpired bool `protobuf:"varint,7,opt,name=is_expired,json=isExpired,proto3" json:"is_expired" bson:"-"`
	// contains filtered or unexported fields
}

func NewHashedPassword

func NewHashedPassword(password string) (*Password, error)

NewHashedPassword 生产hash后的密码对象

func (*Password) CheckPassword

func (p *Password) CheckPassword(password string) error

CheckPassword 判断password 是否正确

func (*Password) Descriptor deprecated

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

Deprecated: Use Password.ProtoReflect.Descriptor instead.

func (*Password) GetCreateAt

func (x *Password) GetCreateAt() int64

func (*Password) GetHistory

func (x *Password) GetHistory() []string

func (*Password) GetIsExpired

func (x *Password) GetIsExpired() bool

func (*Password) GetNeedReset

func (x *Password) GetNeedReset() bool

func (*Password) GetPassword

func (x *Password) GetPassword() string

func (*Password) GetResetReason

func (x *Password) GetResetReason() string

func (*Password) GetUpdateAt

func (x *Password) GetUpdateAt() int64

func (*Password) HistoryCount

func (p *Password) HistoryCount() int

HistoryCount 保存了几个历史密码

func (*Password) IsHistory

func (p *Password) IsHistory(password string) bool

IsHistory 检测是否是历史密码

func (*Password) ProtoMessage

func (*Password) ProtoMessage()

func (*Password) ProtoReflect

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

func (*Password) Reset

func (x *Password) Reset()

func (*Password) SetExpired

func (p *Password) SetExpired()

SetExpired 密码过期

func (*Password) SetNeedReset

func (p *Password) SetNeedReset(format string, a ...interface{})

SetNeedReset 需要被重置

func (*Password) String

func (x *Password) String() string

func (*Password) Update

func (p *Password) Update(new *Password, maxHistory uint, needReset bool)

Update 更新密码

type Profile

type Profile struct {

	// 用户真实姓名
	// @gotags: bson:"real_name" json:"real_name" validate:"lte=10"
	RealName string `protobuf:"bytes,1,opt,name=real_name,json=realName,proto3" json:"real_name" bson:"real_name" validate:"lte=10"`
	// 用户昵称, 用于在界面进行展示
	// @gotags: bson:"nick_name" json:"nick_name" validate:"lte=30"
	NickName string `protobuf:"bytes,2,opt,name=nick_name,json=nickName,proto3" json:"nick_name" bson:"nick_name" validate:"lte=30"`
	// 手机号码, 用户可以通过手机进行注册和密码找回, 还可以通过手机号进行登录
	// @gotags: bson:"phone" json:"phone" validate:"lte=30"
	Phone string `protobuf:"bytes,3,opt,name=phone,proto3" json:"phone" bson:"phone" validate:"lte=30"`
	// 邮箱, 用户可以通过邮箱进行注册和照明密码
	// @gotags: bson:"email" json:"email" validate:"lte=30"
	Email string `protobuf:"bytes,4,opt,name=email,proto3" json:"email" bson:"email" validate:"lte=30"`
	// 用户住址
	// @gotags: bson:"address" json:"address" validate:"lte=120"
	Address string `protobuf:"bytes,5,opt,name=address,proto3" json:"address" bson:"address" validate:"lte=120"`
	// 性别
	// @gotags: bson:"gender" json:"gender" validate:"lte=10"
	Gender Gender `protobuf:"varint,6,opt,name=gender,proto3,enum=infraboard.keyauth.user.Gender" json:"gender" bson:"gender" validate:"lte=10"`
	// 头像
	// @gotags: bson:"avatar" json:"avatar" validate:"lte=300"
	Avatar string `protobuf:"bytes,7,opt,name=avatar,proto3" json:"avatar" bson:"avatar" validate:"lte=300"`
	// 用户使用的语言
	// @gotags: bson:"language" json:"language" validate:"lte=40"
	Language string `protobuf:"bytes,8,opt,name=language,proto3" json:"language" bson:"language" validate:"lte=40"`
	// 用户所在的城市
	// @gotags: bson:"city" json:"city" validate:"lte=40"
	City string `protobuf:"bytes,9,opt,name=city,proto3" json:"city" bson:"city" validate:"lte=40"`
	// 用户所在的省
	// @gotags: bson:"province" json:"province" validate:"lte=40"
	Province string `protobuf:"bytes,10,opt,name=province,proto3" json:"province" bson:"province" validate:"lte=40"`
	// contains filtered or unexported fields
}

Profile todo

func NewProfile

func NewProfile() *Profile

NewProfile todo

func (*Profile) Descriptor deprecated

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

Deprecated: Use Profile.ProtoReflect.Descriptor instead.

func (*Profile) GetAddress

func (x *Profile) GetAddress() string

func (*Profile) GetAvatar

func (x *Profile) GetAvatar() string

func (*Profile) GetCity

func (x *Profile) GetCity() string

func (*Profile) GetEmail

func (x *Profile) GetEmail() string

func (*Profile) GetGender

func (x *Profile) GetGender() Gender

func (*Profile) GetLanguage

func (x *Profile) GetLanguage() string

func (*Profile) GetNickName

func (x *Profile) GetNickName() string

func (*Profile) GetPhone

func (x *Profile) GetPhone() string

func (*Profile) GetProvince

func (x *Profile) GetProvince() string

func (*Profile) GetRealName

func (x *Profile) GetRealName() string

func (*Profile) Patch

func (p *Profile) Patch(data *Profile)

Patch todo

func (*Profile) ProtoMessage

func (*Profile) ProtoMessage()

func (*Profile) ProtoReflect

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

func (*Profile) Reset

func (x *Profile) Reset()

func (*Profile) String

func (x *Profile) String() string

func (*Profile) ValidateInitialized

func (p *Profile) ValidateInitialized() error

ValidateInitialized 判断初始化数据是否准备好了

type QueryAccountRequest

type QueryAccountRequest struct {

	// @gotags: json:"page"
	Page *request.PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page"`
	// @gotags: json:"accounts"
	Accounts []string `protobuf:"bytes,2,rep,name=accounts,proto3" json:"accounts"`
	// @gotags: json:"user_type"
	UserType types.UserType `protobuf:"varint,3,opt,name=user_type,json=userType,proto3,enum=infraboard.keyauth.user.UserType" json:"user_type"`
	// @gotags: json:"namespace_id"
	NamespaceId string `protobuf:"bytes,4,opt,name=namespace_id,json=namespaceId,proto3" json:"namespace_id"`
	// @gotags: json:"with_department"
	WithDepartment bool `protobuf:"varint,5,opt,name=with_department,json=withDepartment,proto3" json:"with_department"`
	// @gotags: json:"department_id"
	DepartmentId string `protobuf:"bytes,6,opt,name=department_id,json=departmentId,proto3" json:"department_id"`
	// @gotags: json:"with_all_sub"
	WithAllSub bool `protobuf:"varint,7,opt,name=with_all_sub,json=withAllSub,proto3" json:"with_all_sub"`
	// @gotags: json:"skip_items"
	SkipItems bool `protobuf:"varint,8,opt,name=skip_items,json=skipItems,proto3" json:"skip_items"`
	// @gotags: json:"keywords"
	Keywords string `protobuf:"bytes,9,opt,name=keywords,proto3" json:"keywords"`
	// @gotags: json:"domain"
	Domain string `protobuf:"bytes,10,opt,name=domain,proto3" json:"domain"`
	// contains filtered or unexported fields
}

QueryAccountRequest 获取子账号列表

func NewNewQueryAccountRequestFromHTTP

func NewNewQueryAccountRequestFromHTTP(r *http.Request) *QueryAccountRequest

NewNewQueryAccountRequestFromHTTP todo

func NewQueryAccountRequest

func NewQueryAccountRequest() *QueryAccountRequest

NewQueryAccountRequest 列表查询请求

func (*QueryAccountRequest) Descriptor deprecated

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

Deprecated: Use QueryAccountRequest.ProtoReflect.Descriptor instead.

func (*QueryAccountRequest) GetAccounts

func (x *QueryAccountRequest) GetAccounts() []string

func (*QueryAccountRequest) GetDepartmentId

func (x *QueryAccountRequest) GetDepartmentId() string

func (*QueryAccountRequest) GetDomain

func (x *QueryAccountRequest) GetDomain() string

func (*QueryAccountRequest) GetKeywords

func (x *QueryAccountRequest) GetKeywords() string

func (*QueryAccountRequest) GetNamespaceId

func (x *QueryAccountRequest) GetNamespaceId() string

func (*QueryAccountRequest) GetPage

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

func (*QueryAccountRequest) GetSkipItems

func (x *QueryAccountRequest) GetSkipItems() bool

func (*QueryAccountRequest) GetUserType

func (x *QueryAccountRequest) GetUserType() types.UserType

func (*QueryAccountRequest) GetWithAllSub

func (x *QueryAccountRequest) GetWithAllSub() bool

func (*QueryAccountRequest) GetWithDepartment

func (x *QueryAccountRequest) GetWithDepartment() bool

func (*QueryAccountRequest) ProtoMessage

func (*QueryAccountRequest) ProtoMessage()

func (*QueryAccountRequest) ProtoReflect

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

func (*QueryAccountRequest) Reset

func (x *QueryAccountRequest) Reset()

func (*QueryAccountRequest) String

func (x *QueryAccountRequest) String() string

func (*QueryAccountRequest) Validate

func (req *QueryAccountRequest) Validate() error

Validate 校验查询参数

type ServiceClient

type ServiceClient interface {
	// 查询用户
	QueryAccount(ctx context.Context, in *QueryAccountRequest, opts ...grpc.CallOption) (*Set, error)
	// 获取账号Profile
	DescribeAccount(ctx context.Context, in *DescribeAccountRequest, opts ...grpc.CallOption) (*User, error)
	// 创建用户
	CreateAccount(ctx context.Context, in *CreateAccountRequest, opts ...grpc.CallOption) (*User, error)
	// 警用账号
	BlockAccount(ctx context.Context, in *BlockAccountRequest, opts ...grpc.CallOption) (*User, error)
	// 警用账号
	UnBlockAccount(ctx context.Context, in *UnBlockAccountRequest, opts ...grpc.CallOption) (*User, error)
	// DeleteAccount 删除用户
	DeleteAccount(ctx context.Context, in *DeleteAccountRequest, opts ...grpc.CallOption) (*User, error)
	// 更新用户
	UpdateAccountProfile(ctx context.Context, in *UpdateAccountRequest, opts ...grpc.CallOption) (*User, error)
	// 修改用户密码
	UpdateAccountPassword(ctx context.Context, in *UpdatePasswordRequest, opts ...grpc.CallOption) (*Password, error)
	// GeneratePassword 生成符合检测强度的随机密码
	GeneratePassword(ctx context.Context, in *GeneratePasswordRequest, opts ...grpc.CallOption) (*GeneratePasswordResponse, 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 ServiceServer

type ServiceServer interface {
	// 查询用户
	QueryAccount(context.Context, *QueryAccountRequest) (*Set, error)
	// 获取账号Profile
	DescribeAccount(context.Context, *DescribeAccountRequest) (*User, error)
	// 创建用户
	CreateAccount(context.Context, *CreateAccountRequest) (*User, error)
	// 警用账号
	BlockAccount(context.Context, *BlockAccountRequest) (*User, error)
	// 警用账号
	UnBlockAccount(context.Context, *UnBlockAccountRequest) (*User, error)
	// DeleteAccount 删除用户
	DeleteAccount(context.Context, *DeleteAccountRequest) (*User, error)
	// 更新用户
	UpdateAccountProfile(context.Context, *UpdateAccountRequest) (*User, error)
	// 修改用户密码
	UpdateAccountPassword(context.Context, *UpdatePasswordRequest) (*Password, error)
	// GeneratePassword 生成符合检测强度的随机密码
	GeneratePassword(context.Context, *GeneratePasswordRequest) (*GeneratePasswordResponse, error)
	// contains filtered or unexported methods
}

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

type Set

type Set 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 []*User `protobuf:"bytes,2,rep,name=items,proto3" json:"items" bson:"items"`
	// contains filtered or unexported fields
}

func NewUserSet

func NewUserSet() *Set

NewUserSet 实例

func (*Set) Add

func (s *Set) Add(u *User)

Add todo

func (*Set) Descriptor deprecated

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

Deprecated: Use Set.ProtoReflect.Descriptor instead.

func (*Set) GetItems

func (x *Set) GetItems() []*User

func (*Set) GetTotal

func (x *Set) GetTotal() int64

func (*Set) ProtoMessage

func (*Set) ProtoMessage()

func (*Set) ProtoReflect

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

func (*Set) Reset

func (x *Set) Reset()

func (*Set) String

func (x *Set) String() string

type Status

type Status struct {

	// 是否冻结
	// @gotags: bson:"locked" json:"locked"
	Locked bool `protobuf:"varint,1,opt,name=locked,proto3" json:"locked" bson:"locked"`
	// 冻结时间
	// @gotags: bson:"locked_time" json:"locked_time,omitempty"
	LockedTime int64 `protobuf:"varint,2,opt,name=locked_time,json=lockedTime,proto3" json:"locked_time,omitempty" bson:"locked_time"`
	// 冻结原因
	// @gotags: bson:"locked_reson" json:"locked_reson,omitempty"
	LockedReson string `protobuf:"bytes,3,opt,name=locked_reson,json=lockedReson,proto3" json:"locked_reson,omitempty" bson:"locked_reson"`
	// 解冻时间
	// @gotags: bson:"unlock_time" json:"unlock_time,omitempty"
	UnlockTime int64 `protobuf:"varint,4,opt,name=unlock_time,json=unlockTime,proto3" json:"unlock_time,omitempty" bson:"unlock_time"`
	// contains filtered or unexported fields
}

Status 用户状态

func (*Status) Descriptor deprecated

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

Deprecated: Use Status.ProtoReflect.Descriptor instead.

func (*Status) GetLocked

func (x *Status) GetLocked() bool

func (*Status) GetLockedReson

func (x *Status) GetLockedReson() string

func (*Status) GetLockedTime

func (x *Status) GetLockedTime() int64

func (*Status) GetUnlockTime

func (x *Status) GetUnlockTime() int64

func (*Status) ProtoMessage

func (*Status) ProtoMessage()

func (*Status) ProtoReflect

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

func (*Status) Reset

func (x *Status) Reset()

func (*Status) String

func (x *Status) String() string

type UnBlockAccountRequest

type UnBlockAccountRequest struct {

	// @gotags: json:"account"
	Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account"`
	// contains filtered or unexported fields
}

UnBlockAccountRequest 解冻用户

func (*UnBlockAccountRequest) Descriptor deprecated

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

Deprecated: Use UnBlockAccountRequest.ProtoReflect.Descriptor instead.

func (*UnBlockAccountRequest) GetAccount

func (x *UnBlockAccountRequest) GetAccount() string

func (*UnBlockAccountRequest) ProtoMessage

func (*UnBlockAccountRequest) ProtoMessage()

func (*UnBlockAccountRequest) ProtoReflect

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

func (*UnBlockAccountRequest) Reset

func (x *UnBlockAccountRequest) Reset()

func (*UnBlockAccountRequest) String

func (x *UnBlockAccountRequest) String() string

func (*UnBlockAccountRequest) Validate

func (req *UnBlockAccountRequest) Validate() error

type UnimplementedServiceServer

type UnimplementedServiceServer struct {
}

UnimplementedServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedServiceServer) BlockAccount

func (UnimplementedServiceServer) CreateAccount

func (UnimplementedServiceServer) DeleteAccount

func (UnimplementedServiceServer) DescribeAccount

func (UnimplementedServiceServer) GeneratePassword

func (UnimplementedServiceServer) QueryAccount

func (UnimplementedServiceServer) UnBlockAccount

func (UnimplementedServiceServer) UpdateAccountPassword

func (UnimplementedServiceServer) UpdateAccountProfile

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 UpdateAccountRequest

type UpdateAccountRequest struct {

	// 更新模式
	// @gotags: json:"update_mode"
	UpdateMode types1.UpdateMode `protobuf:"varint,1,opt,name=update_mode,json=updateMode,proto3,enum=infraboard.keyauth.types.UpdateMode" json:"update_mode"`
	// 用户账号名称
	// @gotags: json:"account" validate:"required,lte=120"
	Account string `protobuf:"bytes,2,opt,name=account,proto3" json:"account" validate:"required,lte=120"`
	// 用户所属部门
	// @gotags: json:"department_id"
	DepartmentId string `protobuf:"bytes,3,opt,name=department_id,json=departmentId,proto3" json:"department_id"`
	// profile 账号profile
	// @gotags: json:"profile"
	Profile *Profile `protobuf:"bytes,4,opt,name=profile,proto3" json:"profile"`
	// contains filtered or unexported fields
}

UpdateAccountRequest todo

func NewPatchAccountRequest

func NewPatchAccountRequest() *UpdateAccountRequest

NewPatchAccountRequest todo

func NewPutAccountRequest

func NewPutAccountRequest() *UpdateAccountRequest

NewPutAccountRequest todo

func (*UpdateAccountRequest) CheckOwner

func (req *UpdateAccountRequest) CheckOwner(account string) bool

func (*UpdateAccountRequest) Descriptor deprecated

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

Deprecated: Use UpdateAccountRequest.ProtoReflect.Descriptor instead.

func (*UpdateAccountRequest) GetAccount

func (x *UpdateAccountRequest) GetAccount() string

func (*UpdateAccountRequest) GetDepartmentId

func (x *UpdateAccountRequest) GetDepartmentId() string

func (*UpdateAccountRequest) GetProfile

func (x *UpdateAccountRequest) GetProfile() *Profile

func (*UpdateAccountRequest) GetUpdateMode

func (x *UpdateAccountRequest) GetUpdateMode() types1.UpdateMode

func (*UpdateAccountRequest) ProtoMessage

func (*UpdateAccountRequest) ProtoMessage()

func (*UpdateAccountRequest) ProtoReflect

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

func (*UpdateAccountRequest) Reset

func (x *UpdateAccountRequest) Reset()

func (*UpdateAccountRequest) String

func (x *UpdateAccountRequest) String() string

func (*UpdateAccountRequest) Validate

func (req *UpdateAccountRequest) Validate() error

Validate 更新请求校验

type UpdatePasswordRequest

type UpdatePasswordRequest struct {

	// @gotags: json:"account"
	Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account"`
	// @gotags: json:"old_pass"
	OldPass string `protobuf:"bytes,2,opt,name=old_pass,json=oldPass,proto3" json:"old_pass"`
	// @gotags: json:"new_pass"
	NewPass string `protobuf:"bytes,3,opt,name=new_pass,json=newPass,proto3" json:"new_pass"`
	// @gotags: json:"is_reset"
	IsReset bool `protobuf:"varint,4,opt,name=is_reset,json=isReset,proto3" json:"is_reset"`
	// contains filtered or unexported fields
}

UpdatePasswordRequest todo

func NewUpdatePasswordRequest

func NewUpdatePasswordRequest() *UpdatePasswordRequest

NewUpdatePasswordRequest todo

func (*UpdatePasswordRequest) CheckOwner

func (req *UpdatePasswordRequest) CheckOwner(account string) bool

实现checkowner方法

func (*UpdatePasswordRequest) Descriptor deprecated

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

Deprecated: Use UpdatePasswordRequest.ProtoReflect.Descriptor instead.

func (*UpdatePasswordRequest) GetAccount

func (x *UpdatePasswordRequest) GetAccount() string

func (*UpdatePasswordRequest) GetIsReset

func (x *UpdatePasswordRequest) GetIsReset() bool

func (*UpdatePasswordRequest) GetNewPass

func (x *UpdatePasswordRequest) GetNewPass() string

func (*UpdatePasswordRequest) GetOldPass

func (x *UpdatePasswordRequest) GetOldPass() string

func (*UpdatePasswordRequest) ProtoMessage

func (*UpdatePasswordRequest) ProtoMessage()

func (*UpdatePasswordRequest) ProtoReflect

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

func (*UpdatePasswordRequest) Reset

func (x *UpdatePasswordRequest) Reset()

func (*UpdatePasswordRequest) String

func (x *UpdatePasswordRequest) String() string

func (*UpdatePasswordRequest) Validate

func (req *UpdatePasswordRequest) Validate() error

Validate tood

type User

type User struct {

	// 用户所属部门
	// @gotags: bson:"department_id" json:"department_id" validate:"lte=200"
	DepartmentId string `` /* 127-byte string literal not displayed */
	// 用户账号名称
	// @gotags: bson:"_id" json:"account" validate:"required,lte=60"
	Account string `protobuf:"bytes,2,opt,name=account,proto3" json:"account" bson:"_id" validate:"required,lte=60"`
	// 创建方式
	// @gotags: bson:"create_type" json:"create_type"
	CreateType CreateType `` /* 141-byte string literal not displayed */
	// 用户创建的时间
	// @gotags: bson:"create_at" json:"create_at,omitempty"
	CreateAt int64 `protobuf:"varint,4,opt,name=create_at,json=createAt,proto3" json:"create_at,omitempty" bson:"create_at"`
	// 修改时间
	// @gotags: bson:"update_at" json:"update_at,omitempty"
	UpdateAt int64 `protobuf:"varint,5,opt,name=update_at,json=updateAt,proto3" json:"update_at,omitempty" bson:"update_at"`
	// 如果是子账号和服务账号 都需要继承主用户Domain
	// @gotags: bson:"domain" json:"domain,omitempty"
	Domain string `protobuf:"bytes,6,opt,name=domain,proto3" json:"domain,omitempty" bson:"domain"`
	// 是否是主账号
	// @gotags: bson:"type"  json:"type"
	Type types.UserType `protobuf:"varint,7,opt,name=type,proto3,enum=infraboard.keyauth.user.UserType" json:"type" bson:"type"`
	// 数据
	// @gotags: bson:"profile" json:"profile"
	Profile *Profile `protobuf:"bytes,8,opt,name=profile,proto3" json:"profile" bson:"profile"`
	// 用户的角色(当携带Namesapce查询时会有)
	// @gotags: bson:"-" json:"roles,omitempty"
	Roles []string `protobuf:"bytes,9,rep,name=roles,proto3" json:"roles,omitempty" bson:"-"`
	// 用户多久未登录时(天), 冻结改用户, 防止僵尸用户的账号被利用
	// @gotags: bson:"expires_days" json:"expires_days"
	ExpiresDays int32 `protobuf:"varint,10,opt,name=expires_days,json=expiresDays,proto3" json:"expires_days" bson:"expires_days"`
	// 用户描述
	// @gotags: json:"description"
	Description string `protobuf:"bytes,11,opt,name=description,proto3" json:"description"`
	// 用户是否初始化
	// @gotags: bson:"is_initialized" json:"is_initialized"
	IsInitialized bool `protobuf:"varint,12,opt,name=is_initialized,json=isInitialized,proto3" json:"is_initialized" bson:"is_initialized"`
	// 密码相关信息
	// @gotags: bson:"password" json:"password"
	HashedPassword *Password `protobuf:"bytes,13,opt,name=hashed_password,json=hashedPassword,proto3" json:"password" bson:"password"`
	// 用户状态
	// @gotags: bson:"status" json:"status"
	Status *Status `protobuf:"bytes,14,opt,name=status,proto3" json:"status" bson:"status"`
	// 部门
	// @gotags: bson:"-" json:"department,omitempty"
	Department *department.Department `protobuf:"bytes,15,opt,name=department,proto3" json:"department,omitempty" bson:"-"`
	// contains filtered or unexported fields
}

User info

func New

func New(req *CreateAccountRequest) (*User, error)

New 实例

func NewDefaultUser

func NewDefaultUser() *User

NewDefaultUser 实例

func (*User) Block

func (u *User) Block(reason string)

Block 锁用户

func (*User) ChangePassword

func (u *User) ChangePassword(old, new string, maxHistory uint, needReset bool) error

ChangePassword 修改用户密码

func (*User) Descriptor deprecated

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

Deprecated: Use User.ProtoReflect.Descriptor instead.

func (*User) Desensitize

func (u *User) Desensitize()

Desensitize 关键数据脱敏

func (*User) GetAccount

func (x *User) GetAccount() string

func (*User) GetCreateAt

func (x *User) GetCreateAt() int64

func (*User) GetCreateType

func (x *User) GetCreateType() CreateType

func (*User) GetDepartment

func (x *User) GetDepartment() *department.Department

func (*User) GetDepartmentId

func (x *User) GetDepartmentId() string

func (*User) GetDescription

func (x *User) GetDescription() string

func (*User) GetDomain

func (x *User) GetDomain() string

func (*User) GetExpiresDays

func (x *User) GetExpiresDays() int32

func (*User) GetHashedPassword

func (x *User) GetHashedPassword() *Password

func (*User) GetIsInitialized

func (x *User) GetIsInitialized() bool

func (*User) GetProfile

func (x *User) GetProfile() *Profile

func (*User) GetRoles

func (x *User) GetRoles() []string

func (*User) GetStatus

func (x *User) GetStatus() *Status

func (*User) GetType

func (x *User) GetType() types.UserType

func (*User) GetUpdateAt

func (x *User) GetUpdateAt() int64

func (*User) HasDepartment

func (u *User) HasDepartment() bool

HasDepartment todo

func (*User) ProtoMessage

func (*User) ProtoMessage()

func (*User) ProtoReflect

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

func (*User) Reset

func (x *User) Reset()

func (*User) String

func (x *User) String() string

func (*User) UnBlock

func (u *User) UnBlock() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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