github.com/infraboard/keyauth@v0.8.1/apps/user/pb/user.proto (about) 1 syntax = "proto3"; 2 3 package infraboard.keyauth.user; 4 option go_package = "github.com/infraboard/keyauth/apps/user"; 5 6 import "apps/department/pb/department.proto"; 7 import "apps/user/pb/types.proto"; 8 import "apps/user/pb/request.proto"; 9 import "apps/user/pb/enum.proto"; 10 11 message Password { 12 // hash过后的密码 13 // @gotags: bson:"password" json:"password,omitempty" 14 string password = 1; 15 // 密码创建时间 16 // @gotags: bson:"create_at" json:"create_at,omitempty" 17 int64 create_at = 2; 18 // 密码更新时间 19 // @gotags: bson:"update_at" json:"update_at,omitempty" 20 int64 update_at = 3; 21 // 密码需要被重置 22 // @gotags: bson:"need_reset" json:"need_reset" 23 bool need_reset = 4; 24 // 需要重置的原因 25 // @gotags: bson:"reset_reason" json:"reset_reason" 26 string reset_reason = 5; 27 // 历史密码 28 // @gotags: bson:"history" json:"history,omitempty" 29 repeated string history = 6; 30 // 是否过期 31 // @gotags: bson:"-" json:"is_expired" 32 bool is_expired = 7; 33 } 34 35 // Status 用户状态 36 message Status { 37 // 是否冻结 38 // @gotags: bson:"locked" json:"locked" 39 bool locked = 1; 40 // 冻结时间 41 // @gotags: bson:"locked_time" json:"locked_time,omitempty" 42 int64 locked_time = 2; 43 // 冻结原因 44 // @gotags: bson:"locked_reson" json:"locked_reson,omitempty" 45 string locked_reson = 3; 46 // 解冻时间 47 // @gotags: bson:"unlock_time" json:"unlock_time,omitempty" 48 int64 unlock_time = 4; 49 } 50 51 // User info 52 message User { 53 // 用户所属部门 54 // @gotags: bson:"department_id" json:"department_id" validate:"lte=200" 55 string department_id = 1; 56 // 用户账号名称 57 // @gotags: bson:"_id" json:"account" validate:"required,lte=60" 58 string account = 2; 59 // 创建方式 60 // @gotags: bson:"create_type" json:"create_type" 61 CreateType create_type = 3; 62 // 用户创建的时间 63 // @gotags: bson:"create_at" json:"create_at,omitempty" 64 int64 create_at = 4; 65 // 修改时间 66 // @gotags: bson:"update_at" json:"update_at,omitempty" 67 int64 update_at = 5; 68 // 如果是子账号和服务账号 都需要继承主用户Domain 69 // @gotags: bson:"domain" json:"domain,omitempty" 70 string domain = 6; 71 // 是否是主账号 72 // @gotags: bson:"type" json:"type" 73 UserType type = 7; 74 // 数据 75 // @gotags: bson:"profile" json:"profile" 76 Profile profile = 8; 77 // 用户的角色(当携带Namesapce查询时会有) 78 // @gotags: bson:"-" json:"roles,omitempty" 79 repeated string roles = 9; 80 // 用户多久未登录时(天), 冻结改用户, 防止僵尸用户的账号被利用 81 // @gotags: bson:"expires_days" json:"expires_days" 82 int32 expires_days = 10; 83 // 用户描述 84 // @gotags: json:"description" 85 string description = 11; 86 // 用户是否初始化 87 // @gotags: bson:"is_initialized" json:"is_initialized" 88 bool is_initialized = 12; 89 // 密码相关信息 90 // @gotags: bson:"password" json:"password" 91 Password hashed_password = 13; 92 // 用户状态 93 // @gotags: bson:"status" json:"status" 94 Status status = 14; 95 // 部门 96 // @gotags: bson:"-" json:"department,omitempty" 97 department.Department department = 15; 98 } 99 100 message Set { 101 // @gotags: bson:"total" json:"total" 102 int64 total = 1; 103 // @gotags: bson:"items" json:"items" 104 repeated User items = 2; 105 }