user

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2021 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

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",
	}
	CreateType_value = map[string]int32{
		"USER_REGISTRY":  0,
		"DOMAIN_CREATED": 1,
		"LDAP_SYNC":      2,
	}
)

Enum value maps for CreateType.

View Source
var File_pkg_user_pb_enum_proto protoreflect.FileDescriptor
View Source
var File_pkg_user_pb_request_proto protoreflect.FileDescriptor
View Source
var File_pkg_user_pb_service_proto protoreflect.FileDescriptor
View Source
var File_pkg_user_pb_user_proto protoreflect.FileDescriptor

Functions

func HttpEntry added in v0.2.0

func HttpEntry() *http.EntrySet

HttpEntry todo

func RegisterUserServiceServer added in v0.2.0

func RegisterUserServiceServer(s *grpc.Server, srv UserServiceServer)

Types

type BlockAccountRequest added in v0.2.0

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

BlockAccountRequest 冻结用户

func NewBlockAccountRequest added in v0.3.2

func NewBlockAccountRequest(account, reason string) *BlockAccountRequest

NewBlockAccountRequest todo

func (*BlockAccountRequest) Descriptor deprecated added in v0.2.0

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

Deprecated: Use BlockAccountRequest.ProtoReflect.Descriptor instead.

func (*BlockAccountRequest) GetAccount added in v0.2.0

func (x *BlockAccountRequest) GetAccount() string

func (*BlockAccountRequest) GetReason added in v0.2.0

func (x *BlockAccountRequest) GetReason() string

func (*BlockAccountRequest) ProtoMessage added in v0.2.0

func (*BlockAccountRequest) ProtoMessage()

func (*BlockAccountRequest) ProtoReflect added in v0.2.0

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

func (*BlockAccountRequest) Reset added in v0.2.0

func (x *BlockAccountRequest) Reset()

func (*BlockAccountRequest) String added in v0.2.0

func (x *BlockAccountRequest) String() string

func (*BlockAccountRequest) Validate added in v0.3.2

func (req *BlockAccountRequest) Validate() error

type CreateAccountRequest added in v0.2.0

type CreateAccountRequest struct {

	// 创建方式
	CreateType CreateType `protobuf:"varint,1,opt,name=create_type,json=createType,proto3,enum=keyauth.user.CreateType" json:"create_type"`
	// 用户类型
	UserType types.UserType `protobuf:"varint,2,opt,name=user_type,json=userType,proto3,enum=keyauth.user.UserType" json:"user_type"`
	// 用户所属部门
	DepartmentId string `protobuf:"bytes,3,opt,name=department_id,json=departmentId,proto3" json:"department_id" validate:"lte=200"`
	// 用户账号名称
	Account string `protobuf:"bytes,4,opt,name=account,proto3" json:"account" validate:"required,lte=60"`
	// 用户多久未登录时(天), 冻结改用户, 防止僵尸用户的账号被利用'
	ExpiresDays int32 `protobuf:"varint,5,opt,name=expires_days,json=expiresDays,proto3" json:"expires_days"`
	// 用户描述
	Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description"`
	// 数据
	Profile *Profile `protobuf:"bytes,7,opt,name=profile,proto3" json:"profile"`
	// 密码相关信息
	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 added in v0.2.0

func NewCreateUserRequestWithLDAPSync(username, password string) *CreateAccountRequest

NewCreateUserRequestWithLDAPSync todo

func (*CreateAccountRequest) Descriptor deprecated added in v0.2.0

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

Deprecated: Use CreateAccountRequest.ProtoReflect.Descriptor instead.

func (*CreateAccountRequest) GetAccount added in v0.2.0

func (x *CreateAccountRequest) GetAccount() string

func (*CreateAccountRequest) GetCreateType added in v0.2.0

func (x *CreateAccountRequest) GetCreateType() CreateType

func (*CreateAccountRequest) GetDepartmentId added in v0.2.0

func (x *CreateAccountRequest) GetDepartmentId() string

func (*CreateAccountRequest) GetDescription added in v0.2.0

func (x *CreateAccountRequest) GetDescription() string

func (*CreateAccountRequest) GetExpiresDays added in v0.2.0

func (x *CreateAccountRequest) GetExpiresDays() int32

func (*CreateAccountRequest) GetPassword added in v0.2.0

func (x *CreateAccountRequest) GetPassword() string

func (*CreateAccountRequest) GetProfile added in v0.2.0

func (x *CreateAccountRequest) GetProfile() *Profile

func (*CreateAccountRequest) GetUserType added in v0.2.0

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

func (*CreateAccountRequest) ProtoMessage added in v0.2.0

func (*CreateAccountRequest) ProtoMessage()

func (*CreateAccountRequest) ProtoReflect added in v0.2.0

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

func (*CreateAccountRequest) Reset added in v0.2.0

func (x *CreateAccountRequest) Reset()

func (*CreateAccountRequest) String added in v0.2.0

func (x *CreateAccountRequest) String() string

func (*CreateAccountRequest) Validate added in v0.2.0

func (req *CreateAccountRequest) Validate() error

Validate 校验请求是否合法

type CreateType added in v0.2.0

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
)

