Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat: add create user proto (#4104)
Danny Xu25209e15b632
diff --git a/frontend/src/types/proto/v1/auth_service.ts b/frontend/src/types/proto/v1/auth_service.tsindex f06c0972b3..4bc60a13aa 100644--- a/frontend/src/types/proto/v1/auth_service.ts+++ b/frontend/src/types/proto/v1/auth_service.ts@@ -1,9 +1,62 @@/* eslint-disable */import _m0 from "protobufjs/minimal";import { Empty } from "../google/protobuf/empty";+import { State, stateFromJSON, stateToJSON } from "./common";export const protobufPackage = "bytebase.v1";+export enum UserRole {+ USER_ROLE_UNSPECIFIED = 0,+ USER_ROLE_OWNER = 1,+ USER_ROLE_DBA = 2,+ USER_ROLE_DEVELOPER = 3,+ UNRECOGNIZED = -1,+}++export function userRoleFromJSON(object: any): UserRole {+ switch (object) {+ case 0:+ case "USER_ROLE_UNSPECIFIED":+ return UserRole.USER_ROLE_UNSPECIFIED;+ case 1:+ case "USER_ROLE_OWNER":+ return UserRole.USER_ROLE_OWNER;+ case 2:+ case "USER_ROLE_DBA":+ return UserRole.USER_ROLE_DBA;+ case 3:+ case "USER_ROLE_DEVELOPER":+ return UserRole.USER_ROLE_DEVELOPER;+ case -1:+ case "UNRECOGNIZED":+ default:+ return UserRole.UNRECOGNIZED;+ }+}++export function userRoleToJSON(object: UserRole): string {+ switch (object) {+ case UserRole.USER_ROLE_UNSPECIFIED:+ return "USER_ROLE_UNSPECIFIED";+ case UserRole.USER_ROLE_OWNER:+ return "USER_ROLE_OWNER";+ case UserRole.USER_ROLE_DBA:+ return "USER_ROLE_DBA";+ case UserRole.USER_ROLE_DEVELOPER:+ return "USER_ROLE_DEVELOPER";+ case UserRole.UNRECOGNIZED:+ default:+ return "UNRECOGNIZED";+ }+}++export interface CreateUserRequest {+ /** The user to create. */+ user?: User;+ /** If web is set, we will set access token, refresh token, and user to the cookie. */+ web: boolean;+}+export interface LoginRequest {email: string;password: string;@@ -18,6 +71,78 @@ export interface LoginResponse {export interface LogoutRequest {}+export interface User {+ /**+ * The name of the user.+ * Format: users/{user}. {user} is a system-generated unique ID.+ */+ name: string;+ state: State;+ email: string;+ title: string;+ password: string;+ /** The user role will not be respected in the create user request, because the role is controlled by workspace owner. */+ userRole: UserRole;+}++function createBaseCreateUserRequest(): CreateUserRequest {+ return { user: undefined, web: false };+}++export const CreateUserRequest = {+ encode(message: CreateUserRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.user !== undefined) {+ User.encode(message.user, writer.uint32(10).fork()).ldelim();+ }+ if (message.web === true) {+ writer.uint32(16).bool(message.web);+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): CreateUserRequest {+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseCreateUserRequest();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ message.user = User.decode(reader, reader.uint32());+ break;+ case 2:+ message.web = reader.bool();+ break;+ default:+ reader.skipType(tag & 7);+ break;+ }+ }+ return message;+ },++ fromJSON(object: any): CreateUserRequest {+ return {+ user: isSet(object.user) ? User.fromJSON(object.user) : undefined,+ web: isSet(object.web) ? Boolean(object.web) : false,+ };+ },++ toJSON(message: CreateUserRequest): unknown {+ const obj: any = {};+ message.user !== undefined && (obj.user = message.user ? User.toJSON(message.user) : undefined);+ message.web !== undefined && (obj.web = message.web);+ return obj;+ },++ fromPartial<I extends Exact<DeepPartial<CreateUserRequest>, I>>(object: I): CreateUserRequest {+ const message = createBaseCreateUserRequest();+ message.user = (object.user !== undefined && object.user !== null) ? User.fromPartial(object.user) : undefined;+ message.web = object.web ?? false;+ return message;+ },+};+function createBaseLoginRequest(): LoginRequest {return { email: "", password: "", web: false };}@@ -171,7 +296,102 @@ export const LogoutRequest = {},};+function createBaseUser(): User {+ return { name: "", state: 0, email: "", title: "", password: "", userRole: 0 };+}++export const User = {+ encode(message: User, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.name !== "") {+ writer.uint32(10).string(message.name);+ }+ if (message.state !== 0) {+ writer.uint32(16).int32(message.state);+ }+ if (message.email !== "") {+ writer.uint32(26).string(message.email);+ }+ if (message.title !== "") {+ writer.uint32(34).string(message.title);+ }+ if (message.password !== "") {+ writer.uint32(42).string(message.password);+ }+ if (message.userRole !== 0) {+ writer.uint32(48).int32(message.userRole);+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): User {+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseUser();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ message.name = reader.string();+ break;+ case 2:+ message.state = reader.int32() as any;+ break;+ case 3:+ message.email = reader.string();+ break;+ case 4:+ message.title = reader.string();+ break;+ case 5:+ message.password = reader.string();+ break;+ case 6:+ message.userRole = reader.int32() as any;+ break;+ default:+ reader.skipType(tag & 7);+ break;+ }+ }+ return message;+ },++ fromJSON(object: any): User {+ return {+ name: isSet(object.name) ? String(object.name) : "",+ state: isSet(object.state) ? stateFromJSON(object.state) : 0,+ email: isSet(object.email) ? String(object.email) : "",+ title: isSet(object.title) ? String(object.title) : "",+ password: isSet(object.password) ? String(object.password) : "",+ userRole: isSet(object.userRole) ? userRoleFromJSON(object.userRole) : 0,+ };+ },++ toJSON(message: User): unknown {+ const obj: any = {};+ message.name !== undefined && (obj.name = message.name);+ message.state !== undefined && (obj.state = stateToJSON(message.state));+ message.email !== undefined && (obj.email = message.email);+ message.title !== undefined && (obj.title = message.title);+ message.password !== undefined && (obj.password = message.password);+ message.userRole !== undefined && (obj.userRole = userRoleToJSON(message.userRole));+ return obj;+ },++ fromPartial<I extends Exact<DeepPartial<User>, I>>(object: I): User {+ const message = createBaseUser();+ message.name = object.name ?? "";+ message.state = object.state ?? 0;+ message.email = object.email ?? "";+ message.title = object.title ?? "";+ message.password = object.password ?? "";+ message.userRole = object.userRole ?? 0;+ return message;+ },+};+export interface AuthService {+ CreateUser(request: CreateUserRequest): Promise<User>;Login(request: LoginRequest): Promise<LoginResponse>;Logout(request: LogoutRequest): Promise<Empty>;}@@ -182,9 +402,16 @@ export class AuthServiceClientImpl implements AuthService {constructor(rpc: Rpc, opts?: { service?: string }) {this.service = opts?.service || "bytebase.v1.AuthService";this.rpc = rpc;+ this.CreateUser = this.CreateUser.bind(this);this.Login = this.Login.bind(this);this.Logout = this.Logout.bind(this);}+ CreateUser(request: CreateUserRequest): Promise<User> {+ const data = CreateUserRequest.encode(request).finish();+ const promise = this.rpc.request(this.service, "CreateUser", data);+ return promise.then((data) => User.decode(new _m0.Reader(data)));+ }+Login(request: LoginRequest): Promise<LoginResponse> {const data = LoginRequest.encode(request).finish();const promise = this.rpc.request(this.service, "Login", data);diff --git a/proto/generated-go/v1/auth_service.pb.go b/proto/generated-go/v1/auth_service.pb.goindex 991b737b85..016fa3c8a9 100644--- a/proto/generated-go/v1/auth_service.pb.go+++ b/proto/generated-go/v1/auth_service.pb.go@@ -22,6 +22,115 @@ const (_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20))+type UserRole int32++const (+ UserRole_USER_ROLE_UNSPECIFIED UserRole = 0+ UserRole_USER_ROLE_OWNER UserRole = 1+ UserRole_USER_ROLE_DBA UserRole = 2+ UserRole_USER_ROLE_DEVELOPER UserRole = 3+)++// Enum value maps for UserRole.+var (+ UserRole_name = map[int32]string{+ 0: "USER_ROLE_UNSPECIFIED",+ 1: "USER_ROLE_OWNER",+ 2: "USER_ROLE_DBA",+ 3: "USER_ROLE_DEVELOPER",+ }+ UserRole_value = map[string]int32{+ "USER_ROLE_UNSPECIFIED": 0,+ "USER_ROLE_OWNER": 1,+ "USER_ROLE_DBA": 2,+ "USER_ROLE_DEVELOPER": 3,+ }+)++func (x UserRole) Enum() *UserRole {+ p := new(UserRole)+ *p = x+ return p+}++func (x UserRole) String() string {+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))+}++func (UserRole) Descriptor() protoreflect.EnumDescriptor {+ return file_v1_auth_service_proto_enumTypes[0].Descriptor()+}++func (UserRole) Type() protoreflect.EnumType {+ return &file_v1_auth_service_proto_enumTypes[0]+}++func (x UserRole) Number() protoreflect.EnumNumber {+ return protoreflect.EnumNumber(x)+}++// Deprecated: Use UserRole.Descriptor instead.+func (UserRole) EnumDescriptor() ([]byte, []int) {+ return file_v1_auth_service_proto_rawDescGZIP(), []int{0}+}++type CreateUserRequest struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ // The user to create.+ User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`+ // If web is set, we will set access token, refresh token, and user to the cookie.+ Web bool `protobuf:"varint,2,opt,name=web,proto3" json:"web,omitempty"`+}++func (x *CreateUserRequest) Reset() {+ *x = CreateUserRequest{}+ if protoimpl.UnsafeEnabled {+ mi := &file_v1_auth_service_proto_msgTypes[0]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *CreateUserRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*CreateUserRequest) ProtoMessage() {}++func (x *CreateUserRequest) ProtoReflect() protoreflect.Message {+ mi := &file_v1_auth_service_proto_msgTypes[0]+ 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 CreateUserRequest.ProtoReflect.Descriptor instead.+func (*CreateUserRequest) Descriptor() ([]byte, []int) {+ return file_v1_auth_service_proto_rawDescGZIP(), []int{0}+}++func (x *CreateUserRequest) GetUser() *User {+ if x != nil {+ return x.User+ }+ return nil+}++func (x *CreateUserRequest) GetWeb() bool {+ if x != nil {+ return x.Web+ }+ return false+}+type LoginRequest struct {state protoimpl.MessageStatesizeCache protoimpl.SizeCache@@ -36,7 +145,7 @@ type LoginRequest struct {func (x *LoginRequest) Reset() {*x = LoginRequest{}if protoimpl.UnsafeEnabled {- mi := &file_v1_auth_service_proto_msgTypes[0]+ mi := &file_v1_auth_service_proto_msgTypes[1]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -49,7 +158,7 @@ func (x *LoginRequest) String() string {func (*LoginRequest) ProtoMessage() {}func (x *LoginRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_auth_service_proto_msgTypes[0]+ mi := &file_v1_auth_service_proto_msgTypes[1]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -62,7 +171,7 @@ func (x *LoginRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use LoginRequest.ProtoReflect.Descriptor instead.func (*LoginRequest) Descriptor() ([]byte, []int) {- return file_v1_auth_service_proto_rawDescGZIP(), []int{0}+ return file_v1_auth_service_proto_rawDescGZIP(), []int{1}}func (x *LoginRequest) GetEmail() string {@@ -97,7 +206,7 @@ type LoginResponse struct {func (x *LoginResponse) Reset() {*x = LoginResponse{}if protoimpl.UnsafeEnabled {- mi := &file_v1_auth_service_proto_msgTypes[1]+ mi := &file_v1_auth_service_proto_msgTypes[2]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -110,7 +219,7 @@ func (x *LoginResponse) String() string {func (*LoginResponse) ProtoMessage() {}func (x *LoginResponse) ProtoReflect() protoreflect.Message {- mi := &file_v1_auth_service_proto_msgTypes[1]+ mi := &file_v1_auth_service_proto_msgTypes[2]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -123,7 +232,7 @@ func (x *LoginResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use LoginResponse.ProtoReflect.Descriptor instead.func (*LoginResponse) Descriptor() ([]byte, []int) {- return file_v1_auth_service_proto_rawDescGZIP(), []int{1}+ return file_v1_auth_service_proto_rawDescGZIP(), []int{2}}func (x *LoginResponse) GetToken() string {@@ -142,7 +251,7 @@ type LogoutRequest struct {func (x *LogoutRequest) Reset() {*x = LogoutRequest{}if protoimpl.UnsafeEnabled {- mi := &file_v1_auth_service_proto_msgTypes[2]+ mi := &file_v1_auth_service_proto_msgTypes[3]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -155,7 +264,7 @@ func (x *LogoutRequest) String() string {func (*LogoutRequest) ProtoMessage() {}func (x *LogoutRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_auth_service_proto_msgTypes[2]+ mi := &file_v1_auth_service_proto_msgTypes[3]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -168,7 +277,97 @@ func (x *LogoutRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use LogoutRequest.ProtoReflect.Descriptor instead.func (*LogoutRequest) Descriptor() ([]byte, []int) {- return file_v1_auth_service_proto_rawDescGZIP(), []int{2}+ return file_v1_auth_service_proto_rawDescGZIP(), []int{3}+}++type User struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ // The name of the user.+ // Format: users/{user}. {user} is a system-generated unique ID.+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`+ State State `protobuf:"varint,2,opt,name=state,proto3,enum=bytebase.v1.State" json:"state,omitempty"`+ Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`+ Title string `protobuf:"bytes,4,opt,name=title,proto3" json:"title,omitempty"`+ Password string `protobuf:"bytes,5,opt,name=password,proto3" json:"password,omitempty"`+ // The user role will not be respected in the create user request, because the role is controlled by workspace owner.+ UserRole UserRole `protobuf:"varint,6,opt,name=user_role,json=userRole,proto3,enum=bytebase.v1.UserRole" json:"user_role,omitempty"`+}++func (x *User) Reset() {+ *x = User{}+ if protoimpl.UnsafeEnabled {+ mi := &file_v1_auth_service_proto_msgTypes[4]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *User) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*User) ProtoMessage() {}++func (x *User) ProtoReflect() protoreflect.Message {+ mi := &file_v1_auth_service_proto_msgTypes[4]+ 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 User.ProtoReflect.Descriptor instead.+func (*User) Descriptor() ([]byte, []int) {+ return file_v1_auth_service_proto_rawDescGZIP(), []int{4}+}++func (x *User) GetName() string {+ if x != nil {+ return x.Name+ }+ return ""+}++func (x *User) GetState() State {+ if x != nil {+ return x.State+ }+ return State_STATE_UNSPECIFIED+}++func (x *User) GetEmail() string {+ if x != nil {+ return x.Email+ }+ return ""+}++func (x *User) GetTitle() string {+ if x != nil {+ return x.Title+ }+ return ""+}++func (x *User) GetPassword() string {+ if x != nil {+ return x.Password+ }+ return ""+}++func (x *User) GetUserRole() UserRole {+ if x != nil {+ return x.UserRole+ }+ return UserRole_USER_ROLE_UNSPECIFIED}var File_v1_auth_service_proto protoreflect.FileDescriptor@@ -178,31 +377,67 @@ var file_v1_auth_service_proto_rawDesc = []byte{0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,0x65, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69,0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f,- 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,- 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,- 0x52, 0x0a, 0x0c, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,- 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,- 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72,- 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72,- 0x64, 0x12, 0x10, 0x0a, 0x03, 0x77, 0x65, 0x62, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03,- 0x77, 0x65, 0x62, 0x22, 0x25, 0x0a, 0x0d, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70,- 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20,- 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x0f, 0x0a, 0x0d, 0x4c, 0x6f,- 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x32, 0xc2, 0x01, 0x0a, 0x0b,- 0x41, 0x75, 0x74, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x59, 0x0a, 0x05, 0x4c,- 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x19, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,- 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,- 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f,- 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4,- 0x93, 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68,- 0x2f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x58, 0x0a, 0x06, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74,- 0x12, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c,- 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67,- 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45,- 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x01, 0x2a, 0x22,- 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x6c, 0x6f, 0x67, 0x6f, 0x75, 0x74,- 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f,- 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,+ 0x74, 0x6f, 0x1a, 0x17, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63,+ 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f,+ 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x65,+ 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f,+ 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d,+ 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x76, 0x31, 0x2f, 0x63, 0x6f,+ 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x52, 0x0a, 0x11, 0x43, 0x72,+ 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,+ 0x2b, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e,+ 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72,+ 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03,+ 0x77, 0x65, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x77, 0x65, 0x62, 0x22, 0x52,+ 0x0a, 0x0c, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14,+ 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65,+ 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64,+ 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64,+ 0x12, 0x10, 0x0a, 0x03, 0x77, 0x65, 0x62, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x77,+ 0x65, 0x62, 0x22, 0x25, 0x0a, 0x0d, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f,+ 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01,+ 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x0f, 0x0a, 0x0d, 0x4c, 0x6f, 0x67,+ 0x6f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xcc, 0x01, 0x0a, 0x04, 0x55,+ 0x73, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,+ 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x03, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a,+ 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x62,+ 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65,+ 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c,+ 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a,+ 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69,+ 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18,+ 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x04, 0x52, 0x08, 0x70, 0x61, 0x73,+ 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x32, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x72, 0x6f,+ 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x52,+ 0x08, 0x75, 0x73, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x2a, 0x66, 0x0a, 0x08, 0x55, 0x73, 0x65,+ 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x19, 0x0a, 0x15, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x52, 0x4f,+ 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00,+ 0x12, 0x13, 0x0a, 0x0f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x4f, 0x57,+ 0x4e, 0x45, 0x52, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x52, 0x4f,+ 0x4c, 0x45, 0x5f, 0x44, 0x42, 0x41, 0x10, 0x02, 0x12, 0x17, 0x0a, 0x13, 0x55, 0x53, 0x45, 0x52,+ 0x5f, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x44, 0x45, 0x56, 0x45, 0x4c, 0x4f, 0x50, 0x45, 0x52, 0x10,+ 0x03, 0x32, 0xa3, 0x02, 0x0a, 0x0b, 0x41, 0x75, 0x74, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,+ 0x65, 0x12, 0x5f, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12,+ 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72,+ 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,+ 0x11, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73,+ 0x65, 0x72, 0x22, 0x1e, 0xda, 0x41, 0x04, 0x75, 0x73, 0x65, 0x72, 0x82, 0xd3, 0xe4, 0x93, 0x02,+ 0x11, 0x3a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x09, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65,+ 0x72, 0x73, 0x12, 0x59, 0x0a, 0x05, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x19, 0x2e, 0x62, 0x79,+ 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52,+ 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,+ 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,+ 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e, 0x2f,+ 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x58, 0x0a,+ 0x06, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x12, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,+ 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75,+ 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,+ 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1a, 0x82, 0xd3, 0xe4,+ 0x93, 0x02, 0x14, 0x3a, 0x01, 0x2a, 0x22, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68,+ 0x2f, 0x6c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72,+ 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,+ 0x6f, 0x33,}var (@@ -217,23 +452,33 @@ func file_v1_auth_service_proto_rawDescGZIP() []byte {return file_v1_auth_service_proto_rawDescData}-var file_v1_auth_service_proto_msgTypes = make([]protoimpl.MessageInfo, 3)+var file_v1_auth_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)+var file_v1_auth_service_proto_msgTypes = make([]protoimpl.MessageInfo, 5)var file_v1_auth_service_proto_goTypes = []interface{}{- (*LoginRequest)(nil), // 0: bytebase.v1.LoginRequest- (*LoginResponse)(nil), // 1: bytebase.v1.LoginResponse- (*LogoutRequest)(nil), // 2: bytebase.v1.LogoutRequest- (*emptypb.Empty)(nil), // 3: google.protobuf.Empty+ (UserRole)(0), // 0: bytebase.v1.UserRole+ (*CreateUserRequest)(nil), // 1: bytebase.v1.CreateUserRequest+ (*LoginRequest)(nil), // 2: bytebase.v1.LoginRequest+ (*LoginResponse)(nil), // 3: bytebase.v1.LoginResponse+ (*LogoutRequest)(nil), // 4: bytebase.v1.LogoutRequest+ (*User)(nil), // 5: bytebase.v1.User+ (State)(0), // 6: bytebase.v1.State+ (*emptypb.Empty)(nil), // 7: google.protobuf.Empty}var file_v1_auth_service_proto_depIdxs = []int32{- 0, // 0: bytebase.v1.AuthService.Login:input_type -> bytebase.v1.LoginRequest- 2, // 1: bytebase.v1.AuthService.Logout:input_type -> bytebase.v1.LogoutRequest- 1, // 2: bytebase.v1.AuthService.Login:output_type -> bytebase.v1.LoginResponse- 3, // 3: bytebase.v1.AuthService.Logout:output_type -> google.protobuf.Empty- 2, // [2:4] is the sub-list for method output_type- 0, // [0:2] 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+ 5, // 0: bytebase.v1.CreateUserRequest.user:type_name -> bytebase.v1.User+ 6, // 1: bytebase.v1.User.state:type_name -> bytebase.v1.State+ 0, // 2: bytebase.v1.User.user_role:type_name -> bytebase.v1.UserRole+ 1, // 3: bytebase.v1.AuthService.CreateUser:input_type -> bytebase.v1.CreateUserRequest+ 2, // 4: bytebase.v1.AuthService.Login:input_type -> bytebase.v1.LoginRequest+ 4, // 5: bytebase.v1.AuthService.Logout:input_type -> bytebase.v1.LogoutRequest+ 5, // 6: bytebase.v1.AuthService.CreateUser:output_type -> bytebase.v1.User+ 3, // 7: bytebase.v1.AuthService.Login:output_type -> bytebase.v1.LoginResponse+ 7, // 8: bytebase.v1.AuthService.Logout:output_type -> google.protobuf.Empty+ 6, // [6:9] is the sub-list for method output_type+ 3, // [3:6] is the sub-list for method input_type+ 3, // [3:3] is the sub-list for extension type_name+ 3, // [3:3] is the sub-list for extension extendee+ 0, // [0:3] is the sub-list for field type_name}func init() { file_v1_auth_service_proto_init() }@@ -241,9 +486,10 @@ func file_v1_auth_service_proto_init() {if File_v1_auth_service_proto != nil {return}+ file_v1_common_proto_init()if !protoimpl.UnsafeEnabled {file_v1_auth_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*LoginRequest); i {+ switch v := v.(*CreateUserRequest); i {case 0:return &v.statecase 1:@@ -255,7 +501,7 @@ func file_v1_auth_service_proto_init() {}}file_v1_auth_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {- switch v := v.(*LoginResponse); i {+ switch v := v.(*LoginRequest); i {case 0:return &v.statecase 1:@@ -267,6 +513,18 @@ func file_v1_auth_service_proto_init() {}}file_v1_auth_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*LoginResponse); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_v1_auth_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {switch v := v.(*LogoutRequest); i {case 0:return &v.state@@ -278,19 +536,32 @@ func file_v1_auth_service_proto_init() {return nil}}+ file_v1_auth_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*User); 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{File: protoimpl.DescBuilder{GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: file_v1_auth_service_proto_rawDesc,- NumEnums: 0,- NumMessages: 3,+ NumEnums: 1,+ NumMessages: 5,NumExtensions: 0,NumServices: 1,},GoTypes: file_v1_auth_service_proto_goTypes,DependencyIndexes: file_v1_auth_service_proto_depIdxs,+ EnumInfos: file_v1_auth_service_proto_enumTypes,MessageInfos: file_v1_auth_service_proto_msgTypes,}.Build()File_v1_auth_service_proto = out.Filediff --git a/proto/generated-go/v1/auth_service.pb.gw.go b/proto/generated-go/v1/auth_service.pb.gw.goindex 3267ff4c97..3fa78918a1 100644--- a/proto/generated-go/v1/auth_service.pb.gw.go+++ b/proto/generated-go/v1/auth_service.pb.gw.go@@ -31,6 +31,58 @@ var _ = runtime.Stringvar _ = utilities.NewDoubleArrayvar _ = metadata.Join+var (+ filter_AuthService_CreateUser_0 = &utilities.DoubleArray{Encoding: map[string]int{"user": 0}, Base: []int{1, 2, 0, 0}, Check: []int{0, 1, 2, 2}}+)++func request_AuthService_CreateUser_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var protoReq CreateUserRequest+ var metadata runtime.ServerMetadata++ newReader, berr := utilities.IOReaderFactory(req.Body)+ if berr != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)+ }+ if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.User); err != nil && err != io.EOF {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }++ if err := req.ParseForm(); err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_AuthService_CreateUser_0); err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }++ msg, err := client.CreateUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))+ return msg, metadata, err++}++func local_request_AuthService_CreateUser_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var protoReq CreateUserRequest+ var metadata runtime.ServerMetadata++ newReader, berr := utilities.IOReaderFactory(req.Body)+ if berr != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)+ }+ if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.User); err != nil && err != io.EOF {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }++ if err := req.ParseForm(); err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_AuthService_CreateUser_0); err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }++ msg, err := server.CreateUser(ctx, &protoReq)+ return msg, metadata, err++}+func request_AuthService_Login_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {var protoReq LoginRequestvar metadata runtime.ServerMetadata@@ -105,6 +157,31 @@ func local_request_AuthService_Logout_0(ctx context.Context, marshaler runtime.M// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterAuthServiceHandlerFromEndpoint instead.func RegisterAuthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AuthServiceServer) error {+ mux.Handle("POST", pattern_AuthService_CreateUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {+ ctx, cancel := context.WithCancel(req.Context())+ defer cancel()+ var stream runtime.ServerTransportStream+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)+ var err error+ var annotatedContext context.Context+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.AuthService/CreateUser", runtime.WithHTTPPathPattern("/v1/users"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := local_request_AuthService_CreateUser_0(annotatedContext, inboundMarshaler, server, req, pathParams)+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)+ if err != nil {+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)+ return+ }++ forward_AuthService_CreateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)++ })+mux.Handle("POST", pattern_AuthService_Login_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {ctx, cancel := context.WithCancel(req.Context())defer cancel()@@ -196,6 +273,28 @@ func RegisterAuthServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn// "AuthServiceClient" to call the correct interceptors.func RegisterAuthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AuthServiceClient) error {+ mux.Handle("POST", pattern_AuthService_CreateUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {+ ctx, cancel := context.WithCancel(req.Context())+ defer cancel()+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)+ var err error+ var annotatedContext context.Context+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.AuthService/CreateUser", runtime.WithHTTPPathPattern("/v1/users"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := request_AuthService_CreateUser_0(annotatedContext, inboundMarshaler, client, req, pathParams)+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)+ if err != nil {+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)+ return+ }++ forward_AuthService_CreateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)++ })+mux.Handle("POST", pattern_AuthService_Login_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {ctx, cancel := context.WithCancel(req.Context())defer cancel()@@ -244,12 +343,16 @@ func RegisterAuthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux}var (+ pattern_AuthService_CreateUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "users"}, ""))+pattern_AuthService_Login_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "auth", "login"}, ""))pattern_AuthService_Logout_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "auth", "logout"}, "")))var (+ forward_AuthService_CreateUser_0 = runtime.ForwardResponseMessage+forward_AuthService_Login_0 = runtime.ForwardResponseMessageforward_AuthService_Logout_0 = runtime.ForwardResponseMessagediff --git a/proto/generated-go/v1/auth_service_grpc.pb.go b/proto/generated-go/v1/auth_service_grpc.pb.goindex ccea269f77..0cbb2a5c47 100644--- a/proto/generated-go/v1/auth_service_grpc.pb.go+++ b/proto/generated-go/v1/auth_service_grpc.pb.go@@ -23,6 +23,7 @@ const _ = grpc.SupportPackageIsVersion7//// 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.type AuthServiceClient interface {+ CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*User, error)Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error)Logout(ctx context.Context, in *LogoutRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)}@@ -35,6 +36,15 @@ func NewAuthServiceClient(cc grpc.ClientConnInterface) AuthServiceClient {return &authServiceClient{cc}}+func (c *authServiceClient) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*User, error) {+ out := new(User)+ err := c.cc.Invoke(ctx, "/bytebase.v1.AuthService/CreateUser", in, out, opts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}+func (c *authServiceClient) Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error) {out := new(LoginResponse)err := c.cc.Invoke(ctx, "/bytebase.v1.AuthService/Login", in, out, opts...)@@ -57,6 +67,7 @@ func (c *authServiceClient) Logout(ctx context.Context, in *LogoutRequest, opts// All implementations must embed UnimplementedAuthServiceServer// for forward compatibilitytype AuthServiceServer interface {+ CreateUser(context.Context, *CreateUserRequest) (*User, error)Login(context.Context, *LoginRequest) (*LoginResponse, error)Logout(context.Context, *LogoutRequest) (*emptypb.Empty, error)mustEmbedUnimplementedAuthServiceServer()@@ -66,6 +77,9 @@ type AuthServiceServer interface {type UnimplementedAuthServiceServer struct {}+func (UnimplementedAuthServiceServer) CreateUser(context.Context, *CreateUserRequest) (*User, error) {+ return nil, status.Errorf(codes.Unimplemented, "method CreateUser not implemented")+}func (UnimplementedAuthServiceServer) Login(context.Context, *LoginRequest) (*LoginResponse, error) {return nil, status.Errorf(codes.Unimplemented, "method Login not implemented")}@@ -85,6 +99,24 @@ func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer) {s.RegisterService(&AuthService_ServiceDesc, srv)}+func _AuthService_CreateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(CreateUserRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(AuthServiceServer).CreateUser(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: "/bytebase.v1.AuthService/CreateUser",+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(AuthServiceServer).CreateUser(ctx, req.(*CreateUserRequest))+ }+ return interceptor(ctx, in, info, handler)+}+func _AuthService_Login_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {in := new(LoginRequest)if err := dec(in); err != nil {@@ -128,6 +160,10 @@ var AuthService_ServiceDesc = grpc.ServiceDesc{ServiceName: "bytebase.v1.AuthService",HandlerType: (*AuthServiceServer)(nil),Methods: []grpc.MethodDesc{+ {+ MethodName: "CreateUser",+ Handler: _AuthService_CreateUser_Handler,+ },{MethodName: "Login",Handler: _AuthService_Login_Handler,diff --git a/proto/v1/auth_service.proto b/proto/v1/auth_service.protoindex 21652cebf9..b731af863f 100644--- a/proto/v1/auth_service.proto+++ b/proto/v1/auth_service.proto@@ -3,11 +3,22 @@ syntax = "proto3";package bytebase.v1;import "google/api/annotations.proto";+import "google/api/client.proto";+import "google/api/field_behavior.proto";import "google/protobuf/empty.proto";+import "v1/common.proto";+option go_package = "generated-go/v1";service AuthService {+ rpc CreateUser(CreateUserRequest) returns (User) {+ option (google.api.http) = {+ post: "/v1/users"+ body: "user"+ };+ option (google.api.method_signature) = "user";+ }rpc Login(LoginRequest) returns (LoginResponse) {option (google.api.http) = {post: "/v1/auth/login"@@ -22,6 +33,14 @@ service AuthService {}}+message CreateUserRequest {+ // The user to create.+ User user = 1 [(google.api.field_behavior) = REQUIRED];++ // If web is set, we will set access token, refresh token, and user to the cookie.+ bool web = 2;+}+message LoginRequest {string email = 1;@@ -37,3 +56,28 @@ message LoginResponse {message LogoutRequest {}++message User {+ // The name of the user.+ // Format: users/{user}. {user} is a system-generated unique ID.+ string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];++ State state = 2;++ string email = 3;++ string title = 4;++ string password = 5 [(google.api.field_behavior) = INPUT_ONLY];++ // The user role will not be respected in the create user request, because the role is controlled by workspace owner.+ UserRole user_role = 6;+}+++enum UserRole {+ USER_ROLE_UNSPECIFIED = 0;+ USER_ROLE_OWNER = 1;+ USER_ROLE_DBA = 2;+ USER_ROLE_DEVELOPER = 3;+}diff --git a/server/api/auth/config.go b/server/api/auth/config.goindex fff45abcd8..6b6d78e58f 100644--- a/server/api/auth/config.go+++ b/server/api/auth/config.go@@ -9,8 +9,9 @@ const ()var authenticationAllowlistMethods = map[string]bool{- "AuthService/Login": true,- "AuthService/Logout": true,+ "AuthService/Login": true,+ "AuthService/Logout": true,+ "AuthService/CreateUser": true,}var ownerAndDBAMethods = map[string]bool{diff --git a/server/api/v1/auth_service.go b/server/api/v1/auth_service.goindex 6fffb1d4b6..c2a873522d 100644--- a/server/api/v1/auth_service.go+++ b/server/api/v1/auth_service.go@@ -34,6 +34,11 @@ func NewAuthService(store *store.Store, secret string, profile *config.Profile)}}+// CreateUser creates a user.+func (*AuthService) CreateUser(_ context.Context, _ *v1pb.CreateUserRequest) (*v1pb.User, error) {+ return &v1pb.User{}, nil+}+// Login is the auth login method.func (s *AuthService) Login(ctx context.Context, request *v1pb.LoginRequest) (*v1pb.LoginResponse, error) {user, err := s.store.GetUserByEmail(ctx, request.Email)