Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat: user profile proto & store (#13747)

ecmadao23c41a6cc687
diff --git a/backend/migrator/migration/prod/2.23/0000##principal_profile.sql b/backend/migrator/migration/prod/2.23/0000##principal_profile.sql
new file mode 100644
index 0000000000..e377bf6338
--- /dev/null
+++ b/backend/migrator/migration/prod/2.23/0000##principal_profile.sql
@@ -0,0 +1 @@
+ALTER TABLE principal ADD profile JSONB NOT NULL DEFAULT '{}';
diff --git a/backend/migrator/migration/prod/LATEST.sql b/backend/migrator/migration/prod/LATEST.sql
index 937447bebc..6caa0a2677 100644
--- a/backend/migrator/migration/prod/LATEST.sql
+++ b/backend/migrator/migration/prod/LATEST.sql
@@ -32,7 +32,8 @@ CREATE TABLE principal (
email TEXT NOT NULL,
password_hash TEXT NOT NULL,
phone TEXT NOT NULL DEFAULT '',
- mfa_config JSONB NOT NULL DEFAULT '{}'
+ mfa_config JSONB NOT NULL DEFAULT '{}',
+ profile JSONB NOT NULL DEFAULT '{}'
);
-- Default bytebase system account id is 1
diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.go
index 0e28a3af48..0c2e9e241d 100644
--- a/backend/migrator/migrator_test.go
+++ b/backend/migrator/migrator_test.go
@@ -231,5 +231,5 @@ func TestMigrationCompatibility(t *testing.T) {
func TestGetCutoffVersion(t *testing.T) {
releaseVersion, err := getProdCutoffVersion()
require.NoError(t, err)
- require.Equal(t, semver.MustParse("2.22.4"), releaseVersion)
+ require.Equal(t, semver.MustParse("2.23.0"), releaseVersion)
}
diff --git a/backend/store/principal.go b/backend/store/principal.go
index 022f051753..317bd36915 100644
--- a/backend/store/principal.go
+++ b/backend/store/principal.go
@@ -9,6 +9,7 @@ import (
"github.com/pkg/errors"
"google.golang.org/protobuf/encoding/protojson"
+ "google.golang.org/protobuf/types/known/timestamppb"
"github.com/bytebase/bytebase/backend/common"
"github.com/bytebase/bytebase/backend/common/log"
@@ -39,6 +40,7 @@ type UpdateUserMessage struct {
PasswordHash *string
Delete *bool
MFAConfig *storepb.MFAConfig
+ Profile *storepb.UserProfile
Phone *string
}
@@ -52,6 +54,7 @@ type UserMessage struct {
PasswordHash string
MemberDeleted bool
MFAConfig *storepb.MFAConfig
+ Profile *storepb.UserProfile
// Phone conforms E.164 format.
Phone string
}
@@ -173,7 +176,8 @@ func listUserImpl(ctx context.Context, tx *Tx, find *FindUserMessage) ([]*UserMe
principal.type,
principal.password_hash,
principal.mfa_config,
- principal.phone
+ principal.phone,
+ principal.profile
FROM principal
WHERE ` + strings.Join(where, " AND ")
@@ -191,6 +195,7 @@ func listUserImpl(ctx context.Context, tx *Tx, find *FindUserMessage) ([]*UserMe
var userMessage UserMessage
var rowStatus string
var mfaConfigBytes []byte
+ var profileBytes []byte
if err := rows.Scan(
&userMessage.ID,
&rowStatus,
@@ -200,6 +205,7 @@ func listUserImpl(ctx context.Context, tx *Tx, find *FindUserMessage) ([]*UserMe
&userMessage.PasswordHash,
&mfaConfigBytes,
&userMessage.Phone,
+ &profileBytes,
); err != nil {
return nil, err
}
@@ -210,6 +216,11 @@ func listUserImpl(ctx context.Context, tx *Tx, find *FindUserMessage) ([]*UserMe
return nil, err
}
userMessage.MFAConfig = &mfaConfig
+ profile := storepb.UserProfile{}
+ if err := common.ProtojsonUnmarshaler.Unmarshal(profileBytes, &profile); err != nil {
+ return nil, err
+ }
+ userMessage.Profile = &profile
userMessages = append(userMessages, &userMessage)
}
if err := rows.Err(); err != nil {
@@ -292,6 +303,10 @@ func (s *Store) UpdateUser(ctx context.Context, currentUser *UserMessage, patch
}
if v := patch.PasswordHash; v != nil {
principalSet, principalArgs = append(principalSet, fmt.Sprintf("password_hash = $%d", len(principalArgs)+1)), append(principalArgs, *v)
+ if patch.Profile == nil {
+ patch.Profile = currentUser.Profile
+ patch.Profile.LastChangePasswordTime = timestamppb.New(time.Now())
+ }
}
if v := patch.Phone; v != nil {
principalSet, principalArgs = append(principalSet, fmt.Sprintf("phone = $%d", len(principalArgs)+1)), append(principalArgs, *v)
@@ -303,6 +318,13 @@ func (s *Store) UpdateUser(ctx context.Context, currentUser *UserMessage, patch
}
principalSet, principalArgs = append(principalSet, fmt.Sprintf("mfa_config = $%d", len(principalArgs)+1)), append(principalArgs, mfaConfigBytes)
}
+ if v := patch.Profile; v != nil {
+ profileBytes, err := protojson.Marshal(v)
+ if err != nil {
+ return nil, err
+ }
+ principalSet, principalArgs = append(principalSet, fmt.Sprintf("profile = $%d", len(principalArgs)+1)), append(principalArgs, profileBytes)
+ }
principalArgs = append(principalArgs, currentUser.ID)
tx, err := s.db.BeginTx(ctx, nil)
diff --git a/frontend/src/types/proto/store/user.ts b/frontend/src/types/proto/store/user.ts
index 90dc8faddf..8bd3a586b8 100644
--- a/frontend/src/types/proto/store/user.ts
+++ b/frontend/src/types/proto/store/user.ts
@@ -1,6 +1,7 @@
/* eslint-disable */
import Long from "long";
import _m0 from "protobufjs/minimal";
+import { Timestamp } from "../google/protobuf/timestamp";
export const protobufPackage = "bytebase.store";
@@ -16,6 +17,11 @@ export interface MFAConfig {
tempRecoveryCodes: string[];
}
+export interface UserProfile {
+ lastLoginTime: Date | undefined;
+ lastChangePasswordTime: Date | undefined;
+}
+
function createBaseMFAConfig(): MFAConfig {
return { otpSecret: "", tempOtpSecret: "", recoveryCodes: [], tempRecoveryCodes: [] };
}
@@ -124,6 +130,82 @@ export const MFAConfig = {
},
};
+function createBaseUserProfile(): UserProfile {
+ return { lastLoginTime: undefined, lastChangePasswordTime: undefined };
+}
+
+export const UserProfile = {
+ encode(message: UserProfile, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.lastLoginTime !== undefined) {
+ Timestamp.encode(toTimestamp(message.lastLoginTime), writer.uint32(10).fork()).ldelim();
+ }
+ if (message.lastChangePasswordTime !== undefined) {
+ Timestamp.encode(toTimestamp(message.lastChangePasswordTime), writer.uint32(18).fork()).ldelim();
+ }
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): UserProfile {
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseUserProfile();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1:
+ if (tag !== 10) {
+ break;
+ }
+
+ message.lastLoginTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ continue;
+ case 2:
+ if (tag !== 18) {
+ break;
+ }
+
+ message.lastChangePasswordTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ continue;
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skipType(tag & 7);
+ }
+ return message;
+ },
+
+ fromJSON(object: any): UserProfile {
+ return {
+ lastLoginTime: isSet(object.lastLoginTime) ? fromJsonTimestamp(object.lastLoginTime) : undefined,
+ lastChangePasswordTime: isSet(object.lastChangePasswordTime)
+ ? fromJsonTimestamp(object.lastChangePasswordTime)
+ : undefined,
+ };
+ },
+
+ toJSON(message: UserProfile): unknown {
+ const obj: any = {};
+ if (message.lastLoginTime !== undefined) {
+ obj.lastLoginTime = message.lastLoginTime.toISOString();
+ }
+ if (message.lastChangePasswordTime !== undefined) {
+ obj.lastChangePasswordTime = message.lastChangePasswordTime.toISOString();
+ }
+ return obj;
+ },
+
+ create(base?: DeepPartial<UserProfile>): UserProfile {
+ return UserProfile.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<UserProfile>): UserProfile {
+ const message = createBaseUserProfile();
+ message.lastLoginTime = object.lastLoginTime ?? undefined;
+ message.lastChangePasswordTime = object.lastChangePasswordTime ?? undefined;
+ return message;
+ },
+};
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
@@ -132,6 +214,32 @@ export type DeepPartial<T> = T extends Builtin ? T
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
+function toTimestamp(date: Date): Timestamp {
+ const seconds = numberToLong(date.getTime() / 1_000);
+ const nanos = (date.getTime() % 1_000) * 1_000_000;
+ return { seconds, nanos };
+}
+
+function fromTimestamp(t: Timestamp): Date {
+ let millis = (t.seconds.toNumber() || 0) * 1_000;
+ millis += (t.nanos || 0) / 1_000_000;
+ return new globalThis.Date(millis);
+}
+
+function fromJsonTimestamp(o: any): Date {
+ if (o instanceof globalThis.Date) {
+ return o;
+ } else if (typeof o === "string") {
+ return new globalThis.Date(o);
+ } else {
+ return fromTimestamp(Timestamp.fromJSON(o));
+ }
+}
+
+function numberToLong(number: number) {
+ return Long.fromNumber(number);
+}
+
if (_m0.util.Long !== Long) {
_m0.util.Long = Long as any;
_m0.configure();
diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.md
index 9112d3dfec..90ed558387 100644
--- a/proto/gen/grpc-doc/store/README.md
+++ b/proto/gen/grpc-doc/store/README.md
@@ -313,6 +313,7 @@
- [store/user.proto](#store_user-proto)
- [MFAConfig](#bytebase-store-MFAConfig)
+ - [UserProfile](#bytebase-store-UserProfile)
- [store/vcs.proto](#store_vcs-proto)
- [VCSConnector](#bytebase-store-VCSConnector)
@@ -4818,6 +4819,22 @@ MFAConfig is the MFA configuration for a user.
+
+<a name="bytebase-store-UserProfile"></a>
+
+### UserProfile
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| last_login_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |
+| last_change_password_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |
+
+
+
+
+
diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.html
index 67b334d1be..c707866ef7 100644
--- a/proto/gen/grpc-doc/store/index.html
+++ b/proto/gen/grpc-doc/store/index.html
@@ -1447,6 +1447,10 @@
<a href="#bytebase.store.MFAConfig"><span class="badge">M</span>MFAConfig</a>
</li>
+ <li>
+ <a href="#bytebase.store.UserProfile"><span class="badge">M</span>UserProfile</a>
+ </li>
+
@@ -11819,6 +11823,37 @@ Format: instances/{instance}/databases/{database} </p></td>
+ <h3 id="bytebase.store.UserProfile">UserProfile</h3>
+ <p></p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>last_login_time</td>
+ <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>
+ <td></td>
+ <td><p> </p></td>
+ </tr>
+
+ <tr>
+ <td>last_change_password_time</td>
+ <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>
+ <td></td>
+ <td><p> </p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
diff --git a/proto/generated-go/store/user.pb.go b/proto/generated-go/store/user.pb.go
index 68d1f2b834..ee7e437a6b 100644
--- a/proto/generated-go/store/user.pb.go
+++ b/proto/generated-go/store/user.pb.go
@@ -9,6 +9,7 @@ package store
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
)
@@ -96,24 +97,92 @@ func (x *MFAConfig) GetTempRecoveryCodes() []string {
return nil
}
+type UserProfile struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ LastLoginTime *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=last_login_time,json=lastLoginTime,proto3" json:"last_login_time,omitempty"`
+ LastChangePasswordTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=last_change_password_time,json=lastChangePasswordTime,proto3" json:"last_change_password_time,omitempty"`
+}
+
+func (x *UserProfile) Reset() {
+ *x = UserProfile{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_store_user_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UserProfile) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UserProfile) ProtoMessage() {}
+
+func (x *UserProfile) ProtoReflect() protoreflect.Message {
+ mi := &file_store_user_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UserProfile.ProtoReflect.Descriptor instead.
+func (*UserProfile) Descriptor() ([]byte, []int) {
+ return file_store_user_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *UserProfile) GetLastLoginTime() *timestamppb.Timestamp {
+ if x != nil {
+ return x.LastLoginTime
+ }
+ return nil
+}
+
+func (x *UserProfile) GetLastChangePasswordTime() *timestamppb.Timestamp {
+ if x != nil {
+ return x.LastChangePasswordTime
+ }
+ return nil
+}
+
var File_store_user_proto protoreflect.FileDescriptor
var file_store_user_proto_rawDesc = []byte{
0x0a, 0x10, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x12, 0x0e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f,
- 0x72, 0x65, 0x22, 0xa9, 0x01, 0x0a, 0x09, 0x4d, 0x46, 0x41, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67,
- 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x74, 0x70, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x01,
- 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x74, 0x70, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12,
- 0x26, 0x0a, 0x0f, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x6f, 0x74, 0x70, 0x5f, 0x73, 0x65, 0x63, 0x72,
- 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x74, 0x65, 0x6d, 0x70, 0x4f, 0x74,
- 0x70, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x63, 0x6f, 0x76,
- 0x65, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52,
- 0x0d, 0x72, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x2e,
- 0x0a, 0x13, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x5f,
- 0x63, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x74, 0x65, 0x6d,
- 0x70, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x42, 0x14,
- 0x5a, 0x12, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x73,
- 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x72, 0x65, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+ 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72,
+ 0x6f, 0x74, 0x6f, 0x22, 0xa9, 0x01, 0x0a, 0x09, 0x4d, 0x46, 0x41, 0x43, 0x6f, 0x6e, 0x66, 0x69,
+ 0x67, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x74, 0x70, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x74, 0x70, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74,
+ 0x12, 0x26, 0x0a, 0x0f, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x6f, 0x74, 0x70, 0x5f, 0x73, 0x65, 0x63,
+ 0x72, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x74, 0x65, 0x6d, 0x70, 0x4f,
+ 0x74, 0x70, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x63, 0x6f,
+ 0x76, 0x65, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09,
+ 0x52, 0x0d, 0x72, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x12,
+ 0x2e, 0x0a, 0x13, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79,
+ 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x74, 0x65,
+ 0x6d, 0x70, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x22,
+ 0xa8, 0x01, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12,
+ 0x42, 0x0a, 0x0f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x74, 0x69,
+ 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
+ 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73,
+ 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0d, 0x6c, 0x61, 0x73, 0x74, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x54,
+ 0x69, 0x6d, 0x65, 0x12, 0x55, 0x0a, 0x19, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x63, 0x68, 0x61, 0x6e,
+ 0x67, 0x65, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65,
+ 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61,
+ 0x6d, 0x70, 0x52, 0x16, 0x6c, 0x61, 0x73, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x61,
+ 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x42, 0x14, 0x5a, 0x12, 0x67, 0x65,
+ 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65,
+ 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -128,16 +197,20 @@ func file_store_user_proto_rawDescGZIP() []byte {
return file_store_user_proto_rawDescData
}
-var file_store_user_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
+var file_store_user_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_store_user_proto_goTypes = []any{
- (*MFAConfig)(nil), // 0: bytebase.store.MFAConfig
+ (*MFAConfig)(nil), // 0: bytebase.store.MFAConfig
+ (*UserProfile)(nil), // 1: bytebase.store.UserProfile
+ (*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp
}
var file_store_user_proto_depIdxs = []int32{
- 0, // [0:0] is the sub-list for method output_type
- 0, // [0:0] is the sub-list for method input_type
- 0, // [0:0] is the sub-list for extension type_name
- 0, // [0:0] is the sub-list for extension extendee
- 0, // [0:0] is the sub-list for field type_name
+ 2, // 0: bytebase.store.UserProfile.last_login_time:type_name -> google.protobuf.Timestamp
+ 2, // 1: bytebase.store.UserProfile.last_change_password_time:type_name -> google.protobuf.Timestamp
+ 2, // [2:2] is the sub-list for method output_type
+ 2, // [2:2] is the sub-list for method input_type
+ 2, // [2:2] is the sub-list for extension type_name
+ 2, // [2:2] is the sub-list for extension extendee
+ 0, // [0:2] is the sub-list for field type_name
}
func init() { file_store_user_proto_init() }
@@ -158,6 +231,18 @@ func file_store_user_proto_init() {
return nil
}
}
+ file_store_user_proto_msgTypes[1].Exporter = func(v any, i int) any {
+ switch v := v.(*UserProfile); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
}
type x struct{}
out := protoimpl.TypeBuilder{
@@ -165,7 +250,7 @@ func file_store_user_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_store_user_proto_rawDesc,
NumEnums: 0,
- NumMessages: 1,
+ NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
diff --git a/proto/store/user.proto b/proto/store/user.proto
index 163d85d4f5..d663994430 100644
--- a/proto/store/user.proto
+++ b/proto/store/user.proto
@@ -2,6 +2,8 @@ syntax = "proto3";
package bytebase.store;
+import "google/protobuf/timestamp.proto";
+
option go_package = "generated-go/store";
// MFAConfig is the MFA configuration for a user.
@@ -18,3 +20,8 @@ message MFAConfig {
// The temp_recovery_codes are the temporary codes that will replace the recovery_codes in two phase commits.
repeated string temp_recovery_codes = 4;
}
+
+message UserProfile {
+ google.protobuf.Timestamp last_login_time = 1;
+ google.protobuf.Timestamp last_change_password_time = 2;
+}