func ParseCreateTypeFromString added in v0.2.0

func ParseCreateTypeFromString(str string) (CreateType, error)

ParseCreateTypeFromString Parse CreateType from string

func (CreateType) Descriptor added in v0.2.0

func (CreateType) Descriptor() protoreflect.EnumDescriptor

func (CreateType) Enum added in v0.2.0

func (x CreateType) Enum() *CreateType

func (CreateType) EnumDescriptor deprecated added in v0.2.0

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

Deprecated: Use CreateType.Descriptor instead.

func (CreateType) Equal added in v0.2.0

func (t CreateType) Equal(target CreateType) bool

Equal type compare

func (CreateType) IsIn added in v0.2.0

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

IsIn todo

func (CreateType) MarshalJSON added in v0.2.0

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

MarshalJSON todo

func (CreateType) Number added in v0.2.0

func (x CreateType) Number() protoreflect.EnumNumber

func (CreateType) String added in v0.2.0

func (x CreateType) String() string

func (CreateType) Type added in v0.2.0

func (*CreateType) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON todo

type DeleteAccountRequest added in v0.2.0

type DeleteAccountRequest struct {
	Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account"`
	// contains filtered or unexported fields
}

DeleteAccountRequest 删除账户

func (*DeleteAccountRequest) Descriptor deprecated added in v0.2.0

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

Deprecated: Use DeleteAccountRequest.ProtoReflect.Descriptor instead.

func (*DeleteAccountRequest) GetAccount added in v0.2.0

func (x *DeleteAccountRequest) GetAccount() string

func (*DeleteAccountRequest) ProtoMessage added in v0.2.0

func (*DeleteAccountRequest) ProtoMessage()

func (*DeleteAccountRequest) ProtoReflect added in v0.2.0

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

func (*DeleteAccountRequest) Reset added in v0.2.0

func (x *DeleteAccountRequest) Reset()

func (*DeleteAccountRequest) String added in v0.2.0

func (x *DeleteAccountRequest) String() string

type DescribeAccountRequest added in v0.2.0

type DescribeAccountRequest struct {

	// 用户账号名称
	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 added in v0.2.0

func NewDescriptAccountRequestWithAccount(accout string) *DescribeAccountRequest

NewDescriptAccountRequestWithAccount 查询详情请求

func (*DescribeAccountRequest) Descriptor deprecated added in v0.2.0

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

Deprecated: Use DescribeAccountRequest.ProtoReflect.Descriptor instead.

func (*DescribeAccountRequest) GetAccount added in v0.2.0

func (x *DescribeAccountRequest) GetAccount() string

func (*DescribeAccountRequest) ProtoMessage added in v0.2.0

func (*DescribeAccountRequest) ProtoMessage()

func (*DescribeAccountRequest) ProtoReflect added in v0.2.0

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

func (*DescribeAccountRequest) Reset added in v0.2.0

func (x *DescribeAccountRequest) Reset()

func (*DescribeAccountRequest) String added in v0.2.0

func (x *DescribeAccountRequest) String() string

func (*DescribeAccountRequest) Validate added in v0.2.0

func (req *DescribeAccountRequest) Validate() error

Validate 校验详情查询

type Gender added in v0.2.0

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

func ParseGenderFromString added in v0.2.0

func ParseGenderFromString(str string) (Gender, error)

ParseGenderFromString Parse Gender from string

func (Gender) Descriptor added in v0.2.0

func (Gender) Descriptor() protoreflect.EnumDescriptor

func (Gender) Enum added in v0.2.0

func (x Gender) Enum() *Gender

func (Gender) EnumDescriptor deprecated added in v0.2.0

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

Deprecated: Use Gender.Descriptor instead.

func (Gender) Equal added in v0.2.0

func (t Gender) Equal(target Gender) bool

Equal type compare

func (Gender) IsIn added in v0.2.0

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

IsIn todo

func (Gender) MarshalJSON added in v0.2.0

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

MarshalJSON todo

func (Gender) Number added in v0.2.0

func (x Gender) Number() protoreflect.EnumNumber

func (Gender) String added in v0.2.0

func (x Gender) String() string

func (Gender) Type added in v0.2.0

func (Gender) Type() protoreflect.EnumType

func (*Gender) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON todo

type GeneratePasswordRequest added in v0.2.0

type GeneratePasswordRequest struct {
	Length int32 `protobuf:"varint,1,opt,name=length,proto3" json:"length"`
	// contains filtered or unexported fields
}

GeneratePasswordRequest todo

func NewGeneratePasswordRequest added in v0.2.0

func NewGeneratePasswordRequest() *GeneratePasswordRequest

NewGeneratePasswordRequest todo

func (*GeneratePasswordRequest) Descriptor deprecated added in v0.2.0

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

Deprecated: Use GeneratePasswordRequest.ProtoReflect.Descriptor instead.

func (*GeneratePasswordRequest) GetLength added in v0.2.0

func (x *GeneratePasswordRequest) GetLength() int32

func (*GeneratePasswordRequest) ProtoMessage added in v0.2.0

func (*GeneratePasswordRequest) ProtoMessage()

func (*GeneratePasswordRequest) ProtoReflect added in v0.2.0

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

func (*GeneratePasswordRequest) Reset added in v0.2.0

func (x *GeneratePasswordRequest) Reset()

func (*GeneratePasswordRequest) String added in v0.2.0

func (x *GeneratePasswordRequest) String() string

type GeneratePasswordResponse added in v0.2.0

type GeneratePasswordResponse struct {
	Password string `protobuf:"bytes,1,opt,name=password,proto3" json:"password"`
	// contains filtered or unexported fields
}

GeneratePasswordResponse todo

func NewGeneratePasswordResponse added in v0.2.0

func NewGeneratePasswordResponse(password string) *GeneratePasswordResponse

NewGeneratePasswordResponse todo

func (*GeneratePasswordResponse) Descriptor deprecated added in v0.2.0

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

Deprecated: Use GeneratePasswordResponse.ProtoReflect.Descriptor instead.

func (*GeneratePasswordResponse) GetPassword added in v0.2.0

func (x *GeneratePasswordResponse) GetPassword() string

func (*GeneratePasswordResponse) ProtoMessage added in v0.2.0

func (*GeneratePasswordResponse) ProtoMessage()

func (*GeneratePasswordResponse) ProtoReflect added in v0.2.0

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

func (*GeneratePasswordResponse) Reset added in v0.2.0

func (x *GeneratePasswordResponse) Reset()

func (*GeneratePasswordResponse) String added in v0.2.0

func (x *GeneratePasswordResponse) String() string

type Password

type Password struct {

	// hash过后的密码
	Password string `protobuf:"bytes,1,opt,name=password,proto3" json:"password,omitempty" bson:"password"`
	// 密码创建时间
	CreateAt int64 `protobuf:"varint,2,opt,name=create_at,json=createAt,proto3" json:"create_at,omitempty" bson:"create_at"`
	// 密码更新时间
	UpdateAt int64 `protobuf:"varint,3,opt,name=update_at,json=updateAt,proto3" json:"update_at,omitempty" bson:"update_at"`
	// 密码需要被重置
	NeedReset bool `protobuf:"varint,4,opt,name=need_reset,json=needReset,proto3" json:"need_reset" bson:"need_reset"`
	// 需要重置的原因
	ResetReason string `protobuf:"bytes,5,opt,name=reset_reason,json=resetReason,proto3" json:"reset_reason" bson:"reset_reason"`
	// 历史密码
	History []string `protobuf:"bytes,6,rep,name=history,proto3" json:"history,omitempty" bson:"history"`
	// 是否过期
	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 added in v0.2.0

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

Deprecated: Use Password.ProtoReflect.Descriptor instead.

func (*Password) GetCreateAt added in v0.2.0

func (x *Password) GetCreateAt() int64

func (*Password) GetHistory added in v0.2.0

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

func (*Password) GetIsExpired added in v0.2.0

func (x *Password) GetIsExpired() bool

func (*Password) GetNeedReset added in v0.2.0

func (x *Password) GetNeedReset() bool

func (*Password) GetPassword added in v0.2.0

func (x *Password) GetPassword() string

func (*Password) GetResetReason added in v0.2.0

func (x *Password) GetResetReason() string

func (*Password) GetUpdateAt added in v0.2.0

func (x *Password) GetUpdateAt() int64

func (*Password) HistoryCount added in v0.2.0

func (p *Password) HistoryCount() int

HistoryCount 保存了几个历史密码

func (*Password) IsHistory added in v0.2.0

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

IsHistory 检测是否是历史密码

func (*Password) ProtoMessage added in v0.2.0

func (*Password) ProtoMessage()

func (*Password) ProtoReflect added in v0.2.0

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

func (*Password) Reset added in v0.2.0

func (x *Password) Reset()

func (*Password) SetExpired added in v0.2.0

func (p *Password) SetExpired()

SetExpired 密码过期

func (*Password) SetNeedReset added in v0.2.0

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

SetNeedReset 需要被重置

func (*Password) String added in v0.2.0

func (x *Password) String() string

func (*Password) Update added in v0.2.0

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

Update 更新密码

type Profile added in v0.2.0

type Profile struct {

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

func NewProfile() *Profile

NewProfile todo

func (*Profile) Descriptor deprecated added in v0.2.0

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

Deprecated: Use Profile.ProtoReflect.Descriptor instead.

func (*Profile) GetAddress added in v0.2.0

func (x *Profile) GetAddress() string

func (*Profile) GetAvatar added in v0.2.0

func (x *Profile) GetAvatar() string

func (*Profile) GetCity added in v0.2.0

func (x *Profile) GetCity() string

func (*Profile) GetEmail added in v0.2.0

func (x *Profile) GetEmail() string

func (*Profile) GetGender added in v0.2.0

func (x *Profile) GetGender() Gender

func (*Profile) GetLanguage added in v0.2.0

func (x *Profile) GetLanguage() string

func (*Profile) GetNickName added in v0.2.0

func (x *Profile) GetNickName() string

func (*Profile) GetPhone added in v0.2.0

func (x *Profile) GetPhone() string

func (*Profile) GetProvince added in v0.2.0

func (x *Profile) GetProvince() string

func (*Profile) GetRealName added in v0.2.0

func (x *Profile) GetRealName() string

func (*Profile) Patch added in v0.2.0

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

Patch todo

func (*Profile) ProtoMessage added in v0.2.0

func (*Profile) ProtoMessage()

func (*Profile) ProtoReflect added in v0.2.0

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

func (*Profile) Reset added in v0.2.0

func (x *Profile) Reset()

func (*Profile) String added in v0.2.0

func (x *Profile) String() string

func (*Profile) ValidateInitialized added in v0.2.0

func (p *Profile) ValidateInitialized() error

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

type QueryAccountRequest

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

QueryAccountRequest 获取子账号列表

func NewNewQueryAccountRequestFromHTTP added in v0.2.0

func NewNewQueryAccountRequestFromHTTP(r *http.Request) *QueryAccountRequest

NewNewQueryAccountRequestFromHTTP todo

func NewQueryAccountRequest

func NewQueryAccountRequest() *QueryAccountRequest

NewQueryAccountRequest 列表查询请求

func (*QueryAccountRequest) Descriptor deprecated added in v0.2.0

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

Deprecated: Use QueryAccountRequest.ProtoReflect.Descriptor instead.

func (*QueryAccountRequest) GetAccounts added in v0.2.0

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

func (*QueryAccountRequest) GetDepartmentId added in v0.2.0

func (x *QueryAccountRequest) GetDepartmentId() string

func (*QueryAccountRequest) GetKeywords added in v0.2.0

func (x *QueryAccountRequest) GetKeywords() string

func (*QueryAccountRequest) GetNamespaceId added in v0.2.0

func (x *QueryAccountRequest) GetNamespaceId() string

func (*QueryAccountRequest) GetPage added in v0.2.0

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

func (*QueryAccountRequest) GetSkipItems added in v0.2.0

func (x *QueryAccountRequest) GetSkipItems() bool

func (*QueryAccountRequest) GetUserType added in v0.2.0

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

func (*QueryAccountRequest) GetWithAllSub added in v0.2.0

func (x *QueryAccountRequest) GetWithAllSub() bool

func (*QueryAccountRequest) GetWithDepartment added in v0.2.0

func (x *QueryAccountRequest) GetWithDepartment() bool

func (*QueryAccountRequest) ProtoMessage added in v0.2.0

func (*QueryAccountRequest) ProtoMessage()

func (*QueryAccountRequest) ProtoReflect added in v0.2.0

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

func (*QueryAccountRequest) Reset added in v0.2.0

func (x *QueryAccountRequest) Reset()

func (*QueryAccountRequest) SetPageRequest added in v0.2.0

func (req *QueryAccountRequest) SetPageRequest(page *request.PageRequest)

SetPageRequest todo

func (*QueryAccountRequest) String added in v0.2.0

func (x *QueryAccountRequest) String() string

func (*QueryAccountRequest) Validate added in v0.2.0

func (req *QueryAccountRequest) Validate() error

Validate 校验查询参数

type Set

type Set struct {
	Total int64   `protobuf:"varint,1,opt,name=total,proto3" json:"total" bson:"total"`
	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 added in v0.2.0

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

Deprecated: Use Set.ProtoReflect.Descriptor instead.

func (*Set) GetItems added in v0.2.0

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

func (*Set) GetTotal added in v0.2.0

func (x *Set) GetTotal() int64

func (*Set) ProtoMessage added in v0.2.0

func (*Set) ProtoMessage()

func (*Set) ProtoReflect added in v0.2.0

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

func (*Set) Reset added in v0.2.0

func (x *Set) Reset()

func (*Set) String added in v0.2.0

func (x *Set) String() string

type Status

type Status struct {

	// 是否冻结
	Locked bool `protobuf:"varint,1,opt,name=locked,proto3" json:"locked" bson:"locked"`
	// 冻结时间
	LockedTime int64 `protobuf:"varint,2,opt,name=locked_time,json=lockedTime,proto3" json:"locked_time,omitempty" bson:"locked_time"`
	// 冻结原因
	LockedReson string `protobuf:"bytes,3,opt,name=locked_reson,json=lockedReson,proto3" json:"locked_reson,omitempty" bson:"locked_reson"`
	// 解冻时间
	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 added in v0.2.0

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

Deprecated: Use Status.ProtoReflect.Descriptor instead.

func (*Status) GetLocked added in v0.2.0

func (x *Status) GetLocked() bool

func (*Status) GetLockedReson added in v0.2.0

func (x *Status) GetLockedReson() string

func (*Status) GetLockedTime added in v0.2.0

func (x *Status) GetLockedTime() int64

func (*Status) GetUnlockTime added in v0.2.0

func (x *Status) GetUnlockTime() int64

func (*Status) ProtoMessage added in v0.2.0

func (*Status) ProtoMessage()

func (*Status) ProtoReflect added in v0.2.0

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

func (*Status) Reset added in v0.2.0

func (x *Status) Reset()

func (*Status) String added in v0.2.0

func (x *Status) String() string

type UnBlockAccountRequest added in v0.3.2

type UnBlockAccountRequest struct {
	Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account"`
	// contains filtered or unexported fields
}

UnBlockAccountRequest 解冻用户

func (*UnBlockAccountRequest) Descriptor deprecated added in v0.3.2

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

Deprecated: Use UnBlockAccountRequest.ProtoReflect.Descriptor instead.

func (*UnBlockAccountRequest) GetAccount added in v0.3.2

func (x *UnBlockAccountRequest) GetAccount() string

func (*UnBlockAccountRequest) ProtoMessage added in v0.3.2

func (*UnBlockAccountRequest) ProtoMessage()

func (*UnBlockAccountRequest) ProtoReflect added in v0.3.2

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

func (*UnBlockAccountRequest) Reset added in v0.3.2

func (x *UnBlockAccountRequest) Reset()

func (*UnBlockAccountRequest) String added in v0.3.2

func (x *UnBlockAccountRequest) String() string

func (*UnBlockAccountRequest) Validate added in v0.3.2

func (req *UnBlockAccountRequest) Validate() error

type UnimplementedUserServiceServer added in v0.2.0

type UnimplementedUserServiceServer struct {
}

UnimplementedUserServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedUserServiceServer) BlockAccount added in v0.2.0

func (UnimplementedUserServiceServer) CreateAccount added in v0.2.0

func (UnimplementedUserServiceServer) DeleteAccount added in v0.2.0

func (UnimplementedUserServiceServer) DescribeAccount added in v0.2.0

func (UnimplementedUserServiceServer) GeneratePassword added in v0.2.0

func (UnimplementedUserServiceServer) QueryAccount added in v0.2.0

func (UnimplementedUserServiceServer) UnBlockAccount added in v0.3.2

func (UnimplementedUserServiceServer) UpdateAccountPassword added in v0.2.0

func (UnimplementedUserServiceServer) UpdateAccountProfile added in v0.2.0

type UnsafeUserServiceServer added in v0.2.0

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

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

type UpdateAccountRequest added in v0.2.0

type UpdateAccountRequest struct {

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

UpdateAccountRequest todo

func NewPatchAccountRequest added in v0.2.0

func NewPatchAccountRequest() *UpdateAccountRequest

NewPatchAccountRequest todo

func NewPutAccountRequest added in v0.2.0

func NewPutAccountRequest() *UpdateAccountRequest

NewPutAccountRequest todo

func (*UpdateAccountRequest) CheckOwner added in v0.2.8

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

func (*UpdateAccountRequest) Descriptor deprecated added in v0.2.0

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

Deprecated: Use UpdateAccountRequest.ProtoReflect.Descriptor instead.

func (*UpdateAccountRequest) GetAccount added in v0.2.0

func (x *UpdateAccountRequest) GetAccount() string

func (*UpdateAccountRequest) GetDepartmentId added in v0.2.0

func (x *UpdateAccountRequest) GetDepartmentId() string

func (*UpdateAccountRequest) GetProfile added in v0.2.0

func (x *UpdateAccountRequest) GetProfile() *Profile

func (*UpdateAccountRequest) GetUpdateMode added in v0.2.0

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

func (*UpdateAccountRequest) ProtoMessage added in v0.2.0

func (*UpdateAccountRequest) ProtoMessage()

func (*UpdateAccountRequest) ProtoReflect added in v0.2.0

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

func (*UpdateAccountRequest) Reset added in v0.2.0

func (x *UpdateAccountRequest) Reset()

func (*UpdateAccountRequest) String added in v0.2.0

func (x *UpdateAccountRequest) String() string

func (*UpdateAccountRequest) Validate added in v0.2.0

func (req *UpdateAccountRequest) Validate() error

Validate 更新请求校验

type UpdatePasswordRequest added in v0.2.0

type UpdatePasswordRequest struct {
	Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account"`
	OldPass string `protobuf:"bytes,2,opt,name=old_pass,json=oldPass,proto3" json:"old_pass"`
	NewPass string `protobuf:"bytes,3,opt,name=new_pass,json=newPass,proto3" json:"new_pass"`
	// contains filtered or unexported fields
}

UpdatePasswordRequest todo

func NewUpdatePasswordRequest added in v0.2.0

func NewUpdatePasswordRequest() *UpdatePasswordRequest

NewUpdatePasswordRequest todo

func (*UpdatePasswordRequest) CheckOwner added in v0.2.5

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

实现checkowner方法

func (*UpdatePasswordRequest) Descriptor deprecated added in v0.2.0

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

Deprecated: Use UpdatePasswordRequest.ProtoReflect.Descriptor instead.

func (*UpdatePasswordRequest) GetAccount added in v0.2.0

func (x *UpdatePasswordRequest) GetAccount() string

func (*UpdatePasswordRequest) GetNewPass added in v0.2.0

func (x *UpdatePasswordRequest) GetNewPass() string

func (*UpdatePasswordRequest) GetOldPass added in v0.2.0

func (x *UpdatePasswordRequest) GetOldPass() string

func (*UpdatePasswordRequest) IsReset added in v0.2.0

func (req *UpdatePasswordRequest) IsReset() bool

IsReset 密码是否需要被重置, 如果不是自己设置的密码 都需要被用户自己重置

func (*UpdatePasswordRequest) ProtoMessage added in v0.2.0

func (*UpdatePasswordRequest) ProtoMessage()

func (*UpdatePasswordRequest) ProtoReflect added in v0.2.0

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

func (*UpdatePasswordRequest) Reset added in v0.2.0

func (x *UpdatePasswordRequest) Reset()

func (*UpdatePasswordRequest) String added in v0.2.0

func (x *UpdatePasswordRequest) String() string

func (*UpdatePasswordRequest) Validate added in v0.2.0

func (req *UpdatePasswordRequest) Validate() error

Validate tood

type User

type User struct {

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

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

ChangePassword 修改用户密码

func (*User) Descriptor deprecated added in v0.2.0

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

Deprecated: Use User.ProtoReflect.Descriptor instead.

func (*User) Desensitize added in v0.2.0

func (u *User) Desensitize()

Desensitize 关键数据脱敏

func (*User) GetAccount added in v0.2.0

func (x *User) GetAccount() string

func (*User) GetCreateAt added in v0.2.0

func (x *User) GetCreateAt() int64

func (*User) GetCreateType added in v0.2.0

func (x *User) GetCreateType() CreateType

func (*User) GetDepartment added in v0.2.0

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

func (*User) GetDepartmentId added in v0.2.0

func (x *User) GetDepartmentId() string

func (*User) GetDescription added in v0.2.0

func (x *User) GetDescription() string

func (*User) GetDomain added in v0.2.0

func (x *User) GetDomain() string

func (*User) GetExpiresDays added in v0.2.0

func (x *User) GetExpiresDays() int32

func (*User) GetHashedPassword added in v0.2.0

func (x *User) GetHashedPassword() *Password

func (*User) GetIsInitialized added in v0.2.0

func (x *User) GetIsInitialized() bool

func (*User) GetProfile added in v0.2.0

func (x *User) GetProfile() *Profile

func (*User) GetRoles added in v0.2.0

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

func (*User) GetStatus added in v0.2.0

func (x *User) GetStatus() *Status

func (*User) GetType added in v0.2.0

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

func (*User) GetUpdateAt added in v0.2.0

func (x *User) GetUpdateAt() int64

func (*User) HasDepartment added in v0.2.0

func (u *User) HasDepartment() bool

HasDepartment todo

func (*User) ProtoMessage added in v0.2.0

func (*User) ProtoMessage()

func (*User) ProtoReflect added in v0.2.0

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

func (*User) Reset added in v0.2.0

func (x *User) Reset()

func (*User) String

func (x *User) String() string

func (*User) UnBlock added in v0.3.2

func (u *User) UnBlock() error

type UserServiceClient added in v0.2.0

type UserServiceClient 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)
}

UserServiceClient is the client API for UserService 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 NewUserServiceClient added in v0.2.0

func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient

type UserServiceServer added in v0.2.0

type UserServiceServer 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
}

UserServiceServer is the server API for UserService service. All implementations must embed UnimplementedUserServiceServer for forward compatibility

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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