Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: user service (#15225)
Danny Xu1c9d2cb6be7c
diff --git a/backend/api/auth/header.go b/backend/api/auth/header.goindex 68e17b6683..0219e4d1c9 100644--- a/backend/api/auth/header.go+++ b/backend/api/auth/header.go@@ -50,30 +50,31 @@ func (m *GatewayResponseModifier) processMetadata(ctx context.Context, md runtimExpires: time.Unix(0, 0),Path: "/",})- } else {- // Set cookie.- sameSite := http.SameSiteStrictMode- if isHTTPS {- sameSite = http.SameSiteNoneMode- }- tokenDuration := GetTokenDuration(ctx, m.Store)- http.SetCookie(response, &http.Cookie{- Name: cookieName,- Value: value,- // CookieExpDuration expires slightly earlier than the jwt expiration. Client would be logged out if the user- // cookie expires, thus the client would always logout first before attempting to make a request with the expired jwt.- // Suppose we have a valid refresh token, we will refresh the token in 2 cases:- // 1. The access token is about to expire in <<refreshThresholdDuration>>- // 2. The access token has already expired, we refresh the token so that the ongoing request can pass through.- Expires: time.Now().Add(tokenDuration - 1*time.Second),- Path: "/",- // Http-only helps mitigate the risk of client side script accessing the protected cookie.- HttpOnly: httpOnly,- // See https://github.com/bytebase/bytebase/issues/31.- Secure: isHTTPS,- SameSite: sameSite,- })+ return+ }++ // Set cookie.+ sameSite := http.SameSiteStrictMode+ if isHTTPS {+ sameSite = http.SameSiteNoneMode}+ tokenDuration := GetTokenDuration(ctx, m.Store)+ http.SetCookie(response, &http.Cookie{+ Name: cookieName,+ Value: value,+ // CookieExpDuration expires slightly earlier than the jwt expiration. Client would be logged out if the user+ // cookie expires, thus the client would always logout first before attempting to make a request with the expired jwt.+ // Suppose we have a valid refresh token, we will refresh the token in 2 cases:+ // 1. The access token is about to expire in <<refreshThresholdDuration>>+ // 2. The access token has already expired, we refresh the token so that the ongoing request can pass through.+ Expires: time.Now().Add(tokenDuration - 1*time.Second),+ Path: "/",+ // Http-only helps mitigate the risk of client side script accessing the protected cookie.+ HttpOnly: httpOnly,+ // See https://github.com/bytebase/bytebase/issues/31.+ Secure: isHTTPS,+ SameSite: sameSite,+ })}func GetTokenDuration(ctx context.Context, store *store.Store) time.Duration {diff --git a/backend/api/v1/auth_service.go b/backend/api/v1/auth_service.goindex 93232803f9..88a6c7daa7 100644--- a/backend/api/v1/auth_service.go+++ b/backend/api/v1/auth_service.go@@ -4,14 +4,10 @@ import ("context""fmt""log/slog"- "net/mail"- "regexp""slices""strings""time"- "github.com/pkg/errors"-"github.com/pquerna/otp/totp""golang.org/x/crypto/bcrypt""google.golang.org/grpc"@@ -36,7 +32,6 @@ import ("github.com/bytebase/bytebase/backend/plugin/metric""github.com/bytebase/bytebase/backend/runner/metricreport""github.com/bytebase/bytebase/backend/store"- "github.com/bytebase/bytebase/backend/utils"storepb "github.com/bytebase/bytebase/proto/generated-go/store"v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")@@ -74,578 +69,6 @@ func NewAuthService(store *store.Store, secret string, licenseService enterprise}, nil}-// GetUser gets a user.-func (s *AuthService) GetUser(ctx context.Context, request *v1pb.GetUserRequest) (*v1pb.User, error) {- userID, err := common.GetUserID(request.Name)- var user *store.UserMessage- if err != nil {- email, err := common.GetUserEmail(request.Name)- if err != nil {- return nil, status.Error(codes.InvalidArgument, err.Error())- }- u, err := s.store.GetUserByEmail(ctx, email)- if err != nil {- return nil, status.Errorf(codes.Internal, "failed to get user, error: %v", err)- }- user = u- } else {- u, err := s.store.GetUserByID(ctx, userID)- if err != nil {- return nil, status.Errorf(codes.Internal, "failed to get user, error: %v", err)- }- user = u- }- if user == nil {- return nil, status.Errorf(codes.NotFound, "user %d not found", userID)- }- return convertToUser(user), nil-}--// ListUsers lists all users.-func (s *AuthService) ListUsers(ctx context.Context, request *v1pb.ListUsersRequest) (*v1pb.ListUsersResponse, error) {- users, err := s.store.ListUsers(ctx, &store.FindUserMessage{ShowDeleted: request.ShowDeleted})- if err != nil {- return nil, status.Errorf(codes.Internal, "failed to list user, error: %v", err)- }- response := &v1pb.ListUsersResponse{}- for _, user := range users {- response.Users = append(response.Users, convertToUser(user))- }- return response, nil-}--// CreateUser creates a user.-func (s *AuthService) CreateUser(ctx context.Context, request *v1pb.CreateUserRequest) (*v1pb.User, error) {- if err := s.userCountGuard(ctx); err != nil {- return nil, err- }-- setting, err := s.store.GetWorkspaceGeneralSetting(ctx)- if err != nil {- return nil, status.Errorf(codes.Internal, "failed to find workspace setting, error: %v", err)- }-- if setting.DisallowSignup {- callerUser, ok := ctx.Value(common.UserContextKey).(*store.UserMessage)- if !ok {- return nil, status.Errorf(codes.PermissionDenied, "sign up is disallowed")- }- ok, err := s.iamManager.CheckPermission(ctx, iam.PermissionUsersCreate, callerUser)- if err != nil {- return nil, err- }- if !ok {- return nil, status.Errorf(codes.PermissionDenied, "user does not have permission %q", iam.PermissionUsersCreate)- }- }- if request.User == nil {- return nil, status.Errorf(codes.InvalidArgument, "user must be set")- }- if request.User.Email == "" {- return nil, status.Errorf(codes.InvalidArgument, "email must be set")- }- if request.User.Title == "" {- return nil, status.Errorf(codes.InvalidArgument, "user title must be set")- }-- principalType, err := convertToPrincipalType(request.User.UserType)- if err != nil {- return nil, err- }- if request.User.UserType != v1pb.UserType_SERVICE_ACCOUNT && request.User.UserType != v1pb.UserType_USER {- return nil, status.Errorf(codes.InvalidArgument, "support user and service account only")- }-- count, err := s.store.CountUsers(ctx, api.EndUser)- if err != nil {- return nil, status.Errorf(codes.Internal, "failed to count users, error: %v", err)- }- firstEndUser := count == 0-- if request.User.Phone != "" {- if err := common.ValidatePhone(request.User.Phone); err != nil {- return nil, status.Errorf(codes.InvalidArgument, "invalid phone %q, error: %v", request.User.Phone, err)- }- }-- if err := s.validateEmailWithDomains(ctx, request.User.Email, principalType == api.ServiceAccount); err != nil {- return nil, err- }- existingUser, err := s.store.GetUserByEmail(ctx, request.User.Email)- if err != nil {- return nil, status.Errorf(codes.Internal, "failed to find user by email, error: %v", err)- }- if existingUser != nil {- return nil, status.Errorf(codes.AlreadyExists, "email %s is already existed", request.User.Email)- }-- password := request.User.Password- if request.User.UserType == v1pb.UserType_SERVICE_ACCOUNT {- pwd, err := common.RandomString(20)- if err != nil {- return nil, status.Errorf(codes.Internal, "failed to generate access key for service account.")- }- password = fmt.Sprintf("%s%s", api.ServiceAccountAccessKeyPrefix, pwd)- } else {- if password != "" {- if err := s.validatePassword(ctx, password); err != nil {- return nil, err- }- } else {- pwd, err := common.RandomString(20)- if err != nil {- return nil, status.Errorf(codes.Internal, "failed to generate random password for service account.")- }- password = pwd- }- }- passwordHash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)- if err != nil {- return nil, status.Errorf(codes.Internal, "failed to generate password hash, error: %v", err)- }- userMessage := &store.UserMessage{- Email: request.User.Email,- Name: request.User.Title,- Phone: request.User.Phone,- Type: principalType,- PasswordHash: string(passwordHash),- }-- user, err := s.store.CreateUser(ctx, userMessage)- if err != nil {- return nil, status.Errorf(codes.Internal, "failed to create user, error: %v", err)- }-- if firstEndUser {- // The first end user should be workspace admin.- updateRole := &store.PatchIamPolicyMessage{- Member: common.FormatUserUID(user.ID),- Roles: []string{common.FormatRole(api.WorkspaceAdmin.String())},- }- if _, err := s.store.PatchWorkspaceIamPolicy(ctx, updateRole); err != nil {- return nil, err- }- }-- if err := s.postCreateUser(ctx, user, firstEndUser); err != nil {- return nil, err- }-- isFirstUser := user.ID == api.PrincipalIDForFirstUser- s.metricReporter.Report(ctx, &metric.Metric{- Name: metricapi.PrincipalRegistrationMetricName,- Value: 1,- Labels: map[string]any{- "email": user.Email,- "name": user.Name,- "phone": user.Phone,- // We only send lark notification for the first principal registration.- // false means do not notify upfront. Later the notification will be triggered by the scheduler.- "lark_notified": !isFirstUser,- },- })-- userResponse := convertToUser(user)- if request.User.UserType == v1pb.UserType_SERVICE_ACCOUNT {- userResponse.ServiceKey = password- }- return userResponse, nil-}--func (s *AuthService) validatePassword(ctx context.Context, password string) error {- passwordRestriction, err := s.store.GetPasswordRestrictionSetting(ctx)- if err != nil {- return status.Errorf(codes.Internal, "failed to get password restriction with error: %v", err)- }- if len(password) < int(passwordRestriction.MinLength) {- return status.Errorf(codes.InvalidArgument, "password length should no less than %v characters", passwordRestriction.MinLength)- }- if passwordRestriction.RequireNumber && !regexp.MustCompile("[0-9]+").MatchString(password) {- return status.Errorf(codes.InvalidArgument, "password must contains at least 1 number")- }- if passwordRestriction.RequireLetter && !regexp.MustCompile("[a-zA-Z]+").MatchString(password) {- return status.Errorf(codes.InvalidArgument, "password must contains at least 1 lower case letter")- }- if passwordRestriction.RequireUppercaseLetter && !regexp.MustCompile("[A-Z]+").MatchString(password) {- return status.Errorf(codes.InvalidArgument, "password must contains at least 1 upper case letter")- }- if passwordRestriction.RequireSpecialCharacter && !regexp.MustCompile(`[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]+`).MatchString(password) {- return status.Errorf(codes.InvalidArgument, "password must contains at least 1 special character")- }- return nil-}--// UpdateUser updates a user.-func (s *AuthService) UpdateUser(ctx context.Context, request *v1pb.UpdateUserRequest) (*v1pb.User, error) {- callerUser, ok := ctx.Value(common.UserContextKey).(*store.UserMessage)- if !ok {- return nil, status.Errorf(codes.PermissionDenied, "failed to get caller user")- }- if request.User == nil {- return nil, status.Errorf(codes.InvalidArgument, "user must be set")- }- if request.UpdateMask == nil {- return nil, status.Errorf(codes.InvalidArgument, "update_mask must be set")- }-- userID, err := common.GetUserID(request.User.Name)- if err != nil {- return nil, status.Error(codes.InvalidArgument, err.Error())- }- user, err := s.store.GetUserByID(ctx, userID)- if err != nil {- return nil, status.Errorf(codes.Internal, "failed to get user, error: %v", err)- }- if user == nil {- return nil, status.Errorf(codes.NotFound, "user %d not found", userID)- }- if user.MemberDeleted {- return nil, status.Errorf(codes.NotFound, "user %q has been deleted", userID)- }-- if callerUser.ID != userID {- ok, err := s.iamManager.CheckPermission(ctx, iam.PermissionUsersUpdate, callerUser)- if err != nil {- return nil, err- }- if !ok {- return nil, status.Errorf(codes.PermissionDenied, "user does not have permission %q", iam.PermissionUsersUpdate)- }- }-- var passwordPatch *string- patch := &store.UpdateUserMessage{}- for _, path := range request.UpdateMask.Paths {- switch path {- case "email":- if user.Profile.Source != "" {- return nil, status.Errorf(codes.InvalidArgument, "cannot change email for external user")- }- if err := s.validateEmailWithDomains(ctx, request.User.Email, user.Type == api.ServiceAccount); err != nil {- return nil, err- }- existedUser, err := s.store.GetUserByEmail(ctx, request.User.Email)- if err != nil {- return nil, status.Errorf(codes.Internal, "failed to find user list, error: %v", err)- }- if existedUser != nil && existedUser.ID != user.ID {- return nil, status.Errorf(codes.AlreadyExists, "email %s is already existed", request.User.Email)- }- patch.Email = &request.User.Email- case "title":- patch.Name = &request.User.Title- case "password":- if user.Type != api.EndUser {- return nil, status.Errorf(codes.InvalidArgument, "password can be mutated for end users only")- }- if err := s.validatePassword(ctx, request.User.Password); err != nil {- return nil, err- }- passwordPatch = &request.User.Password- case "service_key":- if user.Type != api.ServiceAccount {- return nil, status.Errorf(codes.InvalidArgument, "service key can be mutated for service accounts only")- }- val, err := common.RandomString(20)- if err != nil {- return nil, status.Errorf(codes.Internal, "failed to generate access key for service account.")- }- password := fmt.Sprintf("%s%s", api.ServiceAccountAccessKeyPrefix, val)- passwordPatch = &password- case "mfa_enabled":- if request.User.MfaEnabled {- if user.MFAConfig.TempOtpSecret == "" || len(user.MFAConfig.TempRecoveryCodes) == 0 {- return nil, status.Errorf(codes.InvalidArgument, "MFA is not setup yet")- }- patch.MFAConfig = &storepb.MFAConfig{- OtpSecret: user.MFAConfig.TempOtpSecret,- RecoveryCodes: user.MFAConfig.TempRecoveryCodes,- }- } else {- setting, err := s.store.GetWorkspaceGeneralSetting(ctx)- if err != nil {- return nil, status.Errorf(codes.Internal, "failed to find workspace setting, error: %v", err)- }- if setting.Require_2Fa {- isWorkspaceAdmin, err := s.isUserWorkspaceAdmin(ctx, callerUser)- if err != nil {- return nil, status.Errorf(codes.Internal, "failed to check user roles, error: %v", err)- }- // Allow workspace admin to disable 2FA even if it is required.- if !isWorkspaceAdmin {- return nil, status.Errorf(codes.InvalidArgument, "2FA is required and cannot be disabled")- }- }- patch.MFAConfig = &storepb.MFAConfig{}- }- case "phone":- if request.User.Phone != "" {- if err := common.ValidatePhone(request.User.Phone); err != nil {- return nil, status.Errorf(codes.InvalidArgument, "invalid phone number %q, error: %v", request.User.Phone, err)- }- }- patch.Phone = &request.User.Phone- }- }- if passwordPatch != nil {- if err := bcrypt.CompareHashAndPassword([]byte(user.PasswordHash), []byte(*passwordPatch)); err == nil {- // return bad request if the passwords match- return nil, status.Errorf(codes.InvalidArgument, "password cannot be the same")- }-- passwordHash, err := bcrypt.GenerateFromPassword([]byte((*passwordPatch)), bcrypt.DefaultCost)- if err != nil {- return nil, status.Errorf(codes.Internal, "failed to generate password hash, error: %v", err)- }- passwordHashStr := string(passwordHash)- patch.PasswordHash = &passwordHashStr- }- // This flag is mainly used for validating OTP code when user setup MFA.- // We only validate OTP code but not update user.- if request.OtpCode != nil {- isValid := validateWithCodeAndSecret(*request.OtpCode, user.MFAConfig.TempOtpSecret)- if !isValid {- return nil, status.Errorf(codes.InvalidArgument, "invalid OTP code")- }- }- // This flag will regenerate temp secret and temp recovery codes.- // It will be used when user setup MFA and regenerating recovery codes.- if request.RegenerateTempMfaSecret {- tempSecret, err := generateRandSecret(user.Email)- if err != nil {- return nil, status.Errorf(codes.Internal, "failed to generate MFA secret, error: %v", err)- }- tempRecoveryCodes, err := generateRecoveryCodes(10)- if err != nil {- return nil, status.Errorf(codes.Internal, "failed to generate recovery codes, error: %v", err)- }- patch.MFAConfig = &storepb.MFAConfig{- TempOtpSecret: tempSecret,- TempRecoveryCodes: tempRecoveryCodes,- }- if user.MFAConfig != nil {- patch.MFAConfig.OtpSecret = user.MFAConfig.OtpSecret- patch.MFAConfig.RecoveryCodes = user.MFAConfig.RecoveryCodes- }- }- // This flag will update user's recovery codes with temp recovery codes.- // It will be used when user regenerate recovery codes after two phase commit.- if request.RegenerateRecoveryCodes {- if user.MFAConfig.OtpSecret == "" {- return nil, status.Errorf(codes.InvalidArgument, "MFA is not enabled")- }- if len(user.MFAConfig.TempRecoveryCodes) == 0 {- return nil, status.Errorf(codes.InvalidArgument, "No recovery codes to update")- }- patch.MFAConfig = &storepb.MFAConfig{- OtpSecret: user.MFAConfig.OtpSecret,- RecoveryCodes: user.MFAConfig.TempRecoveryCodes,- }- }-- user, err = s.store.UpdateUser(ctx, user, patch)- if err != nil {- return nil, status.Errorf(codes.Internal, "failed to update user, error: %v", err)- }-- userResponse := convertToUser(user)- if request.User.UserType == v1pb.UserType_SERVICE_ACCOUNT && passwordPatch != nil {- userResponse.ServiceKey = *passwordPatch- }- return userResponse, nil-}--// DeleteUser deletes a user.-func (s *AuthService) DeleteUser(ctx context.Context, request *v1pb.DeleteUserRequest) (*emptypb.Empty, error) {- callerUser, ok := ctx.Value(common.UserContextKey).(*store.UserMessage)- if !ok {- return nil, status.Errorf(codes.PermissionDenied, "failed to get caller user")- }- ok, err := s.iamManager.CheckPermission(ctx, iam.PermissionUsersDelete, callerUser)- if err != nil {- return nil, err- }- if !ok {- return nil, status.Errorf(codes.PermissionDenied, "user does not have permission %q", iam.PermissionUsersDelete)- }-- userID, err := common.GetUserID(request.Name)- if err != nil {- return nil, status.Error(codes.InvalidArgument, err.Error())- }- user, err := s.store.GetUserByID(ctx, userID)- if err != nil {- return nil, status.Errorf(codes.Internal, "failed to get user, error: %v", err)- }- if user == nil {- return nil, status.Errorf(codes.NotFound, "user %d not found", userID)- }- if user.MemberDeleted {- return nil, status.Errorf(codes.NotFound, "user %q has been deleted", userID)- }-- // Check if there is still workspace admin if the current user is deleted.- policy, err := s.store.GetWorkspaceIamPolicy(ctx)- if err != nil {- return nil, err- }- ok = hasExtraWorkspaceAdmin(policy.Policy, user.ID)- if !ok {- return nil, status.Errorf(codes.InvalidArgument, "workspace must have at least one admin")- }-- if _, err := s.store.UpdateUser(ctx, user, &store.UpdateUserMessage{Delete: &deletePatch}); err != nil {- return nil, status.Error(codes.Internal, err.Error())- }- return &emptypb.Empty{}, nil-}--func hasExtraWorkspaceAdmin(policy *storepb.IamPolicy, userID int) bool {- workspaceAdminRole := common.FormatRole(api.WorkspaceAdmin.String())- userMember := common.FormatUserUID(userID)- systemBotMember := common.FormatUserUID(api.SystemBotID)- for _, binding := range policy.GetBindings() {- if binding.GetRole() != workspaceAdminRole {- continue- }- for _, member := range binding.GetMembers() {- if member != userMember && member != systemBotMember {- return true- }- }- }- return false-}--// UndeleteUser undeletes a user.-func (s *AuthService) UndeleteUser(ctx context.Context, request *v1pb.UndeleteUserRequest) (*v1pb.User, error) {- if err := s.userCountGuard(ctx); err != nil {- return nil, err- }-- callerUser, ok := ctx.Value(common.UserContextKey).(*store.UserMessage)- if !ok {- return nil, status.Errorf(codes.PermissionDenied, "failed to get caller user")- }- ok, err := s.iamManager.CheckPermission(ctx, iam.PermissionUsersUndelete, callerUser)- if err != nil {- return nil, err- }- if !ok {- return nil, status.Errorf(codes.PermissionDenied, "user does not have permission %q", iam.PermissionUsersUndelete)- }-- userID, err := common.GetUserID(request.Name)- if err != nil {- return nil, status.Error(codes.InvalidArgument, err.Error())- }- user, err := s.store.GetUserByID(ctx, userID)- if err != nil {- return nil, status.Errorf(codes.Internal, "failed to get user, error: %v", err)- }- if user == nil {- return nil, status.Errorf(codes.NotFound, "user %d not found", userID)- }- if !user.MemberDeleted {- return nil, status.Errorf(codes.InvalidArgument, "user %q is already active", userID)- }-- user, err = s.store.UpdateUser(ctx, user, &store.UpdateUserMessage{Delete: &undeletePatch})- if err != nil {- return nil, status.Error(codes.Internal, err.Error())- }- return convertToUser(user), nil-}--func convertToUser(user *store.UserMessage) *v1pb.User {- userType := v1pb.UserType_USER_TYPE_UNSPECIFIED- switch user.Type {- case api.EndUser:- userType = v1pb.UserType_USER- case api.SystemBot:- userType = v1pb.UserType_SYSTEM_BOT- case api.ServiceAccount:- userType = v1pb.UserType_SERVICE_ACCOUNT- }-- convertedUser := &v1pb.User{- Name: common.FormatUserUID(user.ID),- State: convertDeletedToState(user.MemberDeleted),- Email: user.Email,- Phone: user.Phone,- Title: user.Name,- UserType: userType,- Profile: &v1pb.User_Profile{- LastLoginTime: user.Profile.LastLoginTime,- LastChangePasswordTime: user.Profile.LastChangePasswordTime,- Source: user.Profile.Source,- },- }-- if user.MFAConfig != nil {- convertedUser.MfaEnabled = user.MFAConfig.OtpSecret != ""- convertedUser.MfaSecret = user.MFAConfig.TempOtpSecret- convertedUser.RecoveryCodes = user.MFAConfig.TempRecoveryCodes- }- return convertedUser-}--func convertToPrincipalType(userType v1pb.UserType) (api.PrincipalType, error) {- var t api.PrincipalType- switch userType {- case v1pb.UserType_USER:- t = api.EndUser- case v1pb.UserType_SYSTEM_BOT:- t = api.SystemBot- case v1pb.UserType_SERVICE_ACCOUNT:- t = api.ServiceAccount- default:- return t, status.Errorf(codes.InvalidArgument, "invalid user type %s", userType)- }- return t, nil-}--func (s *AuthService) needResetPassword(ctx context.Context, user *store.UserMessage) bool {- // Reset password restriction only works for end user with email & password login.- if user.Type != api.EndUser {- return false- }- if err := s.licenseService.IsFeatureEnabled(api.FeaturePasswordRestriction); err != nil {- return false- }-- passwordRestriction, err := s.store.GetPasswordRestrictionSetting(ctx)- if err != nil {- slog.Error("failed to get password restriction", log.BBError(err))- return false- }-- if user.Profile.LastLoginTime == nil {- if !passwordRestriction.RequireResetPasswordForFirstLogin {- return false- }- count, err := s.store.CountUsers(ctx, api.EndUser)- if err != nil {- slog.Error("failed to count end users", log.BBError(err))- return false- }- // The 1st workspace admin login don't need to reset the password- return count > 1- }-- if passwordRestriction.PasswordRotation != nil && passwordRestriction.PasswordRotation.GetNanos() > 0 {- lastChangePasswordTime := user.CreatedAt- if user.Profile.LastChangePasswordTime != nil {- lastChangePasswordTime = user.Profile.LastChangePasswordTime.AsTime()- }- if lastChangePasswordTime.Add(time.Duration(passwordRestriction.PasswordRotation.GetNanos())).Before(time.Now()) {- return true- }- }-- return false-}-// Login is the auth login method including SSO.func (s *AuthService) Login(ctx context.Context, request *v1pb.LoginRequest) (*v1pb.LoginResponse, error) {var loginUser *store.UserMessage@@ -706,7 +129,7 @@ func (s *AuthService) Login(ctx context.Context, request *v1pb.LoginRequest) (*vif err != nil {return nil, status.Errorf(codes.Internal, "failed to find workspace setting, error: %v", err)}- isWorkspaceAdmin, err := s.isUserWorkspaceAdmin(ctx, loginUser)+ isWorkspaceAdmin, err := isUserWorkspaceAdmin(ctx, s.store, loginUser)if err != nil {return nil, status.Errorf(codes.Internal, "failed to check user roles, error: %v", err)}@@ -716,7 +139,7 @@ func (s *AuthService) Login(ctx context.Context, request *v1pb.LoginRequest) (*vreturn nil, status.Errorf(codes.PermissionDenied, "password signin is disallowed")}// Check domain restriction for end users.- if err := s.validateEmailWithDomains(ctx, loginUser.Email, false); err != nil {+ if err := validateEmailWithDomains(ctx, s.licenseService, s.store, loginUser.Email, false, false); err != nil {return nil, err}}@@ -790,6 +213,47 @@ func (s *AuthService) Login(ctx context.Context, request *v1pb.LoginRequest) (*vreturn response, nil}+func (s *AuthService) needResetPassword(ctx context.Context, user *store.UserMessage) bool {+ // Reset password restriction only works for end user with email & password login.+ if user.Type != api.EndUser {+ return false+ }+ if err := s.licenseService.IsFeatureEnabled(api.FeaturePasswordRestriction); err != nil {+ return false+ }++ passwordRestriction, err := s.store.GetPasswordRestrictionSetting(ctx)+ if err != nil {+ slog.Error("failed to get password restriction", log.BBError(err))+ return false+ }++ if user.Profile.LastLoginTime == nil {+ if !passwordRestriction.RequireResetPasswordForFirstLogin {+ return false+ }+ count, err := s.store.CountUsers(ctx, api.EndUser)+ if err != nil {+ slog.Error("failed to count end users", log.BBError(err))+ return false+ }+ // The 1st workspace admin login don't need to reset the password+ return count > 1+ }++ if passwordRestriction.PasswordRotation != nil && passwordRestriction.PasswordRotation.GetNanos() > 0 {+ lastChangePasswordTime := user.CreatedAt+ if user.Profile.LastChangePasswordTime != nil {+ lastChangePasswordTime = user.Profile.LastChangePasswordTime.AsTime()+ }+ if lastChangePasswordTime.Add(time.Duration(passwordRestriction.PasswordRotation.GetNanos())).Before(time.Now()) {+ return true+ }+ }++ return false+}+// Logout is the auth logout method.func (s *AuthService) Logout(ctx context.Context, _ *v1pb.LogoutRequest) (*emptypb.Empty, error) {md, ok := metadata.FromIncomingContext(ctx)@@ -940,7 +404,7 @@ func (s *AuthService) getOrCreateUserWithIDP(ctx context.Context, request *v1pb.}}// If the email is still invalid, we will return an error.- if err := s.validateEmailWithDomains(ctx, email, false /* isServiceAccount */); err != nil {+ if err := validateEmailWithDomains(ctx, s.licenseService, s.store, email, false /* isServiceAccount */, false); err != nil {return nil, err}@@ -1011,135 +475,7 @@ func (s *AuthService) challengeRecoveryCode(ctx context.Context, user *store.Usereturn status.Errorf(codes.Unauthenticated, "invalid recovery code")}-func validateEmail(email string) error {- if email != strings.ToLower(email) {- return errors.New("email should be lowercase")- }- if _, err := mail.ParseAddress(email); err != nil {- return err- }- return nil-}--func (s *AuthService) validateEmailWithDomains(ctx context.Context, email string, isServiceAccount bool) error {- if s.licenseService.IsFeatureEnabled(api.FeatureDomainRestriction) != nil {- // nolint:nilerr- // feature not enabled, only validate email and skip domain restriction.- if err := validateEmail(email); err != nil {- return status.Errorf(codes.InvalidArgument, "invalid email: %v", err.Error())- }- return nil- }- setting, err := s.store.GetWorkspaceGeneralSetting(ctx)- if err != nil {- return status.Errorf(codes.Internal, "failed to find workspace setting, error: %v", err)- }-- var allowedDomains []string- if setting.EnforceIdentityDomain {- allowedDomains = setting.Domains- }- if err := validateEmailWithDomains(email, allowedDomains, isServiceAccount); err != nil {- return status.Errorf(codes.InvalidArgument, "invalid email %q, error: %v", email, err)- }- return nil-}--func validateEmailWithDomains(email string, allowedDomains []string, isServiceAccount bool) error {- // Check if the email is valid.- if err := validateEmail(email); err != nil {- return err- }- // Domain restrictions are not applied to service account.- if isServiceAccount {- return nil- }- // Enforce domain restrictions.- if len(allowedDomains) > 0 {- ok := false- for _, v := range allowedDomains {- if strings.HasSuffix(email, fmt.Sprintf("@%s", v)) {- ok = true- break- }- }- if !ok {- return errors.Errorf("email %q does not belong to domains %v", email, allowedDomains)- }- }- return nil-}--func extractDomain(input string) string {- pattern := `[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+`- regExp, err := regexp.Compile(pattern)- if err != nil {- // WHen the pattern is invalid, we just return the input.- return input- }-- match := regExp.FindString(input)- domainParts := strings.Split(match, ".")- // If the domain has at least 3 parts, we will remove the first part.- if len(domainParts) >= 3 {- match = strings.Join(domainParts[1:], ".")- }- return match-}--const (- // issuerName is the name of the issuer of the OTP token.- issuerName = "Bytebase"-)--// generateRandSecret generates a random secret for the given account name.-func generateRandSecret(accountName string) (string, error) {- key, err := totp.Generate(totp.GenerateOpts{- Issuer: issuerName,- AccountName: accountName,- })- if err != nil {- return "", err- }- return key.Secret(), nil-}-// validateWithCodeAndSecret validates the given code against the given secret.func validateWithCodeAndSecret(code, secret string) bool {return totp.Validate(code, secret)}--// generateRecoveryCodes generates n recovery codes.-func generateRecoveryCodes(n int) ([]string, error) {- recoveryCodes := make([]string, n)- for i := 0; i < n; i++ {- code, err := common.RandomString(10)- if err != nil {- return nil, err- }- recoveryCodes[i] = code- }- return recoveryCodes, nil-}--func (s *AuthService) userCountGuard(ctx context.Context) error {- userLimit := s.licenseService.GetPlanLimitValue(ctx, enterprise.PlanLimitMaximumUser)-- count, err := s.store.CountActiveUsers(ctx)- if err != nil {- return status.Error(codes.Internal, err.Error())- }- if count >= userLimit {- return status.Errorf(codes.ResourceExhausted, "reached the maximum user count %d", userLimit)- }- return nil-}--func (s *AuthService) isUserWorkspaceAdmin(ctx context.Context, user *store.UserMessage) (bool, error) {- workspacePolicy, err := s.store.GetWorkspaceIamPolicy(ctx)- if err != nil {- return false, err- }- roles := utils.GetUserFormattedRolesMap(ctx, s.store, user, workspacePolicy.Policy)- return roles[common.FormatRole(api.WorkspaceAdmin.String())], nil-}diff --git a/backend/api/v1/group_service.go b/backend/api/v1/group_service.goindex 293e0477e5..7e308874f0 100644--- a/backend/api/v1/group_service.go+++ b/backend/api/v1/group_service.go@@ -9,6 +9,7 @@ import ("github.com/bytebase/bytebase/backend/common""github.com/bytebase/bytebase/backend/component/iam"+ enterprise "github.com/bytebase/bytebase/backend/enterprise/api"api "github.com/bytebase/bytebase/backend/legacyapi""github.com/bytebase/bytebase/backend/store"storepb "github.com/bytebase/bytebase/proto/generated-go/store"@@ -18,15 +19,17 @@ import (// GroupService implements the group service.type GroupService struct {v1pb.UnimplementedGroupServiceServer- store *store.Store- iamManager *iam.Manager+ store *store.Store+ iamManager *iam.Manager+ licenseService enterprise.LicenseService}// NewGroupService creates a new GroupService.-func NewGroupService(store *store.Store, iamManager *iam.Manager) *GroupService {+func NewGroupService(store *store.Store, iamManager *iam.Manager, licenseService enterprise.LicenseService) *GroupService {return &GroupService{- store: store,- iamManager: iamManager,+ store: store,+ iamManager: iamManager,+ licenseService: licenseService,}}@@ -70,14 +73,7 @@ func (s *GroupService) CreateGroup(ctx context.Context, request *v1pb.CreateGroureturn nil, status.Error(codes.InvalidArgument, err.Error())}- setting, err := s.store.GetWorkspaceGeneralSetting(ctx)- if err != nil {- return nil, status.Errorf(codes.Internal, "failed to get workspace setting: %v", err)- }- if len(setting.Domains) == 0 {- return nil, status.Errorf(codes.FailedPrecondition, "workspace domain is required for creating groups")- }- if err := validateEmailWithDomains(groupMessage.Email, setting.Domains, false /* isServiceAccount */); err != nil {+ if err := validateEmailWithDomains(ctx, s.licenseService, s.store, groupMessage.Email, false /* isServiceAccount */, true); err != nil {return nil, status.Errorf(codes.InvalidArgument, "invalid email %q, error: %v", groupMessage.Email, err)}diff --git a/backend/api/v1/user_service.go b/backend/api/v1/user_service.gonew file mode 100644index 0000000000..87e891aa91--- /dev/null+++ b/backend/api/v1/user_service.go@@ -0,0 +1,711 @@+package v1++import (+ "context"+ "fmt"+ "net/mail"+ "regexp"+ "strings"++ "github.com/pkg/errors"++ "github.com/pquerna/otp/totp"+ "golang.org/x/crypto/bcrypt"+ "google.golang.org/grpc/codes"+ "google.golang.org/grpc/status"+ "google.golang.org/protobuf/types/known/emptypb"++ "github.com/bytebase/bytebase/backend/common"+ "github.com/bytebase/bytebase/backend/component/config"+ "github.com/bytebase/bytebase/backend/component/iam"+ "github.com/bytebase/bytebase/backend/component/state"+ enterprise "github.com/bytebase/bytebase/backend/enterprise/api"+ api "github.com/bytebase/bytebase/backend/legacyapi"+ metricapi "github.com/bytebase/bytebase/backend/metric"+ "github.com/bytebase/bytebase/backend/plugin/metric"+ "github.com/bytebase/bytebase/backend/runner/metricreport"+ "github.com/bytebase/bytebase/backend/store"+ "github.com/bytebase/bytebase/backend/utils"+ storepb "github.com/bytebase/bytebase/proto/generated-go/store"+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"+)++// UserService implements the user service.+type UserService struct {+ v1pb.UnimplementedUserServiceServer+ store *store.Store+ secret string+ licenseService enterprise.LicenseService+ metricReporter *metricreport.Reporter+ profile *config.Profile+ stateCfg *state.State+ iamManager *iam.Manager+ postCreateUser func(ctx context.Context, user *store.UserMessage, firstEndUser bool) error+}++// NewUserService creates a new UserService.+func NewUserService(store *store.Store, secret string, licenseService enterprise.LicenseService, metricReporter *metricreport.Reporter, profile *config.Profile, stateCfg *state.State, iamManager *iam.Manager, postCreateUser func(ctx context.Context, user *store.UserMessage, firstEndUser bool) error) (*UserService, error) {+ return &UserService{+ store: store,+ secret: secret,+ licenseService: licenseService,+ metricReporter: metricReporter,+ profile: profile,+ stateCfg: stateCfg,+ iamManager: iamManager,+ postCreateUser: postCreateUser,+ }, nil+}++// GetUser gets a user.+func (s *UserService) GetUser(ctx context.Context, request *v1pb.GetUserRequest) (*v1pb.User, error) {+ userID, err := common.GetUserID(request.Name)+ var user *store.UserMessage+ if err != nil {+ email, err := common.GetUserEmail(request.Name)+ if err != nil {+ return nil, status.Error(codes.InvalidArgument, err.Error())+ }+ u, err := s.store.GetUserByEmail(ctx, email)+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to get user, error: %v", err)+ }+ user = u+ } else {+ u, err := s.store.GetUserByID(ctx, userID)+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to get user, error: %v", err)+ }+ user = u+ }+ if user == nil {+ return nil, status.Errorf(codes.NotFound, "user %d not found", userID)+ }+ return convertToUser(user), nil+}++// ListUsers lists all users.+func (s *UserService) ListUsers(ctx context.Context, request *v1pb.ListUsersRequest) (*v1pb.ListUsersResponse, error) {+ users, err := s.store.ListUsers(ctx, &store.FindUserMessage{ShowDeleted: request.ShowDeleted})+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to list user, error: %v", err)+ }+ response := &v1pb.ListUsersResponse{}+ for _, user := range users {+ response.Users = append(response.Users, convertToUser(user))+ }+ return response, nil+}++// CreateUser creates a user.+func (s *UserService) CreateUser(ctx context.Context, request *v1pb.CreateUserRequest) (*v1pb.User, error) {+ if err := s.userCountGuard(ctx); err != nil {+ return nil, err+ }++ setting, err := s.store.GetWorkspaceGeneralSetting(ctx)+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to find workspace setting, error: %v", err)+ }++ if setting.DisallowSignup {+ callerUser, ok := ctx.Value(common.UserContextKey).(*store.UserMessage)+ if !ok {+ return nil, status.Errorf(codes.PermissionDenied, "sign up is disallowed")+ }+ ok, err := s.iamManager.CheckPermission(ctx, iam.PermissionUsersCreate, callerUser)+ if err != nil {+ return nil, err+ }+ if !ok {+ return nil, status.Errorf(codes.PermissionDenied, "user does not have permission %q", iam.PermissionUsersCreate)+ }+ }+ if request.User == nil {+ return nil, status.Errorf(codes.InvalidArgument, "user must be set")+ }+ if request.User.Email == "" {+ return nil, status.Errorf(codes.InvalidArgument, "email must be set")+ }+ if request.User.Title == "" {+ return nil, status.Errorf(codes.InvalidArgument, "user title must be set")+ }++ principalType, err := convertToPrincipalType(request.User.UserType)+ if err != nil {+ return nil, err+ }+ if request.User.UserType != v1pb.UserType_SERVICE_ACCOUNT && request.User.UserType != v1pb.UserType_USER {+ return nil, status.Errorf(codes.InvalidArgument, "support user and service account only")+ }++ count, err := s.store.CountUsers(ctx, api.EndUser)+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to count users, error: %v", err)+ }+ firstEndUser := count == 0++ if request.User.Phone != "" {+ if err := common.ValidatePhone(request.User.Phone); err != nil {+ return nil, status.Errorf(codes.InvalidArgument, "invalid phone %q, error: %v", request.User.Phone, err)+ }+ }++ if err := validateEmailWithDomains(ctx, s.licenseService, s.store, request.User.Email, principalType == api.ServiceAccount, false); err != nil {+ return nil, err+ }+ existingUser, err := s.store.GetUserByEmail(ctx, request.User.Email)+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to find user by email, error: %v", err)+ }+ if existingUser != nil {+ return nil, status.Errorf(codes.AlreadyExists, "email %s is already existed", request.User.Email)+ }++ password := request.User.Password+ if request.User.UserType == v1pb.UserType_SERVICE_ACCOUNT {+ pwd, err := common.RandomString(20)+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to generate access key for service account.")+ }+ password = fmt.Sprintf("%s%s", api.ServiceAccountAccessKeyPrefix, pwd)+ } else {+ if password != "" {+ if err := s.validatePassword(ctx, password); err != nil {+ return nil, err+ }+ } else {+ pwd, err := common.RandomString(20)+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to generate random password for service account.")+ }+ password = pwd+ }+ }+ passwordHash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to generate password hash, error: %v", err)+ }+ userMessage := &store.UserMessage{+ Email: request.User.Email,+ Name: request.User.Title,+ Phone: request.User.Phone,+ Type: principalType,+ PasswordHash: string(passwordHash),+ }++ user, err := s.store.CreateUser(ctx, userMessage)+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to create user, error: %v", err)+ }++ if firstEndUser {+ // The first end user should be workspace admin.+ updateRole := &store.PatchIamPolicyMessage{+ Member: common.FormatUserUID(user.ID),+ Roles: []string{common.FormatRole(api.WorkspaceAdmin.String())},+ }+ if _, err := s.store.PatchWorkspaceIamPolicy(ctx, updateRole); err != nil {+ return nil, err+ }+ }++ if err := s.postCreateUser(ctx, user, firstEndUser); err != nil {+ return nil, err+ }++ isFirstUser := user.ID == api.PrincipalIDForFirstUser+ s.metricReporter.Report(ctx, &metric.Metric{+ Name: metricapi.PrincipalRegistrationMetricName,+ Value: 1,+ Labels: map[string]any{+ "email": user.Email,+ "name": user.Name,+ "phone": user.Phone,+ // We only send lark notification for the first principal registration.+ // false means do not notify upfront. Later the notification will be triggered by the scheduler.+ "lark_notified": !isFirstUser,+ },+ })++ userResponse := convertToUser(user)+ if request.User.UserType == v1pb.UserType_SERVICE_ACCOUNT {+ userResponse.ServiceKey = password+ }+ return userResponse, nil+}++func (s *UserService) validatePassword(ctx context.Context, password string) error {+ passwordRestriction, err := s.store.GetPasswordRestrictionSetting(ctx)+ if err != nil {+ return status.Errorf(codes.Internal, "failed to get password restriction with error: %v", err)+ }+ if len(password) < int(passwordRestriction.MinLength) {+ return status.Errorf(codes.InvalidArgument, "password length should no less than %v characters", passwordRestriction.MinLength)+ }+ if passwordRestriction.RequireNumber && !regexp.MustCompile("[0-9]+").MatchString(password) {+ return status.Errorf(codes.InvalidArgument, "password must contains at least 1 number")+ }+ if passwordRestriction.RequireLetter && !regexp.MustCompile("[a-zA-Z]+").MatchString(password) {+ return status.Errorf(codes.InvalidArgument, "password must contains at least 1 lower case letter")+ }+ if passwordRestriction.RequireUppercaseLetter && !regexp.MustCompile("[A-Z]+").MatchString(password) {+ return status.Errorf(codes.InvalidArgument, "password must contains at least 1 upper case letter")+ }+ if passwordRestriction.RequireSpecialCharacter && !regexp.MustCompile(`[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]+`).MatchString(password) {+ return status.Errorf(codes.InvalidArgument, "password must contains at least 1 special character")+ }+ return nil+}++// UpdateUser updates a user.+func (s *UserService) UpdateUser(ctx context.Context, request *v1pb.UpdateUserRequest) (*v1pb.User, error) {+ callerUser, ok := ctx.Value(common.UserContextKey).(*store.UserMessage)+ if !ok {+ return nil, status.Errorf(codes.PermissionDenied, "failed to get caller user")+ }+ if request.User == nil {+ return nil, status.Errorf(codes.InvalidArgument, "user must be set")+ }+ if request.UpdateMask == nil {+ return nil, status.Errorf(codes.InvalidArgument, "update_mask must be set")+ }++ userID, err := common.GetUserID(request.User.Name)+ if err != nil {+ return nil, status.Error(codes.InvalidArgument, err.Error())+ }+ user, err := s.store.GetUserByID(ctx, userID)+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to get user, error: %v", err)+ }+ if user == nil {+ return nil, status.Errorf(codes.NotFound, "user %d not found", userID)+ }+ if user.MemberDeleted {+ return nil, status.Errorf(codes.NotFound, "user %q has been deleted", userID)+ }++ if callerUser.ID != userID {+ ok, err := s.iamManager.CheckPermission(ctx, iam.PermissionUsersUpdate, callerUser)+ if err != nil {+ return nil, err+ }+ if !ok {+ return nil, status.Errorf(codes.PermissionDenied, "user does not have permission %q", iam.PermissionUsersUpdate)+ }+ }++ var passwordPatch *string+ patch := &store.UpdateUserMessage{}+ for _, path := range request.UpdateMask.Paths {+ switch path {+ case "email":+ if user.Profile.Source != "" {+ return nil, status.Errorf(codes.InvalidArgument, "cannot change email for external user")+ }+ if err := validateEmailWithDomains(ctx, s.licenseService, s.store, request.User.Email, user.Type == api.ServiceAccount, false); err != nil {+ return nil, err+ }+ existedUser, err := s.store.GetUserByEmail(ctx, request.User.Email)+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to find user list, error: %v", err)+ }+ if existedUser != nil && existedUser.ID != user.ID {+ return nil, status.Errorf(codes.AlreadyExists, "email %s is already existed", request.User.Email)+ }+ patch.Email = &request.User.Email+ case "title":+ patch.Name = &request.User.Title+ case "password":+ if user.Type != api.EndUser {+ return nil, status.Errorf(codes.InvalidArgument, "password can be mutated for end users only")+ }+ if err := s.validatePassword(ctx, request.User.Password); err != nil {+ return nil, err+ }+ passwordPatch = &request.User.Password+ case "service_key":+ if user.Type != api.ServiceAccount {+ return nil, status.Errorf(codes.InvalidArgument, "service key can be mutated for service accounts only")+ }+ val, err := common.RandomString(20)+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to generate access key for service account.")+ }+ password := fmt.Sprintf("%s%s", api.ServiceAccountAccessKeyPrefix, val)+ passwordPatch = &password+ case "mfa_enabled":+ if request.User.MfaEnabled {+ if user.MFAConfig.TempOtpSecret == "" || len(user.MFAConfig.TempRecoveryCodes) == 0 {+ return nil, status.Errorf(codes.InvalidArgument, "MFA is not setup yet")+ }+ patch.MFAConfig = &storepb.MFAConfig{+ OtpSecret: user.MFAConfig.TempOtpSecret,+ RecoveryCodes: user.MFAConfig.TempRecoveryCodes,+ }+ } else {+ setting, err := s.store.GetWorkspaceGeneralSetting(ctx)+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to find workspace setting, error: %v", err)+ }+ if setting.Require_2Fa {+ isWorkspaceAdmin, err := isUserWorkspaceAdmin(ctx, s.store, callerUser)+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to check user roles, error: %v", err)+ }+ // Allow workspace admin to disable 2FA even if it is required.+ if !isWorkspaceAdmin {+ return nil, status.Errorf(codes.InvalidArgument, "2FA is required and cannot be disabled")+ }+ }+ patch.MFAConfig = &storepb.MFAConfig{}+ }+ case "phone":+ if request.User.Phone != "" {+ if err := common.ValidatePhone(request.User.Phone); err != nil {+ return nil, status.Errorf(codes.InvalidArgument, "invalid phone number %q, error: %v", request.User.Phone, err)+ }+ }+ patch.Phone = &request.User.Phone+ }+ }+ if passwordPatch != nil {+ if err := bcrypt.CompareHashAndPassword([]byte(user.PasswordHash), []byte(*passwordPatch)); err == nil {+ // return bad request if the passwords match+ return nil, status.Errorf(codes.InvalidArgument, "password cannot be the same")+ }++ passwordHash, err := bcrypt.GenerateFromPassword([]byte((*passwordPatch)), bcrypt.DefaultCost)+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to generate password hash, error: %v", err)+ }+ passwordHashStr := string(passwordHash)+ patch.PasswordHash = &passwordHashStr+ }+ // This flag is mainly used for validating OTP code when user setup MFA.+ // We only validate OTP code but not update user.+ if request.OtpCode != nil {+ isValid := validateWithCodeAndSecret(*request.OtpCode, user.MFAConfig.TempOtpSecret)+ if !isValid {+ return nil, status.Errorf(codes.InvalidArgument, "invalid OTP code")+ }+ }+ // This flag will regenerate temp secret and temp recovery codes.+ // It will be used when user setup MFA and regenerating recovery codes.+ if request.RegenerateTempMfaSecret {+ tempSecret, err := generateRandSecret(user.Email)+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to generate MFA secret, error: %v", err)+ }+ tempRecoveryCodes, err := generateRecoveryCodes(10)+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to generate recovery codes, error: %v", err)+ }+ patch.MFAConfig = &storepb.MFAConfig{+ TempOtpSecret: tempSecret,+ TempRecoveryCodes: tempRecoveryCodes,+ }+ if user.MFAConfig != nil {+ patch.MFAConfig.OtpSecret = user.MFAConfig.OtpSecret+ patch.MFAConfig.RecoveryCodes = user.MFAConfig.RecoveryCodes+ }+ }+ // This flag will update user's recovery codes with temp recovery codes.+ // It will be used when user regenerate recovery codes after two phase commit.+ if request.RegenerateRecoveryCodes {+ if user.MFAConfig.OtpSecret == "" {+ return nil, status.Errorf(codes.InvalidArgument, "MFA is not enabled")+ }+ if len(user.MFAConfig.TempRecoveryCodes) == 0 {+ return nil, status.Errorf(codes.InvalidArgument, "No recovery codes to update")+ }+ patch.MFAConfig = &storepb.MFAConfig{+ OtpSecret: user.MFAConfig.OtpSecret,+ RecoveryCodes: user.MFAConfig.TempRecoveryCodes,+ }+ }++ user, err = s.store.UpdateUser(ctx, user, patch)+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to update user, error: %v", err)+ }++ userResponse := convertToUser(user)+ if request.User.UserType == v1pb.UserType_SERVICE_ACCOUNT && passwordPatch != nil {+ userResponse.ServiceKey = *passwordPatch+ }+ return userResponse, nil+}++// DeleteUser deletes a user.+func (s *UserService) DeleteUser(ctx context.Context, request *v1pb.DeleteUserRequest) (*emptypb.Empty, error) {+ callerUser, ok := ctx.Value(common.UserContextKey).(*store.UserMessage)+ if !ok {+ return nil, status.Errorf(codes.PermissionDenied, "failed to get caller user")+ }+ ok, err := s.iamManager.CheckPermission(ctx, iam.PermissionUsersDelete, callerUser)+ if err != nil {+ return nil, err+ }+ if !ok {+ return nil, status.Errorf(codes.PermissionDenied, "user does not have permission %q", iam.PermissionUsersDelete)+ }++ userID, err := common.GetUserID(request.Name)+ if err != nil {+ return nil, status.Error(codes.InvalidArgument, err.Error())+ }+ user, err := s.store.GetUserByID(ctx, userID)+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to get user, error: %v", err)+ }+ if user == nil {+ return nil, status.Errorf(codes.NotFound, "user %d not found", userID)+ }+ if user.MemberDeleted {+ return nil, status.Errorf(codes.NotFound, "user %q has been deleted", userID)+ }++ // Check if there is still workspace admin if the current user is deleted.+ policy, err := s.store.GetWorkspaceIamPolicy(ctx)+ if err != nil {+ return nil, err+ }+ ok = hasExtraWorkspaceAdmin(policy.Policy, user.ID)+ if !ok {+ return nil, status.Errorf(codes.InvalidArgument, "workspace must have at least one admin")+ }++ if _, err := s.store.UpdateUser(ctx, user, &store.UpdateUserMessage{Delete: &deletePatch}); err != nil {+ return nil, status.Error(codes.Internal, err.Error())+ }+ return &emptypb.Empty{}, nil+}++func hasExtraWorkspaceAdmin(policy *storepb.IamPolicy, userID int) bool {+ workspaceAdminRole := common.FormatRole(api.WorkspaceAdmin.String())+ userMember := common.FormatUserUID(userID)+ systemBotMember := common.FormatUserUID(api.SystemBotID)+ for _, binding := range policy.GetBindings() {+ if binding.GetRole() != workspaceAdminRole {+ continue+ }+ for _, member := range binding.GetMembers() {+ if member != userMember && member != systemBotMember {+ return true+ }+ }+ }+ return false+}++// UndeleteUser undeletes a user.+func (s *UserService) UndeleteUser(ctx context.Context, request *v1pb.UndeleteUserRequest) (*v1pb.User, error) {+ if err := s.userCountGuard(ctx); err != nil {+ return nil, err+ }++ callerUser, ok := ctx.Value(common.UserContextKey).(*store.UserMessage)+ if !ok {+ return nil, status.Errorf(codes.PermissionDenied, "failed to get caller user")+ }+ ok, err := s.iamManager.CheckPermission(ctx, iam.PermissionUsersUndelete, callerUser)+ if err != nil {+ return nil, err+ }+ if !ok {+ return nil, status.Errorf(codes.PermissionDenied, "user does not have permission %q", iam.PermissionUsersUndelete)+ }++ userID, err := common.GetUserID(request.Name)+ if err != nil {+ return nil, status.Error(codes.InvalidArgument, err.Error())+ }+ user, err := s.store.GetUserByID(ctx, userID)+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to get user, error: %v", err)+ }+ if user == nil {+ return nil, status.Errorf(codes.NotFound, "user %d not found", userID)+ }+ if !user.MemberDeleted {+ return nil, status.Errorf(codes.InvalidArgument, "user %q is already active", userID)+ }++ user, err = s.store.UpdateUser(ctx, user, &store.UpdateUserMessage{Delete: &undeletePatch})+ if err != nil {+ return nil, status.Error(codes.Internal, err.Error())+ }+ return convertToUser(user), nil+}++func convertToUser(user *store.UserMessage) *v1pb.User {+ userType := v1pb.UserType_USER_TYPE_UNSPECIFIED+ switch user.Type {+ case api.EndUser:+ userType = v1pb.UserType_USER+ case api.SystemBot:+ userType = v1pb.UserType_SYSTEM_BOT+ case api.ServiceAccount:+ userType = v1pb.UserType_SERVICE_ACCOUNT+ }++ convertedUser := &v1pb.User{+ Name: common.FormatUserUID(user.ID),+ State: convertDeletedToState(user.MemberDeleted),+ Email: user.Email,+ Phone: user.Phone,+ Title: user.Name,+ UserType: userType,+ Profile: &v1pb.User_Profile{+ LastLoginTime: user.Profile.LastLoginTime,+ LastChangePasswordTime: user.Profile.LastChangePasswordTime,+ Source: user.Profile.Source,+ },+ }++ if user.MFAConfig != nil {+ convertedUser.MfaEnabled = user.MFAConfig.OtpSecret != ""+ convertedUser.MfaSecret = user.MFAConfig.TempOtpSecret+ convertedUser.RecoveryCodes = user.MFAConfig.TempRecoveryCodes+ }+ return convertedUser+}++func convertToPrincipalType(userType v1pb.UserType) (api.PrincipalType, error) {+ var t api.PrincipalType+ switch userType {+ case v1pb.UserType_USER:+ t = api.EndUser+ case v1pb.UserType_SYSTEM_BOT:+ t = api.SystemBot+ case v1pb.UserType_SERVICE_ACCOUNT:+ t = api.ServiceAccount+ default:+ return t, status.Errorf(codes.InvalidArgument, "invalid user type %s", userType)+ }+ return t, nil+}++func validateEmailWithDomains(ctx context.Context, licenseService enterprise.LicenseService, stores *store.Store, email string, isServiceAccount bool, checkDomainSetting bool) error {+ if licenseService.IsFeatureEnabled(api.FeatureDomainRestriction) != nil {+ // nolint:nilerr+ // feature not enabled, only validate email and skip domain restriction.+ if err := validateEmail(email); err != nil {+ return status.Errorf(codes.InvalidArgument, "invalid email: %v", err.Error())+ }+ return nil+ }+ setting, err := stores.GetWorkspaceGeneralSetting(ctx)+ if err != nil {+ return status.Errorf(codes.Internal, "failed to find workspace setting, error: %v", err)+ }++ var allowedDomains []string+ if checkDomainSetting || setting.EnforceIdentityDomain {+ allowedDomains = setting.Domains+ }++ // Check if the email is valid.+ if err := validateEmail(email); err != nil {+ return err+ }+ // Domain restrictions are not applied to service account.+ if isServiceAccount {+ return nil+ }+ // Enforce domain restrictions.+ if len(allowedDomains) > 0 {+ ok := false+ for _, v := range allowedDomains {+ if strings.HasSuffix(email, fmt.Sprintf("@%s", v)) {+ ok = true+ break+ }+ }+ if !ok {+ return errors.Errorf("email %q does not belong to domains %v", email, allowedDomains)+ }+ }+ return nil+}++func validateEmail(email string) error {+ if email != strings.ToLower(email) {+ return errors.New("email should be lowercase")+ }+ if _, err := mail.ParseAddress(email); err != nil {+ return err+ }+ return nil+}++func extractDomain(input string) string {+ pattern := `[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+`+ regExp, err := regexp.Compile(pattern)+ if err != nil {+ // WHen the pattern is invalid, we just return the input.+ return input+ }++ match := regExp.FindString(input)+ domainParts := strings.Split(match, ".")+ // If the domain has at least 3 parts, we will remove the first part.+ if len(domainParts) >= 3 {+ match = strings.Join(domainParts[1:], ".")+ }+ return match+}++const (+ // issuerName is the name of the issuer of the OTP token.+ issuerName = "Bytebase"+)++// generateRandSecret generates a random secret for the given account name.+func generateRandSecret(accountName string) (string, error) {+ key, err := totp.Generate(totp.GenerateOpts{+ Issuer: issuerName,+ AccountName: accountName,+ })+ if err != nil {+ return "", err+ }+ return key.Secret(), nil+}++// generateRecoveryCodes generates n recovery codes.+func generateRecoveryCodes(n int) ([]string, error) {+ recoveryCodes := make([]string, n)+ for i := 0; i < n; i++ {+ code, err := common.RandomString(10)+ if err != nil {+ return nil, err+ }+ recoveryCodes[i] = code+ }+ return recoveryCodes, nil+}++func (s *UserService) userCountGuard(ctx context.Context) error {+ userLimit := s.licenseService.GetPlanLimitValue(ctx, enterprise.PlanLimitMaximumUser)++ count, err := s.store.CountActiveUsers(ctx)+ if err != nil {+ return status.Error(codes.Internal, err.Error())+ }+ if count >= userLimit {+ return status.Errorf(codes.ResourceExhausted, "reached the maximum user count %d", userLimit)+ }+ return nil+}++func isUserWorkspaceAdmin(ctx context.Context, stores *store.Store, user *store.UserMessage) (bool, error) {+ workspacePolicy, err := stores.GetWorkspaceIamPolicy(ctx)+ if err != nil {+ return false, err+ }+ roles := utils.GetUserFormattedRolesMap(ctx, stores, user, workspacePolicy.Policy)+ return roles[common.FormatRole(api.WorkspaceAdmin.String())], nil+}diff --git a/backend/server/grpc_routes.go b/backend/server/grpc_routes.goindex bb41eba600..4e4f0529f2 100644--- a/backend/server/grpc_routes.go+++ b/backend/server/grpc_routes.go@@ -46,8 +46,13 @@ func configureGrpcRouters(if err != nil {return nil, nil, nil, nil, nil, err}+ userService, err := apiv1.NewUserService(stores, secret, licenseService, metricReporter, profile, stateCfg, iamManager, postCreateUser)+ if err != nil {+ return nil, nil, nil, nil, nil, err+ }v1pb.RegisterAuditLogServiceServer(grpcServer, apiv1.NewAuditLogService(stores, iamManager, licenseService))v1pb.RegisterAuthServiceServer(grpcServer, authService)+ v1pb.RegisterUserServiceServer(grpcServer, userService)v1pb.RegisterActuatorServiceServer(grpcServer, apiv1.NewActuatorService(stores, profile, licenseService))v1pb.RegisterSubscriptionServiceServer(grpcServer, apiv1.NewSubscriptionService(stores,@@ -92,7 +97,7 @@ func configureGrpcRouters(v1pb.RegisterDatabaseGroupServiceServer(grpcServer, apiv1.NewDatabaseGroupService(stores, profile, iamManager, licenseService))v1pb.RegisterChangelistServiceServer(grpcServer, apiv1.NewChangelistService(stores, profile, iamManager))v1pb.RegisterVCSConnectorServiceServer(grpcServer, apiv1.NewVCSConnectorService(stores))- v1pb.RegisterGroupServiceServer(grpcServer, apiv1.NewGroupService(stores, iamManager))+ v1pb.RegisterGroupServiceServer(grpcServer, apiv1.NewGroupService(stores, iamManager, licenseService))v1pb.RegisterReviewConfigServiceServer(grpcServer, apiv1.NewReviewConfigService(stores, licenseService))// REST gateway proxy.@@ -112,6 +117,9 @@ func configureGrpcRouters(if err := v1pb.RegisterActuatorServiceHandler(ctx, mux, grpcConn); err != nil {return nil, nil, nil, nil, nil, err}+ if err := v1pb.RegisterUserServiceHandler(ctx, mux, grpcConn); err != nil {+ return nil, nil, nil, nil, nil, err+ }if err := v1pb.RegisterAnomalyServiceHandler(ctx, mux, grpcConn); err != nil {return nil, nil, nil, nil, nil, err}diff --git a/backend/tests/tests.go b/backend/tests/tests.goindex 87544cbe12..92b3ae3073 100644--- a/backend/tests/tests.go+++ b/backend/tests/tests.go@@ -130,6 +130,7 @@ type controller struct {databaseGroupServiceClient v1pb.DatabaseGroupServiceClientvcsConnectorServiceClient v1pb.VCSConnectorServiceClientauthServiceClient v1pb.AuthServiceClient+ userServiceClient v1pb.UserServiceClientsettingServiceClient v1pb.SettingServiceClientenvironmentServiceClient v1pb.EnvironmentServiceClientinstanceServiceClient v1pb.InstanceServiceClient@@ -397,6 +398,7 @@ func (ctl *controller) start(ctx context.Context, port int) (context.Context, erctl.databaseGroupServiceClient = v1pb.NewDatabaseGroupServiceClient(ctl.grpcConn)ctl.vcsConnectorServiceClient = v1pb.NewVCSConnectorServiceClient(ctl.grpcConn)ctl.authServiceClient = v1pb.NewAuthServiceClient(ctl.grpcConn)+ ctl.userServiceClient = v1pb.NewUserServiceClient(ctl.grpcConn)ctl.settingServiceClient = v1pb.NewSettingServiceClient(ctl.grpcConn)ctl.environmentServiceClient = v1pb.NewEnvironmentServiceClient(ctl.grpcConn)ctl.instanceServiceClient = v1pb.NewInstanceServiceClient(ctl.grpcConn)@@ -498,7 +500,7 @@ func (*controller) provisionSQLiteInstance(rootDir, name string) (string, error)// signupAndLogin will signup and login as user [email protected].func (ctl *controller) signupAndLogin(ctx context.Context) (string, error) {- if _, err := ctl.authServiceClient.CreateUser(ctx, &v1pb.CreateUserRequest{+ if _, err := ctl.userServiceClient.CreateUser(ctx, &v1pb.CreateUserRequest{User: &v1pb.User{Email: "[email protected]",Password: "1024bytebase",diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/Subscribers/SubscriberList.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/Subscribers/SubscriberList.vueindex 82e6a527da..5448ddd7e3 100644--- a/frontend/src/components/IssueV1/components/IssueCommentSection/Subscribers/SubscriberList.vue+++ b/frontend/src/components/IssueV1/components/IssueCommentSection/Subscribers/SubscriberList.vue@@ -42,8 +42,8 @@ import { updateIssueSubscribers, useIssueContext } from "@/components/IssueV1";import UserAvatar from "@/components/User/UserAvatar.vue";import { useUserStore } from "@/store";import { unknownUser } from "@/types";-import { type User } from "@/types/proto/v1/auth_service";-import { UserType } from "@/types/proto/v1/auth_service";+import { type User } from "@/types/proto/v1/user_service";+import { UserType } from "@/types/proto/v1/user_service";import { State } from "@/types/proto/v1/common";import { extractUserResourceName } from "@/utils";import SubscriberListItem from "./SubscriberListItem.vue";diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/Subscribers/SubscriberListItem.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/Subscribers/SubscriberListItem.vueindex d6b6584824..8cc67f0981 100644--- a/frontend/src/components/IssueV1/components/IssueCommentSection/Subscribers/SubscriberListItem.vue+++ b/frontend/src/components/IssueV1/components/IssueCommentSection/Subscribers/SubscriberListItem.vue@@ -10,7 +10,7 @@<script setup lang="ts">import UserAvatar from "@/components/User/UserAvatar.vue";-import { type User } from "@/types/proto/v1/auth_service";+import { type User } from "@/types/proto/v1/user_service";defineProps<{user: User;diff --git a/frontend/src/components/IssueV1/components/Sidebar/ReviewSection/Timeline.vue b/frontend/src/components/IssueV1/components/Sidebar/ReviewSection/Timeline.vueindex be1943e845..655a661a46 100644--- a/frontend/src/components/IssueV1/components/Sidebar/ReviewSection/Timeline.vue+++ b/frontend/src/components/IssueV1/components/Sidebar/ReviewSection/Timeline.vue@@ -95,7 +95,7 @@ import {} from "naive-ui";import { useIssueContext } from "@/components/IssueV1/logic";import type { WrappedReviewStep } from "@/types";-import { type User } from "@/types/proto/v1/auth_service";+import { type User } from "@/types/proto/v1/user_service";import type { ApprovalStep } from "@/types/proto/v1/issue_service";import { approvalNodeText } from "@/utils";import Approver from "./Approver.vue";diff --git a/frontend/src/components/IssueV1/logic/action/task.ts b/frontend/src/components/IssueV1/logic/action/task.tsindex d39491cc40..26ac8382a6 100644--- a/frontend/src/components/IssueV1/logic/action/task.ts+++ b/frontend/src/components/IssueV1/logic/action/task.ts@@ -4,7 +4,7 @@ import { t } from "@/plugins/i18n";import { useCurrentUserV1 } from "@/store";import { userNamePrefix } from "@/store/modules/v1/common";import type { ComposedIssue } from "@/types";-import { type User } from "@/types/proto/v1/auth_service";+import { type User } from "@/types/proto/v1/user_service";import { IssueStatus, Issue_Type } from "@/types/proto/v1/issue_service";import type { Task } from "@/types/proto/v1/rollout_service";import { Task_Status, Task_Type } from "@/types/proto/v1/rollout_service";diff --git a/frontend/src/components/IssueV1/logic/context.ts b/frontend/src/components/IssueV1/logic/context.tsindex 90d27fc0bc..47129b5298 100644--- a/frontend/src/components/IssueV1/logic/context.ts+++ b/frontend/src/components/IssueV1/logic/context.ts@@ -4,7 +4,7 @@ import { v4 as uuidv4 } from "uuid";import type { InjectionKey, Ref, ComputedRef } from "vue";import { inject, provide } from "vue";import type { ComposedIssue, ReviewFlow } from "@/types";-import { type User } from "@/types/proto/v1/auth_service";+import { type User } from "@/types/proto/v1/user_service";import type { Issue_Approver_Status } from "@/types/proto/v1/issue_service";import type { PlanCheckRun } from "@/types/proto/v1/plan_service";import type { Stage, Task } from "@/types/proto/v1/rollout_service";diff --git a/frontend/src/components/IssueV1/logic/releaser.ts b/frontend/src/components/IssueV1/logic/releaser.tsindex 64fec296f3..f32f4da190 100644--- a/frontend/src/components/IssueV1/logic/releaser.ts+++ b/frontend/src/components/IssueV1/logic/releaser.ts@@ -2,7 +2,7 @@ import { uniqBy } from "lodash-es";import { useUserStore } from "@/store";import { userNamePrefix, roleNamePrefix } from "@/store/modules/v1/common";import type { ComposedIssue } from "@/types";-import { type User } from "@/types/proto/v1/auth_service";+import { type User } from "@/types/proto/v1/user_service";import { extractUserResourceName, memberListInProjectIAM } from "@/utils";export const releaserCandidatesForIssue = (issue: ComposedIssue) => {diff --git a/frontend/src/components/Member/MemberDataTable/cells/UserNameCell.vue b/frontend/src/components/Member/MemberDataTable/cells/UserNameCell.vueindex 6cc3e2628b..b35b9ede4c 100644--- a/frontend/src/components/Member/MemberDataTable/cells/UserNameCell.vue+++ b/frontend/src/components/Member/MemberDataTable/cells/UserNameCell.vue@@ -52,7 +52,7 @@ import YouTag from "@/components/misc/YouTag.vue";import { useCurrentUserV1, usePermissionStore } from "@/store";import { SYSTEM_BOT_USER_NAME } from "@/types";import { unknownUser } from "@/types";-import { User, UserType } from "@/types/proto/v1/auth_service";+import { User, UserType } from "@/types/proto/v1/user_service";import type { MemberBinding } from "../../types";const props = defineProps<{diff --git a/frontend/src/components/Member/MemberDataTable/cells/UserOperationsCell.vue b/frontend/src/components/Member/MemberDataTable/cells/UserOperationsCell.vueindex a9a7e6365c..898f5c44ee 100644--- a/frontend/src/components/Member/MemberDataTable/cells/UserOperationsCell.vue+++ b/frontend/src/components/Member/MemberDataTable/cells/UserOperationsCell.vue@@ -34,7 +34,7 @@ import { PencilIcon, Trash2Icon } from "lucide-vue-next";import { NButton, NPopconfirm } from "naive-ui";import { computed } from "vue";import { unknownUser } from "@/types";-import { UserType } from "@/types/proto/v1/auth_service";+import { UserType } from "@/types/proto/v1/user_service";import { State } from "@/types/proto/v1/common";import type { MemberBinding } from "../../types";diff --git a/frontend/src/components/Member/MemberDataTable/index.vue b/frontend/src/components/Member/MemberDataTable/index.vueindex 98a4182a37..f8557648ca 100644--- a/frontend/src/components/Member/MemberDataTable/index.vue+++ b/frontend/src/components/Member/MemberDataTable/index.vue@@ -22,7 +22,7 @@ import GroupMemberNameCell from "@/components/User/Settings/UserDataTableByGroupimport GroupNameCell from "@/components/User/Settings/UserDataTableByGroup/cells/GroupNameCell.vue";import { useUserStore } from "@/store";import { unknownUser } from "@/types";-import type { User } from "@/types/proto/v1/auth_service";+import type { User } from "@/types/proto/v1/user_service";import type { MemberBinding } from "../types";import UserNameCell from "./cells/UserNameCell.vue";import UserOperationsCell from "./cells/UserOperationsCell.vue";diff --git a/frontend/src/components/Member/MemberDataTableByRole.vue b/frontend/src/components/Member/MemberDataTableByRole.vueindex b17dcb0f9c..45bdacdabf 100644--- a/frontend/src/components/Member/MemberDataTableByRole.vue+++ b/frontend/src/components/Member/MemberDataTableByRole.vue@@ -18,7 +18,7 @@ import { NDataTable } from "naive-ui";import { computed, h } from "vue";import { useI18n } from "vue-i18n";import GroupNameCell from "@/components/User/Settings/UserDataTableByGroup/cells/GroupNameCell.vue";-import type { User } from "@/types/proto/v1/auth_service";+import type { User } from "@/types/proto/v1/user_service";import { displayRoleTitle } from "@/utils";import UserNameCell from "./MemberDataTable/cells/UserNameCell.vue";import UserOperationsCell from "./MemberDataTable/cells/UserOperationsCell.vue";diff --git a/frontend/src/components/Member/types.ts b/frontend/src/components/Member/types.tsindex cc872aca28..0227ce0bd6 100644--- a/frontend/src/components/Member/types.ts+++ b/frontend/src/components/Member/types.ts@@ -1,4 +1,4 @@-import { type User } from "@/types/proto/v1/auth_service";+import { type User } from "@/types/proto/v1/user_service";import type { Group } from "@/types/proto/v1/group_service";import type { Binding } from "@/types/proto/v1/iam_policy";diff --git a/frontend/src/components/PrincipalAvatar.vue b/frontend/src/components/PrincipalAvatar.vueindex d801a53051..de82351ace 100644--- a/frontend/src/components/PrincipalAvatar.vue+++ b/frontend/src/components/PrincipalAvatar.vue@@ -14,7 +14,7 @@ import { computed } from "vue";import { BBAvatar } from "@/bbkit";import type { BBAvatarSizeType } from "@/bbkit/types";import { UNKNOWN_ID, unknownUser } from "@/types";-import { type User } from "@/types/proto/v1/auth_service";+import type { User } from "@/types/proto/v1/user_service";import type { VueClass } from "@/utils";import { extractUserUID } from "@/utils";diff --git a/frontend/src/components/ProjectMember/ProjectMemberRolePanel/index.vue b/frontend/src/components/ProjectMember/ProjectMemberRolePanel/index.vueindex 39396980d6..d3255e9a61 100644--- a/frontend/src/components/ProjectMember/ProjectMemberRolePanel/index.vue+++ b/frontend/src/components/ProjectMember/ProjectMemberRolePanel/index.vue@@ -230,7 +230,7 @@ import {import { groupNamePrefix } from "@/store/modules/v1/common";import type { ComposedProject, DatabaseResource } from "@/types";import { PresetRoleType, PRESET_ROLES } from "@/types";-import { type User } from "@/types/proto/v1/auth_service";+import { type User } from "@/types/proto/v1/user_service";import { State } from "@/types/proto/v1/common";import { Binding } from "@/types/proto/v1/iam_policy";import { displayRoleTitle, hasProjectPermissionV2 } from "@/utils";diff --git a/frontend/src/components/RegenerateRecoveryCodesView.vue b/frontend/src/components/RegenerateRecoveryCodesView.vueindex 788a759ead..71241e4028 100644--- a/frontend/src/components/RegenerateRecoveryCodesView.vue+++ b/frontend/src/components/RegenerateRecoveryCodesView.vue@@ -22,7 +22,7 @@ import { NButton } from "naive-ui";import { computed, onMounted, reactive } from "vue";import { useI18n } from "vue-i18n";import { pushNotification, useAuthStore, useUserStore } from "@/store";-import { UpdateUserRequest } from "@/types/proto/v1/auth_service";+import { UpdateUserRequest } from "@/types/proto/v1/user_service";import RecoveryCodesView from "./RecoveryCodesView.vue";interface LocalState {diff --git a/frontend/src/components/SensitiveData/types.ts b/frontend/src/components/SensitiveData/types.tsindex 8d1c1d5139..b5f19dbf83 100644--- a/frontend/src/components/SensitiveData/types.ts+++ b/frontend/src/components/SensitiveData/types.ts@@ -1,5 +1,5 @@import type { ComposedDatabase, DatabaseResource } from "@/types";-import { type User } from "@/types/proto/v1/auth_service";+import { type User } from "@/types/proto/v1/user_service";import type { Group } from "@/types/proto/v1/group_service";import type { MaskingExceptionPolicy_MaskingException_Action } from "@/types/proto/v1/org_policy_service";diff --git a/frontend/src/components/User/Settings/CreateUserDrawer.vue b/frontend/src/components/User/Settings/CreateUserDrawer.vueindex 606306eca9..376b2ea173 100644--- a/frontend/src/components/User/Settings/CreateUserDrawer.vue+++ b/frontend/src/components/User/Settings/CreateUserDrawer.vue@@ -171,7 +171,7 @@ import {UpdateUserRequest,UserType,User,-} from "@/types/proto/v1/auth_service";+} from "@/types/proto/v1/user_service";import { State } from "@/types/proto/v1/common";import UserPassword from "./UserPassword.vue";diff --git a/frontend/src/components/User/Settings/UserDataTable/cells/GroupsCell.vue b/frontend/src/components/User/Settings/UserDataTable/cells/GroupsCell.vueindex f41a4cfada..cb1306f6a0 100644--- a/frontend/src/components/User/Settings/UserDataTable/cells/GroupsCell.vue+++ b/frontend/src/components/User/Settings/UserDataTable/cells/GroupsCell.vue@@ -17,7 +17,7 @@ import { NTag } from "naive-ui";import { computed } from "vue";import { useGroupStore } from "@/store";import { getUserEmailFromIdentifier } from "@/store/modules/v1/common";-import { type User } from "@/types/proto/v1/auth_service";+import { type User } from "@/types/proto/v1/user_service";import type { Group } from "@/types/proto/v1/group_service";const props = defineProps<{diff --git a/frontend/src/components/User/Settings/UserDataTable/cells/UserNameCell.vue b/frontend/src/components/User/Settings/UserDataTable/cells/UserNameCell.vueindex fd26a1d4f5..4207494dc2 100644--- a/frontend/src/components/User/Settings/UserDataTable/cells/UserNameCell.vue+++ b/frontend/src/components/User/Settings/UserDataTable/cells/UserNameCell.vue@@ -90,7 +90,7 @@ import {usePermissionStore,} from "@/store";import { SYSTEM_BOT_USER_NAME } from "@/types";-import { UserType, type User } from "@/types/proto/v1/auth_service";+import { UserType, type User } from "@/types/proto/v1/user_service";import { hasWorkspacePermissionV2, toClipboard } from "@/utils";defineProps<{diff --git a/frontend/src/components/User/Settings/UserDataTable/cells/UserOperationsCell.vue b/frontend/src/components/User/Settings/UserDataTable/cells/UserOperationsCell.vueindex 0fbd42d9e8..9c536bdd36 100644--- a/frontend/src/components/User/Settings/UserDataTable/cells/UserOperationsCell.vue+++ b/frontend/src/components/User/Settings/UserDataTable/cells/UserOperationsCell.vue@@ -56,7 +56,7 @@ import { NButton, NPopconfirm } from "naive-ui";import { computed } from "vue";import { useI18n } from "vue-i18n";import { useUserStore, pushNotification, useCurrentUserV1 } from "@/store";-import { type User, UserType } from "@/types/proto/v1/auth_service";+import { type User, UserType } from "@/types/proto/v1/user_service";import { State } from "@/types/proto/v1/common";import { hasWorkspacePermissionV2 } from "@/utils";diff --git a/frontend/src/components/User/Settings/UserDataTable/index.vue b/frontend/src/components/User/Settings/UserDataTable/index.vueindex 247a1224ae..0c10cc6df1 100644--- a/frontend/src/components/User/Settings/UserDataTable/index.vue+++ b/frontend/src/components/User/Settings/UserDataTable/index.vue@@ -28,7 +28,7 @@ import { computed, reactive, h } from "vue";import { useI18n } from "vue-i18n";import { BBAlert } from "@/bbkit";import { useAppFeature, useUserStore, useWorkspaceV1Store } from "@/store";-import { type User } from "@/types/proto/v1/auth_service";+import { type User } from "@/types/proto/v1/user_service";import type { Group } from "@/types/proto/v1/group_service";import { copyServiceKeyToClipboardIfNeeded } from "../common";import GroupsCell from "./cells/GroupsCell.vue";diff --git a/frontend/src/components/User/Settings/UserDataTableByGroup/cells/GroupMemberNameCell.vue b/frontend/src/components/User/Settings/UserDataTableByGroup/cells/GroupMemberNameCell.vueindex 092fc59d81..dd2fb0e38f 100644--- a/frontend/src/components/User/Settings/UserDataTableByGroup/cells/GroupMemberNameCell.vue+++ b/frontend/src/components/User/Settings/UserDataTableByGroup/cells/GroupMemberNameCell.vue@@ -62,7 +62,7 @@ import SystemBotTag from "@/components/misc/SystemBotTag.vue";import YouTag from "@/components/misc/YouTag.vue";import { useCurrentUserV1, usePermissionStore } from "@/store";import { SYSTEM_BOT_USER_NAME } from "@/types";-import { UserType, type User } from "@/types/proto/v1/auth_service";+import { UserType, type User } from "@/types/proto/v1/user_service";import {GroupMember_Role,} from "@/types/proto/v1/group_service";diff --git a/frontend/src/components/User/Settings/UserDataTableByGroup/index.vue b/frontend/src/components/User/Settings/UserDataTableByGroup/index.vueindex e153ad686f..eeef3c83f9 100644--- a/frontend/src/components/User/Settings/UserDataTableByGroup/index.vue+++ b/frontend/src/components/User/Settings/UserDataTableByGroup/index.vue@@ -18,7 +18,7 @@ import { computed, h } from "vue";import { useI18n } from "vue-i18n";import { useUserStore } from "@/store";import { getUserEmailFromIdentifier } from "@/store/modules/v1/common";-import { type User } from "@/types/proto/v1/auth_service";+import { type User } from "@/types/proto/v1/user_service";import { Group, GroupMember_Role } from "@/types/proto/v1/group_service";import GroupMemberNameCell from "./cells/GroupMemberNameCell.vue";import GroupNameCell from "./cells/GroupNameCell.vue";diff --git a/frontend/src/components/User/Settings/common.ts b/frontend/src/components/User/Settings/common.tsindex d81614b3f0..4b6953b5d9 100644--- a/frontend/src/components/User/Settings/common.ts+++ b/frontend/src/components/User/Settings/common.ts@@ -1,6 +1,6 @@import { t } from "@/plugins/i18n";import { pushNotification } from "@/store";-import { type User } from "@/types/proto/v1/auth_service";+import { type User } from "@/types/proto/v1/user_service";import { toClipboard } from "@/utils";export const copyServiceKeyToClipboardIfNeeded = (user: User) => {diff --git a/frontend/src/components/User/UserAvatar.vue b/frontend/src/components/User/UserAvatar.vueindex eca0d3f522..09cfa788ab 100644--- a/frontend/src/components/User/UserAvatar.vue+++ b/frontend/src/components/User/UserAvatar.vue@@ -14,7 +14,7 @@ import { computed } from "vue";import { BBAvatar } from "@/bbkit";import type { BBAvatarSizeType } from "@/bbkit/types";import { UNKNOWN_ID, unknownUser } from "@/types";-import { type User } from "@/types/proto/v1/auth_service";+import { type User } from "@/types/proto/v1/user_service";import type { VueClass } from "@/utils";const props = defineProps({diff --git a/frontend/src/components/v2/Select/UserSelect.vue b/frontend/src/components/v2/Select/UserSelect.vueindex 87816fd073..6fd23427b9 100644--- a/frontend/src/components/v2/Select/UserSelect.vue+++ b/frontend/src/components/v2/Select/UserSelect.vue@@ -38,7 +38,7 @@ import {isValidProjectName,PRESET_WORKSPACE_ROLES,} from "@/types";-import { UserType, type User } from "@/types/proto/v1/auth_service";+import { UserType, type User } from "@/types/proto/v1/user_service";import { State } from "@/types/proto/v1/common";import { extractUserUID } from "@/utils";diff --git a/frontend/src/grpcweb/index.ts b/frontend/src/grpcweb/index.tsindex 20bf2ef470..9836bc90d5 100644--- a/frontend/src/grpcweb/index.ts+++ b/frontend/src/grpcweb/index.ts@@ -9,6 +9,7 @@ import { ActuatorServiceDefinition } from "@/types/proto/v1/actuator_service";import { AnomalyServiceDefinition } from "@/types/proto/v1/anomaly_service";import { AuditLogServiceDefinition } from "@/types/proto/v1/audit_log_service";import { AuthServiceDefinition } from "@/types/proto/v1/auth_service";+import { UserServiceDefinition } from "@/types/proto/v1/user_service";import { CelServiceDefinition } from "@/types/proto/v1/cel_service";import { ChangelistServiceDefinition } from "@/types/proto/v1/changelist_service";import { DatabaseGroupServiceDefinition } from "@/types/proto/v1/database_group_service";@@ -78,6 +79,11 @@ export const authServiceClient = clientFactory.create(channel);+export const userServiceClient = clientFactory.create(+ UserServiceDefinition,+ channel+);+export const roleServiceClient = clientFactory.create(RoleServiceDefinition,channeldiff --git a/frontend/src/grpcweb/methods.ts b/frontend/src/grpcweb/methods.tsindex d938298152..d91d65ffdc 100644--- a/frontend/src/grpcweb/methods.ts+++ b/frontend/src/grpcweb/methods.ts@@ -23,6 +23,7 @@ import { SettingServiceDefinition } from "@/types/proto/v1/setting_service";import { SheetServiceDefinition } from "@/types/proto/v1/sheet_service";import { SQLServiceDefinition } from "@/types/proto/v1/sql_service";import { SubscriptionServiceDefinition } from "@/types/proto/v1/subscription_service";+import { UserServiceDefinition } from "@/types/proto/v1/user_service";import { VCSConnectorServiceDefinition } from "@/types/proto/v1/vcs_connector_service";import { VCSProviderServiceDefinition } from "@/types/proto/v1/vcs_provider_service";import { WorksheetServiceDefinition } from "@/types/proto/v1/worksheet_service";@@ -62,6 +63,7 @@ export const ALL_METHODS_WITH_AUDIT = [SheetServiceDefinition,SQLServiceDefinition,SubscriptionServiceDefinition,+ UserServiceDefinition,VCSConnectorServiceDefinition,VCSProviderServiceDefinition,WorksheetServiceDefinition,diff --git a/frontend/src/store/modules/auth.ts b/frontend/src/store/modules/auth.tsindex 85a6f35438..1c0ba86a47 100644--- a/frontend/src/store/modules/auth.ts+++ b/frontend/src/store/modules/auth.ts@@ -2,7 +2,7 @@ import { useLocalStorage } from "@vueuse/core";import axios from "axios";import { defineStore } from "pinia";import { computed, ref } from "vue";-import { authServiceClient } from "@/grpcweb";+import { userServiceClient } from "@/grpcweb";import { router } from "@/router";import {AUTH_SIGNIN_MODULE,@@ -12,9 +12,9 @@ import {import { SQL_EDITOR_HOME_MODULE } from "@/router/sqlEditor";import { useAppFeature, useUserStore, useSettingV1Store } from "@/store";import { unknownUser } from "@/types";-import type { LoginRequest, User } from "@/types/proto/v1/auth_service";+import type { LoginRequest } from "@/types/proto/v1/auth_service";import { LoginResponse } from "@/types/proto/v1/auth_service";-import { UserType } from "@/types/proto/v1/auth_service";+import { User, UserType } from "@/types/proto/v1/user_service";import { DatabaseChangeMode } from "@/types/proto/v1/setting_service";import { getIntCookie } from "@/utils";@@ -114,7 +114,7 @@ export const useAuthStore = defineStore("auth_v1", () => {};const signup = async (request: Partial<User>) => {- await authServiceClient.createUser({+ await userServiceClient.createUser({user: {email: request.email,title: request.name,diff --git a/frontend/src/store/modules/user.ts b/frontend/src/store/modules/user.tsindex 468660786b..b498b1cef3 100644--- a/frontend/src/store/modules/user.ts+++ b/frontend/src/store/modules/user.ts@@ -1,10 +1,10 @@import { isEqual, isUndefined, orderBy } from "lodash-es";import { defineStore } from "pinia";import { computed, ref } from "vue";-import { authServiceClient } from "@/grpcweb";+import { userServiceClient } from "@/grpcweb";import { allUsersUser, SYSTEM_BOT_USER_NAME } from "@/types";-import type { UpdateUserRequest, User } from "@/types/proto/v1/auth_service";-import { UserType } from "@/types/proto/v1/auth_service";+import type { UpdateUserRequest, User } from "@/types/proto/v1/user_service";+import { UserType } from "@/types/proto/v1/user_service";import { State } from "@/types/proto/v1/common";import { userNamePrefix, getUserEmailFromIdentifier } from "./v1/common";import { usePermissionStore } from "./v1/permission";@@ -50,7 +50,7 @@ export const useUserStore = defineStore("user", () => {});const fetchUserList = async () => {- const { users } = await authServiceClient.listUsers({+ const { users } = await userServiceClient.listUsers({showDeleted: true,});const response: User[] = [];@@ -60,7 +60,7 @@ export const useUserStore = defineStore("user", () => {return response;};const fetchUser = async (name: string, silent = false) => {- const user = await authServiceClient.getUser(+ const user = await userServiceClient.getUser({name,},@@ -71,7 +71,7 @@ export const useUserStore = defineStore("user", () => {return setUser(user);};const createUser = async (user: User) => {- const createdUser = await authServiceClient.createUser({+ const createdUser = await userServiceClient.createUser({user,});return setUser(createdUser);@@ -82,7 +82,7 @@ export const useUserStore = defineStore("user", () => {if (!originData) {throw new Error(`user with name ${name} not found`);}- const user = await authServiceClient.updateUser(updateUserRequest);+ const user = await userServiceClient.updateUser(updateUserRequest);return setUser(user);};const getOrFetchUserByName = async (name: string, silent = false) => {@@ -111,14 +111,14 @@ export const useUserStore = defineStore("user", () => {);};const archiveUser = async (user: User) => {- await authServiceClient.deleteUser({+ await userServiceClient.deleteUser({name: user.name,});user.state = State.DELETED;return user;};const restoreUser = async (user: User) => {- const restoredUser = await authServiceClient.undeleteUser({+ const restoredUser = await userServiceClient.undeleteUser({name: user.name,});return setUser(restoredUser);diff --git a/frontend/src/store/modules/v1/issue.ts b/frontend/src/store/modules/v1/issue.tsindex 5276f6cd8d..a5526e8bde 100644--- a/frontend/src/store/modules/v1/issue.ts+++ b/frontend/src/store/modules/v1/issue.ts@@ -6,7 +6,7 @@ import { ref, watch } from "vue";import { issueServiceClient } from "@/grpcweb";import type { ComposedIssue, IssueFilter } from "@/types";import { isValidProjectName, PresetRoleType } from "@/types";-import { UserType } from "@/types/proto/v1/auth_service";+import { UserType } from "@/types/proto/v1/user_service";import { State } from "@/types/proto/v1/common";import type { ApprovalStep } from "@/types/proto/v1/issue_service";import {diff --git a/frontend/src/store/modules/v1/permission.ts b/frontend/src/store/modules/v1/permission.tsindex 987bfba5e2..06a98f0146 100644--- a/frontend/src/store/modules/v1/permission.ts+++ b/frontend/src/store/modules/v1/permission.ts@@ -7,7 +7,7 @@ import {type ComposedProject,type Permission,} from "@/types";-import { type User } from "@/types/proto/v1/auth_service";+import { type User } from "@/types/proto/v1/user_service";import { roleListInIAM } from "@/utils";import { useCurrentUserV1 } from "../auth";import { useRoleStore } from "../role";diff --git a/frontend/src/store/modules/v1/projectIamPolicy.ts b/frontend/src/store/modules/v1/projectIamPolicy.tsindex 3392d9abc4..ebb2ffa11b 100644--- a/frontend/src/store/modules/v1/projectIamPolicy.ts+++ b/frontend/src/store/modules/v1/projectIamPolicy.ts@@ -10,7 +10,7 @@ import {type QueryPermission,} from "@/types";import type { Expr } from "@/types/proto/google/api/expr/v1alpha1/syntax";-import type { User } from "@/types/proto/v1/auth_service";+import type { User } from "@/types/proto/v1/user_service";import { IamPolicy } from "@/types/proto/v1/iam_policy";import { getUserEmailListInBinding } from "@/utils";import { convertFromExpr } from "@/utils/issue/cel";diff --git a/frontend/src/types/proto/v1/auth_service.ts b/frontend/src/types/proto/v1/auth_service.tsindex 671edfe926..fa7d6eb3b0 100644--- a/frontend/src/types/proto/v1/auth_service.ts+++ b/frontend/src/types/proto/v1/auth_service.ts@@ -8,161 +8,10 @@import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";import Long from "long";import { Empty } from "../google/protobuf/empty";-import { FieldMask } from "../google/protobuf/field_mask";-import { Timestamp } from "../google/protobuf/timestamp";-import { State, stateFromJSON, stateToJSON, stateToNumber } from "./common";+import { User } from "./user_service";export const protobufPackage = "bytebase.v1";-export enum UserType {- USER_TYPE_UNSPECIFIED = "USER_TYPE_UNSPECIFIED",- USER = "USER",- SYSTEM_BOT = "SYSTEM_BOT",- SERVICE_ACCOUNT = "SERVICE_ACCOUNT",- UNRECOGNIZED = "UNRECOGNIZED",-}--export function userTypeFromJSON(object: any): UserType {- switch (object) {- case 0:- case "USER_TYPE_UNSPECIFIED":- return UserType.USER_TYPE_UNSPECIFIED;- case 1:- case "USER":- return UserType.USER;- case 2:- case "SYSTEM_BOT":- return UserType.SYSTEM_BOT;- case 3:- case "SERVICE_ACCOUNT":- return UserType.SERVICE_ACCOUNT;- case -1:- case "UNRECOGNIZED":- default:- return UserType.UNRECOGNIZED;- }-}--export function userTypeToJSON(object: UserType): string {- switch (object) {- case UserType.USER_TYPE_UNSPECIFIED:- return "USER_TYPE_UNSPECIFIED";- case UserType.USER:- return "USER";- case UserType.SYSTEM_BOT:- return "SYSTEM_BOT";- case UserType.SERVICE_ACCOUNT:- return "SERVICE_ACCOUNT";- case UserType.UNRECOGNIZED:- default:- return "UNRECOGNIZED";- }-}--export function userTypeToNumber(object: UserType): number {- switch (object) {- case UserType.USER_TYPE_UNSPECIFIED:- return 0;- case UserType.USER:- return 1;- case UserType.SYSTEM_BOT:- return 2;- case UserType.SERVICE_ACCOUNT:- return 3;- case UserType.UNRECOGNIZED:- default:- return -1;- }-}--export interface GetUserRequest {- /**- * The name of the user to retrieve.- * Format: users/{user uid or user email}- */- name: string;-}--export interface ListUsersRequest {- /**- * Not used.- * The maximum number of users to return. The service may return fewer than- * this value.- * If unspecified, at most 50 users will be returned.- * The maximum value is 1000; values above 1000 will be coerced to 1000.- */- pageSize: number;- /**- * Not used.- * A page token, received from a previous `ListUsers` call.- * Provide this to retrieve the subsequent page.- *- * When paginating, all other parameters provided to `ListUsers` must match- * the call that provided the page token.- */- pageToken: string;- /** Show deleted users if specified. */- showDeleted: boolean;-}--export interface ListUsersResponse {- /** The users from the specified request. */- users: User[];- /**- * A token, which can be sent as `page_token` to retrieve the next page.- * If this field is omitted, there are no subsequent pages.- */- nextPageToken: string;-}--export interface CreateUserRequest {- /** The user to create. */- user: User | undefined;-}--export interface UpdateUserRequest {- /**- * The user to update.- *- * The user's `name` field is used to identify the user to update.- * Format: users/{user}- */- user:- | User- | undefined;- /** The list of fields to update. */- updateMask:- | string[]- | undefined;- /** The otp_code is used to verify the user's identity by MFA. */- otpCode?:- | string- | undefined;- /**- * The regenerate_temp_mfa_secret flag means to regenerate temporary MFA secret for user.- * This is used for MFA setup. The temporary MFA secret and recovery codes will be returned in the response.- */- regenerateTempMfaSecret: boolean;- /** The regenerate_recovery_codes flag means to regenerate recovery codes for user. */- regenerateRecoveryCodes: boolean;-}--export interface DeleteUserRequest {- /**- * The name of the user to delete.- * Format: users/{user}- */- name: string;-}--export interface UndeleteUserRequest {- /**- * The name of the deleted user.- * Format: users/{user}- */- name: string;-}-export interface LoginRequest {email: string;password: string;@@ -212,57 +61,52 @@ 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;- userType: UserType;- password: string;- serviceKey: string;- /** The mfa_enabled flag means if the user has enabled MFA. */- mfaEnabled: boolean;- /** The mfa_secret is the temporary secret using in two phase verification. */- mfaSecret: string;- /** The recovery_codes is the temporary recovery codes using in two phase verification. */- recoveryCodes: string[];- /**- * Should be a valid E.164 compliant phone number.- * Could be empty.- */- phone: string;- profile: User_Profile | undefined;-}--export interface User_Profile {- lastLoginTime: Timestamp | undefined;- lastChangePasswordTime:- | Timestamp- | undefined;- /** source means where the user comes from. For now we support Entra ID SCIM sync, so the source could be Entra ID. */- source: string;-}--function createBaseGetUserRequest(): GetUserRequest {- return { name: "" };+function createBaseLoginRequest(): LoginRequest {+ return {+ email: "",+ password: "",+ web: false,+ idpName: "",+ idpContext: undefined,+ otpCode: undefined,+ recoveryCode: undefined,+ mfaTempToken: undefined,+ };}-export const GetUserRequest: MessageFns<GetUserRequest> = {- encode(message: GetUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {- if (message.name !== "") {- writer.uint32(10).string(message.name);+export const LoginRequest: MessageFns<LoginRequest> = {+ encode(message: LoginRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {+ if (message.email !== "") {+ writer.uint32(10).string(message.email);+ }+ if (message.password !== "") {+ writer.uint32(18).string(message.password);+ }+ if (message.web !== false) {+ writer.uint32(24).bool(message.web);+ }+ if (message.idpName !== "") {+ writer.uint32(34).string(message.idpName);+ }+ if (message.idpContext !== undefined) {+ IdentityProviderContext.encode(message.idpContext, writer.uint32(42).fork()).join();+ }+ if (message.otpCode !== undefined) {+ writer.uint32(50).string(message.otpCode);+ }+ if (message.recoveryCode !== undefined) {+ writer.uint32(58).string(message.recoveryCode);+ }+ if (message.mfaTempToken !== undefined) {+ writer.uint32(66).string(message.mfaTempToken);}return writer;},- decode(input: BinaryReader | Uint8Array, length?: number): GetUserRequest {+ decode(input: BinaryReader | Uint8Array, length?: number): LoginRequest {const reader = input instanceof BinaryReader ? input : new BinaryReader(input);let end = length === undefined ? reader.len : reader.pos + length;- const message = createBaseGetUserRequest();+ const message = createBaseLoginRequest();while (reader.pos < end) {const tag = reader.uint32();switch (tag >>> 3) {@@ -271,87 +115,63 @@ export const GetUserRequest: MessageFns<GetUserRequest> = {break;}- message.name = reader.string();+ message.email = reader.string();continue;}- }- if ((tag & 7) === 4 || tag === 0) {- break;- }- reader.skip(tag & 7);- }- return message;- },-- fromJSON(object: any): GetUserRequest {- return { name: isSet(object.name) ? globalThis.String(object.name) : "" };- },-- toJSON(message: GetUserRequest): unknown {- const obj: any = {};- if (message.name !== "") {- obj.name = message.name;- }- return obj;- },+ case 2: {+ if (tag !== 18) {+ break;+ }- create(base?: DeepPartial<GetUserRequest>): GetUserRequest {- return GetUserRequest.fromPartial(base ?? {});- },- fromPartial(object: DeepPartial<GetUserRequest>): GetUserRequest {- const message = createBaseGetUserRequest();- message.name = object.name ?? "";- return message;- },-};+ message.password = reader.string();+ continue;+ }+ case 3: {+ if (tag !== 24) {+ break;+ }-function createBaseListUsersRequest(): ListUsersRequest {- return { pageSize: 0, pageToken: "", showDeleted: false };-}+ message.web = reader.bool();+ continue;+ }+ case 4: {+ if (tag !== 34) {+ break;+ }-export const ListUsersRequest: MessageFns<ListUsersRequest> = {- encode(message: ListUsersRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {- if (message.pageSize !== 0) {- writer.uint32(8).int32(message.pageSize);- }- if (message.pageToken !== "") {- writer.uint32(18).string(message.pageToken);- }- if (message.showDeleted !== false) {- writer.uint32(24).bool(message.showDeleted);- }- return writer;- },+ message.idpName = reader.string();+ continue;+ }+ case 5: {+ if (tag !== 42) {+ break;+ }- decode(input: BinaryReader | Uint8Array, length?: number): ListUsersRequest {- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);- let end = length === undefined ? reader.len : reader.pos + length;- const message = createBaseListUsersRequest();- while (reader.pos < end) {- const tag = reader.uint32();- switch (tag >>> 3) {- case 1: {- if (tag !== 8) {+ message.idpContext = IdentityProviderContext.decode(reader, reader.uint32());+ continue;+ }+ case 6: {+ if (tag !== 50) {break;}- message.pageSize = reader.int32();+ message.otpCode = reader.string();continue;}- case 2: {- if (tag !== 18) {+ case 7: {+ if (tag !== 58) {break;}- message.pageToken = reader.string();+ message.recoveryCode = reader.string();continue;}- case 3: {- if (tag !== 24) {+ case 8: {+ if (tag !== 66) {break;}- message.showDeleted = reader.bool();+ message.mfaTempToken = reader.string();continue;}}@@ -363,59 +183,86 @@ export const ListUsersRequest: MessageFns<ListUsersRequest> = {return message;},- fromJSON(object: any): ListUsersRequest {+ fromJSON(object: any): LoginRequest {return {- pageSize: isSet(object.pageSize) ? globalThis.Number(object.pageSize) : 0,- pageToken: isSet(object.pageToken) ? globalThis.String(object.pageToken) : "",- showDeleted: isSet(object.showDeleted) ? globalThis.Boolean(object.showDeleted) : false,+ email: isSet(object.email) ? globalThis.String(object.email) : "",+ password: isSet(object.password) ? globalThis.String(object.password) : "",+ web: isSet(object.web) ? globalThis.Boolean(object.web) : false,+ idpName: isSet(object.idpName) ? globalThis.String(object.idpName) : "",+ idpContext: isSet(object.idpContext) ? IdentityProviderContext.fromJSON(object.idpContext) : undefined,+ otpCode: isSet(object.otpCode) ? globalThis.String(object.otpCode) : undefined,+ recoveryCode: isSet(object.recoveryCode) ? globalThis.String(object.recoveryCode) : undefined,+ mfaTempToken: isSet(object.mfaTempToken) ? globalThis.String(object.mfaTempToken) : undefined,};},- toJSON(message: ListUsersRequest): unknown {+ toJSON(message: LoginRequest): unknown {const obj: any = {};- if (message.pageSize !== 0) {- obj.pageSize = Math.round(message.pageSize);+ if (message.email !== "") {+ obj.email = message.email;+ }+ if (message.password !== "") {+ obj.password = message.password;+ }+ if (message.web !== false) {+ obj.web = message.web;+ }+ if (message.idpName !== "") {+ obj.idpName = message.idpName;+ }+ if (message.idpContext !== undefined) {+ obj.idpContext = IdentityProviderContext.toJSON(message.idpContext);+ }+ if (message.otpCode !== undefined) {+ obj.otpCode = message.otpCode;}- if (message.pageToken !== "") {- obj.pageToken = message.pageToken;+ if (message.recoveryCode !== undefined) {+ obj.recoveryCode = message.recoveryCode;}- if (message.showDeleted !== false) {- obj.showDeleted = message.showDeleted;+ if (message.mfaTempToken !== undefined) {+ obj.mfaTempToken = message.mfaTempToken;}return obj;},- create(base?: DeepPartial<ListUsersRequest>): ListUsersRequest {- return ListUsersRequest.fromPartial(base ?? {});+ create(base?: DeepPartial<LoginRequest>): LoginRequest {+ return LoginRequest.fromPartial(base ?? {});},- fromPartial(object: DeepPartial<ListUsersRequest>): ListUsersRequest {- const message = createBaseListUsersRequest();- message.pageSize = object.pageSize ?? 0;- message.pageToken = object.pageToken ?? "";- message.showDeleted = object.showDeleted ?? false;+ fromPartial(object: DeepPartial<LoginRequest>): LoginRequest {+ const message = createBaseLoginRequest();+ message.email = object.email ?? "";+ message.password = object.password ?? "";+ message.web = object.web ?? false;+ message.idpName = object.idpName ?? "";+ message.idpContext = (object.idpContext !== undefined && object.idpContext !== null)+ ? IdentityProviderContext.fromPartial(object.idpContext)+ : undefined;+ message.otpCode = object.otpCode ?? undefined;+ message.recoveryCode = object.recoveryCode ?? undefined;+ message.mfaTempToken = object.mfaTempToken ?? undefined;return message;},};-function createBaseListUsersResponse(): ListUsersResponse {- return { users: [], nextPageToken: "" };+function createBaseIdentityProviderContext(): IdentityProviderContext {+ return { oauth2Context: undefined, oidcContext: undefined };}-export const ListUsersResponse: MessageFns<ListUsersResponse> = {- encode(message: ListUsersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {- for (const v of message.users) {- User.encode(v!, writer.uint32(10).fork()).join();+export const IdentityProviderContext: MessageFns<IdentityProviderContext> = {+ encode(message: IdentityProviderContext, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {+ if (message.oauth2Context !== undefined) {+ OAuth2IdentityProviderContext.encode(message.oauth2Context, writer.uint32(10).fork()).join();}- if (message.nextPageToken !== "") {- writer.uint32(18).string(message.nextPageToken);+ if (message.oidcContext !== undefined) {+ OIDCIdentityProviderContext.encode(message.oidcContext, writer.uint32(18).fork()).join();}return writer;},- decode(input: BinaryReader | Uint8Array, length?: number): ListUsersResponse {+ decode(input: BinaryReader | Uint8Array, length?: number): IdentityProviderContext {const reader = input instanceof BinaryReader ? input : new BinaryReader(input);let end = length === undefined ? reader.len : reader.pos + length;- const message = createBaseListUsersResponse();+ const message = createBaseIdentityProviderContext();while (reader.pos < end) {const tag = reader.uint32();switch (tag >>> 3) {@@ -424,7 +271,7 @@ export const ListUsersResponse: MessageFns<ListUsersResponse> = {break;}- message.users.push(User.decode(reader, reader.uint32()));+ message.oauth2Context = OAuth2IdentityProviderContext.decode(reader, reader.uint32());continue;}case 2: {@@ -432,7 +279,7 @@ export const ListUsersResponse: MessageFns<ListUsersResponse> = {break;}- message.nextPageToken = reader.string();+ message.oidcContext = OIDCIdentityProviderContext.decode(reader, reader.uint32());continue;}}@@ -444,51 +291,57 @@ export const ListUsersResponse: MessageFns<ListUsersResponse> = {return message;},- fromJSON(object: any): ListUsersResponse {+ fromJSON(object: any): IdentityProviderContext {return {- users: globalThis.Array.isArray(object?.users) ? object.users.map((e: any) => User.fromJSON(e)) : [],- nextPageToken: isSet(object.nextPageToken) ? globalThis.String(object.nextPageToken) : "",+ oauth2Context: isSet(object.oauth2Context)+ ? OAuth2IdentityProviderContext.fromJSON(object.oauth2Context)+ : undefined,+ oidcContext: isSet(object.oidcContext) ? OIDCIdentityProviderContext.fromJSON(object.oidcContext) : undefined,};},- toJSON(message: ListUsersResponse): unknown {+ toJSON(message: IdentityProviderContext): unknown {const obj: any = {};- if (message.users?.length) {- obj.users = message.users.map((e) => User.toJSON(e));+ if (message.oauth2Context !== undefined) {+ obj.oauth2Context = OAuth2IdentityProviderContext.toJSON(message.oauth2Context);}- if (message.nextPageToken !== "") {- obj.nextPageToken = message.nextPageToken;+ if (message.oidcContext !== undefined) {+ obj.oidcContext = OIDCIdentityProviderContext.toJSON(message.oidcContext);}return obj;},- create(base?: DeepPartial<ListUsersResponse>): ListUsersResponse {- return ListUsersResponse.fromPartial(base ?? {});+ create(base?: DeepPartial<IdentityProviderContext>): IdentityProviderContext {+ return IdentityProviderContext.fromPartial(base ?? {});},- fromPartial(object: DeepPartial<ListUsersResponse>): ListUsersResponse {- const message = createBaseListUsersResponse();- message.users = object.users?.map((e) => User.fromPartial(e)) || [];- message.nextPageToken = object.nextPageToken ?? "";+ fromPartial(object: DeepPartial<IdentityProviderContext>): IdentityProviderContext {+ const message = createBaseIdentityProviderContext();+ message.oauth2Context = (object.oauth2Context !== undefined && object.oauth2Context !== null)+ ? OAuth2IdentityProviderContext.fromPartial(object.oauth2Context)+ : undefined;+ message.oidcContext = (object.oidcContext !== undefined && object.oidcContext !== null)+ ? OIDCIdentityProviderContext.fromPartial(object.oidcContext)+ : undefined;return message;},};-function createBaseCreateUserRequest(): CreateUserRequest {- return { user: undefined };+function createBaseOAuth2IdentityProviderContext(): OAuth2IdentityProviderContext {+ return { code: "" };}-export const CreateUserRequest: MessageFns<CreateUserRequest> = {- encode(message: CreateUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {- if (message.user !== undefined) {- User.encode(message.user, writer.uint32(10).fork()).join();+export const OAuth2IdentityProviderContext: MessageFns<OAuth2IdentityProviderContext> = {+ encode(message: OAuth2IdentityProviderContext, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {+ if (message.code !== "") {+ writer.uint32(10).string(message.code);}return writer;},- decode(input: BinaryReader | Uint8Array, length?: number): CreateUserRequest {+ decode(input: BinaryReader | Uint8Array, length?: number): OAuth2IdentityProviderContext {const reader = input instanceof BinaryReader ? input : new BinaryReader(input);let end = length === undefined ? reader.len : reader.pos + length;- const message = createBaseCreateUserRequest();+ const message = createBaseOAuth2IdentityProviderContext();while (reader.pos < end) {const tag = reader.uint32();switch (tag >>> 3) {@@ -497,580 +350,7 @@ export const CreateUserRequest: MessageFns<CreateUserRequest> = {break;}- message.user = User.decode(reader, reader.uint32());- continue;- }- }- if ((tag & 7) === 4 || tag === 0) {- break;- }- reader.skip(tag & 7);- }- return message;- },-- fromJSON(object: any): CreateUserRequest {- return { user: isSet(object.user) ? User.fromJSON(object.user) : undefined };- },-- toJSON(message: CreateUserRequest): unknown {- const obj: any = {};- if (message.user !== undefined) {- obj.user = User.toJSON(message.user);- }- return obj;- },-- create(base?: DeepPartial<CreateUserRequest>): CreateUserRequest {- return CreateUserRequest.fromPartial(base ?? {});- },- fromPartial(object: DeepPartial<CreateUserRequest>): CreateUserRequest {- const message = createBaseCreateUserRequest();- message.user = (object.user !== undefined && object.user !== null) ? User.fromPartial(object.user) : undefined;- return message;- },-};--function createBaseUpdateUserRequest(): UpdateUserRequest {- return {- user: undefined,- updateMask: undefined,- otpCode: undefined,- regenerateTempMfaSecret: false,- regenerateRecoveryCodes: false,- };-}--export const UpdateUserRequest: MessageFns<UpdateUserRequest> = {- encode(message: UpdateUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {- if (message.user !== undefined) {- User.encode(message.user, writer.uint32(10).fork()).join();- }- if (message.updateMask !== undefined) {- FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join();- }- if (message.otpCode !== undefined) {- writer.uint32(26).string(message.otpCode);- }- if (message.regenerateTempMfaSecret !== false) {- writer.uint32(32).bool(message.regenerateTempMfaSecret);- }- if (message.regenerateRecoveryCodes !== false) {- writer.uint32(40).bool(message.regenerateRecoveryCodes);- }- return writer;- },-- decode(input: BinaryReader | Uint8Array, length?: number): UpdateUserRequest {- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);- let end = length === undefined ? reader.len : reader.pos + length;- const message = createBaseUpdateUserRequest();- while (reader.pos < end) {- const tag = reader.uint32();- switch (tag >>> 3) {- case 1: {- if (tag !== 10) {- break;- }-- message.user = User.decode(reader, reader.uint32());- continue;- }- case 2: {- if (tag !== 18) {- break;- }-- message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32()));- continue;- }- case 3: {- if (tag !== 26) {- break;- }-- message.otpCode = reader.string();- continue;- }- case 4: {- if (tag !== 32) {- break;- }-- message.regenerateTempMfaSecret = reader.bool();- continue;- }- case 5: {- if (tag !== 40) {- break;- }-- message.regenerateRecoveryCodes = reader.bool();- continue;- }- }- if ((tag & 7) === 4 || tag === 0) {- break;- }- reader.skip(tag & 7);- }- return message;- },-- fromJSON(object: any): UpdateUserRequest {- return {- user: isSet(object.user) ? User.fromJSON(object.user) : undefined,- updateMask: isSet(object.updateMask) ? FieldMask.unwrap(FieldMask.fromJSON(object.updateMask)) : undefined,- otpCode: isSet(object.otpCode) ? globalThis.String(object.otpCode) : undefined,- regenerateTempMfaSecret: isSet(object.regenerateTempMfaSecret)- ? globalThis.Boolean(object.regenerateTempMfaSecret)- : false,- regenerateRecoveryCodes: isSet(object.regenerateRecoveryCodes)- ? globalThis.Boolean(object.regenerateRecoveryCodes)- : false,- };- },-- toJSON(message: UpdateUserRequest): unknown {- const obj: any = {};- if (message.user !== undefined) {- obj.user = User.toJSON(message.user);- }- if (message.updateMask !== undefined) {- obj.updateMask = FieldMask.toJSON(FieldMask.wrap(message.updateMask));- }- if (message.otpCode !== undefined) {- obj.otpCode = message.otpCode;- }- if (message.regenerateTempMfaSecret !== false) {- obj.regenerateTempMfaSecret = message.regenerateTempMfaSecret;- }- if (message.regenerateRecoveryCodes !== false) {- obj.regenerateRecoveryCodes = message.regenerateRecoveryCodes;- }- return obj;- },-- create(base?: DeepPartial<UpdateUserRequest>): UpdateUserRequest {- return UpdateUserRequest.fromPartial(base ?? {});- },- fromPartial(object: DeepPartial<UpdateUserRequest>): UpdateUserRequest {- const message = createBaseUpdateUserRequest();- message.user = (object.user !== undefined && object.user !== null) ? User.fromPartial(object.user) : undefined;- message.updateMask = object.updateMask ?? undefined;- message.otpCode = object.otpCode ?? undefined;- message.regenerateTempMfaSecret = object.regenerateTempMfaSecret ?? false;- message.regenerateRecoveryCodes = object.regenerateRecoveryCodes ?? false;- return message;- },-};--function createBaseDeleteUserRequest(): DeleteUserRequest {- return { name: "" };-}--export const DeleteUserRequest: MessageFns<DeleteUserRequest> = {- encode(message: DeleteUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {- if (message.name !== "") {- writer.uint32(10).string(message.name);- }- return writer;- },-- decode(input: BinaryReader | Uint8Array, length?: number): DeleteUserRequest {- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);- let end = length === undefined ? reader.len : reader.pos + length;- const message = createBaseDeleteUserRequest();- while (reader.pos < end) {- const tag = reader.uint32();- switch (tag >>> 3) {- case 1: {- if (tag !== 10) {- break;- }-- message.name = reader.string();- continue;- }- }- if ((tag & 7) === 4 || tag === 0) {- break;- }- reader.skip(tag & 7);- }- return message;- },-- fromJSON(object: any): DeleteUserRequest {- return { name: isSet(object.name) ? globalThis.String(object.name) : "" };- },-- toJSON(message: DeleteUserRequest): unknown {- const obj: any = {};- if (message.name !== "") {- obj.name = message.name;- }- return obj;- },-- create(base?: DeepPartial<DeleteUserRequest>): DeleteUserRequest {- return DeleteUserRequest.fromPartial(base ?? {});- },- fromPartial(object: DeepPartial<DeleteUserRequest>): DeleteUserRequest {- const message = createBaseDeleteUserRequest();- message.name = object.name ?? "";- return message;- },-};--function createBaseUndeleteUserRequest(): UndeleteUserRequest {- return { name: "" };-}--export const UndeleteUserRequest: MessageFns<UndeleteUserRequest> = {- encode(message: UndeleteUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {- if (message.name !== "") {- writer.uint32(10).string(message.name);- }- return writer;- },-- decode(input: BinaryReader | Uint8Array, length?: number): UndeleteUserRequest {- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);- let end = length === undefined ? reader.len : reader.pos + length;- const message = createBaseUndeleteUserRequest();- while (reader.pos < end) {- const tag = reader.uint32();- switch (tag >>> 3) {- case 1: {- if (tag !== 10) {- break;- }-- message.name = reader.string();- continue;- }- }- if ((tag & 7) === 4 || tag === 0) {- break;- }- reader.skip(tag & 7);- }- return message;- },-- fromJSON(object: any): UndeleteUserRequest {- return { name: isSet(object.name) ? globalThis.String(object.name) : "" };- },-- toJSON(message: UndeleteUserRequest): unknown {- const obj: any = {};- if (message.name !== "") {- obj.name = message.name;- }- return obj;- },-- create(base?: DeepPartial<UndeleteUserRequest>): UndeleteUserRequest {- return UndeleteUserRequest.fromPartial(base ?? {});- },- fromPartial(object: DeepPartial<UndeleteUserRequest>): UndeleteUserRequest {- const message = createBaseUndeleteUserRequest();- message.name = object.name ?? "";- return message;- },-};--function createBaseLoginRequest(): LoginRequest {- return {- email: "",- password: "",- web: false,- idpName: "",- idpContext: undefined,- otpCode: undefined,- recoveryCode: undefined,- mfaTempToken: undefined,- };-}--export const LoginRequest: MessageFns<LoginRequest> = {- encode(message: LoginRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {- if (message.email !== "") {- writer.uint32(10).string(message.email);- }- if (message.password !== "") {- writer.uint32(18).string(message.password);- }- if (message.web !== false) {- writer.uint32(24).bool(message.web);- }- if (message.idpName !== "") {- writer.uint32(34).string(message.idpName);- }- if (message.idpContext !== undefined) {- IdentityProviderContext.encode(message.idpContext, writer.uint32(42).fork()).join();- }- if (message.otpCode !== undefined) {- writer.uint32(50).string(message.otpCode);- }- if (message.recoveryCode !== undefined) {- writer.uint32(58).string(message.recoveryCode);- }- if (message.mfaTempToken !== undefined) {- writer.uint32(66).string(message.mfaTempToken);- }- return writer;- },-- decode(input: BinaryReader | Uint8Array, length?: number): LoginRequest {- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);- let end = length === undefined ? reader.len : reader.pos + length;- const message = createBaseLoginRequest();- while (reader.pos < end) {- const tag = reader.uint32();- switch (tag >>> 3) {- case 1: {- if (tag !== 10) {- break;- }-- message.email = reader.string();- continue;- }- case 2: {- if (tag !== 18) {- break;- }-- message.password = reader.string();- continue;- }- case 3: {- if (tag !== 24) {- break;- }-- message.web = reader.bool();- continue;- }- case 4: {- if (tag !== 34) {- break;- }-- message.idpName = reader.string();- continue;- }- case 5: {- if (tag !== 42) {- break;- }-- message.idpContext = IdentityProviderContext.decode(reader, reader.uint32());- continue;- }- case 6: {- if (tag !== 50) {- break;- }-- message.otpCode = reader.string();- continue;- }- case 7: {- if (tag !== 58) {- break;- }-- message.recoveryCode = reader.string();- continue;- }- case 8: {- if (tag !== 66) {- break;- }-- message.mfaTempToken = reader.string();- continue;- }- }- if ((tag & 7) === 4 || tag === 0) {- break;- }- reader.skip(tag & 7);- }- return message;- },-- fromJSON(object: any): LoginRequest {- return {- email: isSet(object.email) ? globalThis.String(object.email) : "",- password: isSet(object.password) ? globalThis.String(object.password) : "",- web: isSet(object.web) ? globalThis.Boolean(object.web) : false,- idpName: isSet(object.idpName) ? globalThis.String(object.idpName) : "",- idpContext: isSet(object.idpContext) ? IdentityProviderContext.fromJSON(object.idpContext) : undefined,- otpCode: isSet(object.otpCode) ? globalThis.String(object.otpCode) : undefined,- recoveryCode: isSet(object.recoveryCode) ? globalThis.String(object.recoveryCode) : undefined,- mfaTempToken: isSet(object.mfaTempToken) ? globalThis.String(object.mfaTempToken) : undefined,- };- },-- toJSON(message: LoginRequest): unknown {- const obj: any = {};- if (message.email !== "") {- obj.email = message.email;- }- if (message.password !== "") {- obj.password = message.password;- }- if (message.web !== false) {- obj.web = message.web;- }- if (message.idpName !== "") {- obj.idpName = message.idpName;- }- if (message.idpContext !== undefined) {- obj.idpContext = IdentityProviderContext.toJSON(message.idpContext);- }- if (message.otpCode !== undefined) {- obj.otpCode = message.otpCode;- }- if (message.recoveryCode !== undefined) {- obj.recoveryCode = message.recoveryCode;- }- if (message.mfaTempToken !== undefined) {- obj.mfaTempToken = message.mfaTempToken;- }- return obj;- },-- create(base?: DeepPartial<LoginRequest>): LoginRequest {- return LoginRequest.fromPartial(base ?? {});- },- fromPartial(object: DeepPartial<LoginRequest>): LoginRequest {- const message = createBaseLoginRequest();- message.email = object.email ?? "";- message.password = object.password ?? "";- message.web = object.web ?? false;- message.idpName = object.idpName ?? "";- message.idpContext = (object.idpContext !== undefined && object.idpContext !== null)- ? IdentityProviderContext.fromPartial(object.idpContext)- : undefined;- message.otpCode = object.otpCode ?? undefined;- message.recoveryCode = object.recoveryCode ?? undefined;- message.mfaTempToken = object.mfaTempToken ?? undefined;- return message;- },-};--function createBaseIdentityProviderContext(): IdentityProviderContext {- return { oauth2Context: undefined, oidcContext: undefined };-}--export const IdentityProviderContext: MessageFns<IdentityProviderContext> = {- encode(message: IdentityProviderContext, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {- if (message.oauth2Context !== undefined) {- OAuth2IdentityProviderContext.encode(message.oauth2Context, writer.uint32(10).fork()).join();- }- if (message.oidcContext !== undefined) {- OIDCIdentityProviderContext.encode(message.oidcContext, writer.uint32(18).fork()).join();- }- return writer;- },-- decode(input: BinaryReader | Uint8Array, length?: number): IdentityProviderContext {- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);- let end = length === undefined ? reader.len : reader.pos + length;- const message = createBaseIdentityProviderContext();- while (reader.pos < end) {- const tag = reader.uint32();- switch (tag >>> 3) {- case 1: {- if (tag !== 10) {- break;- }-- message.oauth2Context = OAuth2IdentityProviderContext.decode(reader, reader.uint32());- continue;- }- case 2: {- if (tag !== 18) {- break;- }-- message.oidcContext = OIDCIdentityProviderContext.decode(reader, reader.uint32());- continue;- }- }- if ((tag & 7) === 4 || tag === 0) {- break;- }- reader.skip(tag & 7);- }- return message;- },-- fromJSON(object: any): IdentityProviderContext {- return {- oauth2Context: isSet(object.oauth2Context)- ? OAuth2IdentityProviderContext.fromJSON(object.oauth2Context)- : undefined,- oidcContext: isSet(object.oidcContext) ? OIDCIdentityProviderContext.fromJSON(object.oidcContext) : undefined,- };- },-- toJSON(message: IdentityProviderContext): unknown {- const obj: any = {};- if (message.oauth2Context !== undefined) {- obj.oauth2Context = OAuth2IdentityProviderContext.toJSON(message.oauth2Context);- }- if (message.oidcContext !== undefined) {- obj.oidcContext = OIDCIdentityProviderContext.toJSON(message.oidcContext);- }- return obj;- },-- create(base?: DeepPartial<IdentityProviderContext>): IdentityProviderContext {- return IdentityProviderContext.fromPartial(base ?? {});- },- fromPartial(object: DeepPartial<IdentityProviderContext>): IdentityProviderContext {- const message = createBaseIdentityProviderContext();- message.oauth2Context = (object.oauth2Context !== undefined && object.oauth2Context !== null)- ? OAuth2IdentityProviderContext.fromPartial(object.oauth2Context)- : undefined;- message.oidcContext = (object.oidcContext !== undefined && object.oidcContext !== null)- ? OIDCIdentityProviderContext.fromPartial(object.oidcContext)- : undefined;- return message;- },-};--function createBaseOAuth2IdentityProviderContext(): OAuth2IdentityProviderContext {- return { code: "" };-}--export const OAuth2IdentityProviderContext: MessageFns<OAuth2IdentityProviderContext> = {- encode(message: OAuth2IdentityProviderContext, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {- if (message.code !== "") {- writer.uint32(10).string(message.code);- }- return writer;- },-- decode(input: BinaryReader | Uint8Array, length?: number): OAuth2IdentityProviderContext {- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);- let end = length === undefined ? reader.len : reader.pos + length;- const message = createBaseOAuth2IdentityProviderContext();- while (reader.pos < end) {- const tag = reader.uint32();- switch (tag >>> 3) {- case 1: {- if (tag !== 10) {- break;- }-- message.code = reader.string();+ message.code = reader.string();continue;}}@@ -1171,197 +451,7 @@ export const LoginResponse: MessageFns<LoginResponse> = {decode(input: BinaryReader | Uint8Array, length?: number): LoginResponse {const reader = input instanceof BinaryReader ? input : new BinaryReader(input);let end = length === undefined ? reader.len : reader.pos + length;- const message = createBaseLoginResponse();- while (reader.pos < end) {- const tag = reader.uint32();- switch (tag >>> 3) {- case 1: {- if (tag !== 10) {- break;- }-- message.token = reader.string();- continue;- }- case 2: {- if (tag !== 18) {- break;- }-- message.mfaTempToken = reader.string();- continue;- }- case 3: {- if (tag !== 24) {- break;- }-- message.requireResetPassword = reader.bool();- continue;- }- case 4: {- if (tag !== 34) {- break;- }-- message.user = User.decode(reader, reader.uint32());- continue;- }- }- if ((tag & 7) === 4 || tag === 0) {- break;- }- reader.skip(tag & 7);- }- return message;- },-- fromJSON(object: any): LoginResponse {- return {- token: isSet(object.token) ? globalThis.String(object.token) : "",- mfaTempToken: isSet(object.mfaTempToken) ? globalThis.String(object.mfaTempToken) : undefined,- requireResetPassword: isSet(object.requireResetPassword)- ? globalThis.Boolean(object.requireResetPassword)- : false,- user: isSet(object.user) ? User.fromJSON(object.user) : undefined,- };- },-- toJSON(message: LoginResponse): unknown {- const obj: any = {};- if (message.token !== "") {- obj.token = message.token;- }- if (message.mfaTempToken !== undefined) {- obj.mfaTempToken = message.mfaTempToken;- }- if (message.requireResetPassword !== false) {- obj.requireResetPassword = message.requireResetPassword;- }- if (message.user !== undefined) {- obj.user = User.toJSON(message.user);- }- return obj;- },-- create(base?: DeepPartial<LoginResponse>): LoginResponse {- return LoginResponse.fromPartial(base ?? {});- },- fromPartial(object: DeepPartial<LoginResponse>): LoginResponse {- const message = createBaseLoginResponse();- message.token = object.token ?? "";- message.mfaTempToken = object.mfaTempToken ?? undefined;- message.requireResetPassword = object.requireResetPassword ?? false;- message.user = (object.user !== undefined && object.user !== null) ? User.fromPartial(object.user) : undefined;- return message;- },-};--function createBaseLogoutRequest(): LogoutRequest {- return {};-}--export const LogoutRequest: MessageFns<LogoutRequest> = {- encode(_: LogoutRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {- return writer;- },-- decode(input: BinaryReader | Uint8Array, length?: number): LogoutRequest {- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);- let end = length === undefined ? reader.len : reader.pos + length;- const message = createBaseLogoutRequest();- while (reader.pos < end) {- const tag = reader.uint32();- switch (tag >>> 3) {- }- if ((tag & 7) === 4 || tag === 0) {- break;- }- reader.skip(tag & 7);- }- return message;- },-- fromJSON(_: any): LogoutRequest {- return {};- },-- toJSON(_: LogoutRequest): unknown {- const obj: any = {};- return obj;- },-- create(base?: DeepPartial<LogoutRequest>): LogoutRequest {- return LogoutRequest.fromPartial(base ?? {});- },- fromPartial(_: DeepPartial<LogoutRequest>): LogoutRequest {- const message = createBaseLogoutRequest();- return message;- },-};--function createBaseUser(): User {- return {- name: "",- state: State.STATE_UNSPECIFIED,- email: "",- title: "",- userType: UserType.USER_TYPE_UNSPECIFIED,- password: "",- serviceKey: "",- mfaEnabled: false,- mfaSecret: "",- recoveryCodes: [],- phone: "",- profile: undefined,- };-}--export const User: MessageFns<User> = {- encode(message: User, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {- if (message.name !== "") {- writer.uint32(10).string(message.name);- }- if (message.state !== State.STATE_UNSPECIFIED) {- writer.uint32(16).int32(stateToNumber(message.state));- }- if (message.email !== "") {- writer.uint32(26).string(message.email);- }- if (message.title !== "") {- writer.uint32(34).string(message.title);- }- if (message.userType !== UserType.USER_TYPE_UNSPECIFIED) {- writer.uint32(40).int32(userTypeToNumber(message.userType));- }- if (message.password !== "") {- writer.uint32(58).string(message.password);- }- if (message.serviceKey !== "") {- writer.uint32(66).string(message.serviceKey);- }- if (message.mfaEnabled !== false) {- writer.uint32(72).bool(message.mfaEnabled);- }- if (message.mfaSecret !== "") {- writer.uint32(82).string(message.mfaSecret);- }- for (const v of message.recoveryCodes) {- writer.uint32(90).string(v!);- }- if (message.phone !== "") {- writer.uint32(98).string(message.phone);- }- if (message.profile !== undefined) {- User_Profile.encode(message.profile, writer.uint32(106).fork()).join();- }- return writer;- },-- decode(input: BinaryReader | Uint8Array, length?: number): User {- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);- let end = length === undefined ? reader.len : reader.pos + length;- const message = createBaseUser();+ const message = createBaseLoginResponse();while (reader.pos < end) {const tag = reader.uint32();switch (tag >>> 3) {@@ -1370,23 +460,23 @@ export const User: MessageFns<User> = {break;}- message.name = reader.string();+ message.token = reader.string();continue;}case 2: {- if (tag !== 16) {+ if (tag !== 18) {break;}- message.state = stateFromJSON(reader.int32());+ message.mfaTempToken = reader.string();continue;}case 3: {- if (tag !== 26) {+ if (tag !== 24) {break;}- message.email = reader.string();+ message.requireResetPassword = reader.bool();continue;}case 4: {@@ -1394,71 +484,7 @@ export const User: MessageFns<User> = {break;}- message.title = reader.string();- continue;- }- case 5: {- if (tag !== 40) {- break;- }-- message.userType = userTypeFromJSON(reader.int32());- continue;- }- case 7: {- if (tag !== 58) {- break;- }-- message.password = reader.string();- continue;- }- case 8: {- if (tag !== 66) {- break;- }-- message.serviceKey = reader.string();- continue;- }- case 9: {- if (tag !== 72) {- break;- }-- message.mfaEnabled = reader.bool();- continue;- }- case 10: {- if (tag !== 82) {- break;- }-- message.mfaSecret = reader.string();- continue;- }- case 11: {- if (tag !== 90) {- break;- }-- message.recoveryCodes.push(reader.string());- continue;- }- case 12: {- if (tag !== 98) {- break;- }-- message.phone = reader.string();- continue;- }- case 13: {- if (tag !== 106) {- break;- }-- message.profile = User_Profile.decode(reader, reader.uint32());+ message.user = User.decode(reader, reader.uint32());continue;}}@@ -1470,138 +496,63 @@ export const User: MessageFns<User> = {return message;},- fromJSON(object: any): User {+ fromJSON(object: any): LoginResponse {return {- name: isSet(object.name) ? globalThis.String(object.name) : "",- state: isSet(object.state) ? stateFromJSON(object.state) : State.STATE_UNSPECIFIED,- email: isSet(object.email) ? globalThis.String(object.email) : "",- title: isSet(object.title) ? globalThis.String(object.title) : "",- userType: isSet(object.userType) ? userTypeFromJSON(object.userType) : UserType.USER_TYPE_UNSPECIFIED,- password: isSet(object.password) ? globalThis.String(object.password) : "",- serviceKey: isSet(object.serviceKey) ? globalThis.String(object.serviceKey) : "",- mfaEnabled: isSet(object.mfaEnabled) ? globalThis.Boolean(object.mfaEnabled) : false,- mfaSecret: isSet(object.mfaSecret) ? globalThis.String(object.mfaSecret) : "",- recoveryCodes: globalThis.Array.isArray(object?.recoveryCodes)- ? object.recoveryCodes.map((e: any) => globalThis.String(e))- : [],- phone: isSet(object.phone) ? globalThis.String(object.phone) : "",- profile: isSet(object.profile) ? User_Profile.fromJSON(object.profile) : undefined,+ token: isSet(object.token) ? globalThis.String(object.token) : "",+ mfaTempToken: isSet(object.mfaTempToken) ? globalThis.String(object.mfaTempToken) : undefined,+ requireResetPassword: isSet(object.requireResetPassword)+ ? globalThis.Boolean(object.requireResetPassword)+ : false,+ user: isSet(object.user) ? User.fromJSON(object.user) : undefined,};},- toJSON(message: User): unknown {+ toJSON(message: LoginResponse): unknown {const obj: any = {};- if (message.name !== "") {- obj.name = message.name;- }- if (message.state !== State.STATE_UNSPECIFIED) {- obj.state = stateToJSON(message.state);- }- if (message.email !== "") {- obj.email = message.email;- }- if (message.title !== "") {- obj.title = message.title;- }- if (message.userType !== UserType.USER_TYPE_UNSPECIFIED) {- obj.userType = userTypeToJSON(message.userType);- }- if (message.password !== "") {- obj.password = message.password;- }- if (message.serviceKey !== "") {- obj.serviceKey = message.serviceKey;- }- if (message.mfaEnabled !== false) {- obj.mfaEnabled = message.mfaEnabled;- }- if (message.mfaSecret !== "") {- obj.mfaSecret = message.mfaSecret;+ if (message.token !== "") {+ obj.token = message.token;}- if (message.recoveryCodes?.length) {- obj.recoveryCodes = message.recoveryCodes;+ if (message.mfaTempToken !== undefined) {+ obj.mfaTempToken = message.mfaTempToken;}- if (message.phone !== "") {- obj.phone = message.phone;+ if (message.requireResetPassword !== false) {+ obj.requireResetPassword = message.requireResetPassword;}- if (message.profile !== undefined) {- obj.profile = User_Profile.toJSON(message.profile);+ if (message.user !== undefined) {+ obj.user = User.toJSON(message.user);}return obj;},- create(base?: DeepPartial<User>): User {- return User.fromPartial(base ?? {});+ create(base?: DeepPartial<LoginResponse>): LoginResponse {+ return LoginResponse.fromPartial(base ?? {});},- fromPartial(object: DeepPartial<User>): User {- const message = createBaseUser();- message.name = object.name ?? "";- message.state = object.state ?? State.STATE_UNSPECIFIED;- message.email = object.email ?? "";- message.title = object.title ?? "";- message.userType = object.userType ?? UserType.USER_TYPE_UNSPECIFIED;- message.password = object.password ?? "";- message.serviceKey = object.serviceKey ?? "";- message.mfaEnabled = object.mfaEnabled ?? false;- message.mfaSecret = object.mfaSecret ?? "";- message.recoveryCodes = object.recoveryCodes?.map((e) => e) || [];- message.phone = object.phone ?? "";- message.profile = (object.profile !== undefined && object.profile !== null)- ? User_Profile.fromPartial(object.profile)- : undefined;+ fromPartial(object: DeepPartial<LoginResponse>): LoginResponse {+ const message = createBaseLoginResponse();+ message.token = object.token ?? "";+ message.mfaTempToken = object.mfaTempToken ?? undefined;+ message.requireResetPassword = object.requireResetPassword ?? false;+ message.user = (object.user !== undefined && object.user !== null) ? User.fromPartial(object.user) : undefined;return message;},};-function createBaseUser_Profile(): User_Profile {- return { lastLoginTime: undefined, lastChangePasswordTime: undefined, source: "" };+function createBaseLogoutRequest(): LogoutRequest {+ return {};}-export const User_Profile: MessageFns<User_Profile> = {- encode(message: User_Profile, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {- if (message.lastLoginTime !== undefined) {- Timestamp.encode(message.lastLoginTime, writer.uint32(10).fork()).join();- }- if (message.lastChangePasswordTime !== undefined) {- Timestamp.encode(message.lastChangePasswordTime, writer.uint32(18).fork()).join();- }- if (message.source !== "") {- writer.uint32(26).string(message.source);- }+export const LogoutRequest: MessageFns<LogoutRequest> = {+ encode(_: LogoutRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {return writer;},- decode(input: BinaryReader | Uint8Array, length?: number): User_Profile {+ decode(input: BinaryReader | Uint8Array, length?: number): LogoutRequest {const reader = input instanceof BinaryReader ? input : new BinaryReader(input);let end = length === undefined ? reader.len : reader.pos + length;- const message = createBaseUser_Profile();+ const message = createBaseLogoutRequest();while (reader.pos < end) {const tag = reader.uint32();switch (tag >>> 3) {- case 1: {- if (tag !== 10) {- break;- }-- message.lastLoginTime = Timestamp.decode(reader, reader.uint32());- continue;- }- case 2: {- if (tag !== 18) {- break;- }-- message.lastChangePasswordTime = Timestamp.decode(reader, reader.uint32());- continue;- }- case 3: {- if (tag !== 26) {- break;- }-- message.source = reader.string();- continue;- }}if ((tag & 7) === 4 || tag === 0) {break;@@ -1611,43 +562,20 @@ export const User_Profile: MessageFns<User_Profile> = {return message;},- fromJSON(object: any): User_Profile {- return {- lastLoginTime: isSet(object.lastLoginTime) ? fromJsonTimestamp(object.lastLoginTime) : undefined,- lastChangePasswordTime: isSet(object.lastChangePasswordTime)- ? fromJsonTimestamp(object.lastChangePasswordTime)- : undefined,- source: isSet(object.source) ? globalThis.String(object.source) : "",- };+ fromJSON(_: any): LogoutRequest {+ return {};},- toJSON(message: User_Profile): unknown {+ toJSON(_: LogoutRequest): unknown {const obj: any = {};- if (message.lastLoginTime !== undefined) {- obj.lastLoginTime = fromTimestamp(message.lastLoginTime).toISOString();- }- if (message.lastChangePasswordTime !== undefined) {- obj.lastChangePasswordTime = fromTimestamp(message.lastChangePasswordTime).toISOString();- }- if (message.source !== "") {- obj.source = message.source;- }return obj;},- create(base?: DeepPartial<User_Profile>): User_Profile {- return User_Profile.fromPartial(base ?? {});+ create(base?: DeepPartial<LogoutRequest>): LogoutRequest {+ return LogoutRequest.fromPartial(base ?? {});},- fromPartial(object: DeepPartial<User_Profile>): User_Profile {- const message = createBaseUser_Profile();- message.lastLoginTime = (object.lastLoginTime !== undefined && object.lastLoginTime !== null)- ? Timestamp.fromPartial(object.lastLoginTime)- : undefined;- message.lastChangePasswordTime =- (object.lastChangePasswordTime !== undefined && object.lastChangePasswordTime !== null)- ? Timestamp.fromPartial(object.lastChangePasswordTime)- : undefined;- message.source = object.source ?? "";+ fromPartial(_: DeepPartial<LogoutRequest>): LogoutRequest {+ const message = createBaseLogoutRequest();return message;},};@@ -1657,232 +585,6 @@ export const AuthServiceDefinition = {name: "AuthService",fullName: "bytebase.v1.AuthService",methods: {- /**- * Get the user.- * Any authenticated user can get the user.- */- getUser: {- name: "GetUser",- requestType: GetUserRequest,- requestStream: false,- responseType: User,- responseStream: false,- options: {- _unknownFields: {- 8410: [new Uint8Array([4, 110, 97, 109, 101])],- 800016: [new Uint8Array([2])],- 578365826: [- new Uint8Array([- 20,- 18,- 18,- 47,- 118,- 49,- 47,- 123,- 110,- 97,- 109,- 101,- 61,- 117,- 115,- 101,- 114,- 115,- 47,- 42,- 125,- ]),- ],- },- },- },- /**- * List all users.- * Any authenticated user can list users.- */- listUsers: {- name: "ListUsers",- requestType: ListUsersRequest,- requestStream: false,- responseType: ListUsersResponse,- responseStream: false,- options: {- _unknownFields: {- 8410: [new Uint8Array([6, 112, 97, 114, 101, 110, 116])],- 800016: [new Uint8Array([2])],- 578365826: [new Uint8Array([11, 18, 9, 47, 118, 49, 47, 117, 115, 101, 114, 115])],- },- },- },- /**- * Create a user.- * When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user.- * Otherwise, any unauthenticated user can create a user.- */- createUser: {- name: "CreateUser",- requestType: CreateUserRequest,- requestStream: false,- responseType: User,- responseStream: false,- options: {- _unknownFields: {- 8410: [new Uint8Array([4, 117, 115, 101, 114])],- 800000: [new Uint8Array([1])],- 800016: [new Uint8Array([2])],- 800024: [new Uint8Array([1])],- 578365826: [new Uint8Array([17, 58, 4, 117, 115, 101, 114, 34, 9, 47, 118, 49, 47, 117, 115, 101, 114, 115])],- },- },- },- /** Only the user itself and the user with bb.users.update permission on the workspace can update the user. */- updateUser: {- name: "UpdateUser",- requestType: UpdateUserRequest,- requestStream: false,- responseType: User,- responseStream: false,- options: {- _unknownFields: {- 8410: [new Uint8Array([16, 117, 115, 101, 114, 44, 117, 112, 100, 97, 116, 101, 95, 109, 97, 115, 107])],- 800016: [new Uint8Array([2])],- 800024: [new Uint8Array([1])],- 578365826: [- new Uint8Array([- 31,- 58,- 4,- 117,- 115,- 101,- 114,- 50,- 23,- 47,- 118,- 49,- 47,- 123,- 117,- 115,- 101,- 114,- 46,- 110,- 97,- 109,- 101,- 61,- 117,- 115,- 101,- 114,- 115,- 47,- 42,- 125,- ]),- ],- },- },- },- /**- * Only the user with bb.users.delete permission on the workspace can delete the user.- * The last remaining workspace admin cannot be deleted.- */- deleteUser: {- name: "DeleteUser",- requestType: DeleteUserRequest,- requestStream: false,- responseType: Empty,- responseStream: false,- options: {- _unknownFields: {- 8410: [new Uint8Array([4, 110, 97, 109, 101])],- 800016: [new Uint8Array([2])],- 800024: [new Uint8Array([1])],- 578365826: [- new Uint8Array([- 20,- 42,- 18,- 47,- 118,- 49,- 47,- 123,- 110,- 97,- 109,- 101,- 61,- 117,- 115,- 101,- 114,- 115,- 47,- 42,- 125,- ]),- ],- },- },- },- /** Only the user with bb.users.undelete permission on the workspace can undelete the user. */- undeleteUser: {- name: "UndeleteUser",- requestType: UndeleteUserRequest,- requestStream: false,- responseType: User,- responseStream: false,- options: {- _unknownFields: {- 800016: [new Uint8Array([2])],- 800024: [new Uint8Array([1])],- 578365826: [- new Uint8Array([- 32,- 58,- 1,- 42,- 34,- 27,- 47,- 118,- 49,- 47,- 123,- 110,- 97,- 109,- 101,- 61,- 117,- 115,- 101,- 114,- 115,- 47,- 42,- 125,- 58,- 117,- 110,- 100,- 101,- 108,- 101,- 116,- 101,- ]),- ],- },- },- },login: {name: "Login",requestType: LoginRequest,@@ -1948,32 +650,6 @@ 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(Math.trunc(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): Timestamp {- if (o instanceof globalThis.Date) {- return toTimestamp(o);- } else if (typeof o === "string") {- return toTimestamp(new globalThis.Date(o));- } else {- return Timestamp.fromJSON(o);- }-}--function numberToLong(number: number) {- return Long.fromNumber(number);-}-function isSet(value: any): boolean {return value !== null && value !== undefined;}diff --git a/frontend/src/types/proto/v1/user_service.ts b/frontend/src/types/proto/v1/user_service.tsnew file mode 100644index 0000000000..63b1861c03--- /dev/null+++ b/frontend/src/types/proto/v1/user_service.ts@@ -0,0 +1,1366 @@+// Code generated by protoc-gen-ts_proto. DO NOT EDIT.+// versions:+// protoc-gen-ts_proto v2.3.0+// protoc unknown+// source: v1/user_service.proto++/* eslint-disable */+import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";+import Long from "long";+import { Empty } from "../google/protobuf/empty";+import { FieldMask } from "../google/protobuf/field_mask";+import { Timestamp } from "../google/protobuf/timestamp";+import { State, stateFromJSON, stateToJSON, stateToNumber } from "./common";++export const protobufPackage = "bytebase.v1";++export enum UserType {+ USER_TYPE_UNSPECIFIED = "USER_TYPE_UNSPECIFIED",+ USER = "USER",+ SYSTEM_BOT = "SYSTEM_BOT",+ SERVICE_ACCOUNT = "SERVICE_ACCOUNT",+ UNRECOGNIZED = "UNRECOGNIZED",+}++export function userTypeFromJSON(object: any): UserType {+ switch (object) {+ case 0:+ case "USER_TYPE_UNSPECIFIED":+ return UserType.USER_TYPE_UNSPECIFIED;+ case 1:+ case "USER":+ return UserType.USER;+ case 2:+ case "SYSTEM_BOT":+ return UserType.SYSTEM_BOT;+ case 3:+ case "SERVICE_ACCOUNT":+ return UserType.SERVICE_ACCOUNT;+ case -1:+ case "UNRECOGNIZED":+ default:+ return UserType.UNRECOGNIZED;+ }+}++export function userTypeToJSON(object: UserType): string {+ switch (object) {+ case UserType.USER_TYPE_UNSPECIFIED:+ return "USER_TYPE_UNSPECIFIED";+ case UserType.USER:+ return "USER";+ case UserType.SYSTEM_BOT:+ return "SYSTEM_BOT";+ case UserType.SERVICE_ACCOUNT:+ return "SERVICE_ACCOUNT";+ case UserType.UNRECOGNIZED:+ default:+ return "UNRECOGNIZED";+ }+}++export function userTypeToNumber(object: UserType): number {+ switch (object) {+ case UserType.USER_TYPE_UNSPECIFIED:+ return 0;+ case UserType.USER:+ return 1;+ case UserType.SYSTEM_BOT:+ return 2;+ case UserType.SERVICE_ACCOUNT:+ return 3;+ case UserType.UNRECOGNIZED:+ default:+ return -1;+ }+}++export interface GetUserRequest {+ /**+ * The name of the user to retrieve.+ * Format: users/{user uid or user email}+ */+ name: string;+}++export interface ListUsersRequest {+ /**+ * Not used.+ * The maximum number of users to return. The service may return fewer than+ * this value.+ * If unspecified, at most 50 users will be returned.+ * The maximum value is 1000; values above 1000 will be coerced to 1000.+ */+ pageSize: number;+ /**+ * Not used.+ * A page token, received from a previous `ListUsers` call.+ * Provide this to retrieve the subsequent page.+ *+ * When paginating, all other parameters provided to `ListUsers` must match+ * the call that provided the page token.+ */+ pageToken: string;+ /** Show deleted users if specified. */+ showDeleted: boolean;+}++export interface ListUsersResponse {+ /** The users from the specified request. */+ users: User[];+ /**+ * A token, which can be sent as `page_token` to retrieve the next page.+ * If this field is omitted, there are no subsequent pages.+ */+ nextPageToken: string;+}++export interface CreateUserRequest {+ /** The user to create. */+ user: User | undefined;+}++export interface UpdateUserRequest {+ /**+ * The user to update.+ *+ * The user's `name` field is used to identify the user to update.+ * Format: users/{user}+ */+ user:+ | User+ | undefined;+ /** The list of fields to update. */+ updateMask:+ | string[]+ | undefined;+ /** The otp_code is used to verify the user's identity by MFA. */+ otpCode?:+ | string+ | undefined;+ /**+ * The regenerate_temp_mfa_secret flag means to regenerate temporary MFA secret for user.+ * This is used for MFA setup. The temporary MFA secret and recovery codes will be returned in the response.+ */+ regenerateTempMfaSecret: boolean;+ /** The regenerate_recovery_codes flag means to regenerate recovery codes for user. */+ regenerateRecoveryCodes: boolean;+}++export interface DeleteUserRequest {+ /**+ * The name of the user to delete.+ * Format: users/{user}+ */+ name: string;+}++export interface UndeleteUserRequest {+ /**+ * The name of the deleted user.+ * Format: users/{user}+ */+ name: string;+}++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;+ userType: UserType;+ password: string;+ serviceKey: string;+ /** The mfa_enabled flag means if the user has enabled MFA. */+ mfaEnabled: boolean;+ /** The mfa_secret is the temporary secret using in two phase verification. */+ mfaSecret: string;+ /** The recovery_codes is the temporary recovery codes using in two phase verification. */+ recoveryCodes: string[];+ /**+ * Should be a valid E.164 compliant phone number.+ * Could be empty.+ */+ phone: string;+ profile: User_Profile | undefined;+}++export interface User_Profile {+ lastLoginTime: Timestamp | undefined;+ lastChangePasswordTime:+ | Timestamp+ | undefined;+ /** source means where the user comes from. For now we support Entra ID SCIM sync, so the source could be Entra ID. */+ source: string;+}++function createBaseGetUserRequest(): GetUserRequest {+ return { name: "" };+}++export const GetUserRequest: MessageFns<GetUserRequest> = {+ encode(message: GetUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {+ if (message.name !== "") {+ writer.uint32(10).string(message.name);+ }+ return writer;+ },++ decode(input: BinaryReader | Uint8Array, length?: number): GetUserRequest {+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseGetUserRequest();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1: {+ if (tag !== 10) {+ break;+ }++ message.name = reader.string();+ continue;+ }+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skip(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): GetUserRequest {+ return { name: isSet(object.name) ? globalThis.String(object.name) : "" };+ },++ toJSON(message: GetUserRequest): unknown {+ const obj: any = {};+ if (message.name !== "") {+ obj.name = message.name;+ }+ return obj;+ },++ create(base?: DeepPartial<GetUserRequest>): GetUserRequest {+ return GetUserRequest.fromPartial(base ?? {});+ },+ fromPartial(object: DeepPartial<GetUserRequest>): GetUserRequest {+ const message = createBaseGetUserRequest();+ message.name = object.name ?? "";+ return message;+ },+};++function createBaseListUsersRequest(): ListUsersRequest {+ return { pageSize: 0, pageToken: "", showDeleted: false };+}++export const ListUsersRequest: MessageFns<ListUsersRequest> = {+ encode(message: ListUsersRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {+ if (message.pageSize !== 0) {+ writer.uint32(8).int32(message.pageSize);+ }+ if (message.pageToken !== "") {+ writer.uint32(18).string(message.pageToken);+ }+ if (message.showDeleted !== false) {+ writer.uint32(24).bool(message.showDeleted);+ }+ return writer;+ },++ decode(input: BinaryReader | Uint8Array, length?: number): ListUsersRequest {+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseListUsersRequest();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1: {+ if (tag !== 8) {+ break;+ }++ message.pageSize = reader.int32();+ continue;+ }+ case 2: {+ if (tag !== 18) {+ break;+ }++ message.pageToken = reader.string();+ continue;+ }+ case 3: {+ if (tag !== 24) {+ break;+ }++ message.showDeleted = reader.bool();+ continue;+ }+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skip(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): ListUsersRequest {+ return {+ pageSize: isSet(object.pageSize) ? globalThis.Number(object.pageSize) : 0,+ pageToken: isSet(object.pageToken) ? globalThis.String(object.pageToken) : "",+ showDeleted: isSet(object.showDeleted) ? globalThis.Boolean(object.showDeleted) : false,+ };+ },++ toJSON(message: ListUsersRequest): unknown {+ const obj: any = {};+ if (message.pageSize !== 0) {+ obj.pageSize = Math.round(message.pageSize);+ }+ if (message.pageToken !== "") {+ obj.pageToken = message.pageToken;+ }+ if (message.showDeleted !== false) {+ obj.showDeleted = message.showDeleted;+ }+ return obj;+ },++ create(base?: DeepPartial<ListUsersRequest>): ListUsersRequest {+ return ListUsersRequest.fromPartial(base ?? {});+ },+ fromPartial(object: DeepPartial<ListUsersRequest>): ListUsersRequest {+ const message = createBaseListUsersRequest();+ message.pageSize = object.pageSize ?? 0;+ message.pageToken = object.pageToken ?? "";+ message.showDeleted = object.showDeleted ?? false;+ return message;+ },+};++function createBaseListUsersResponse(): ListUsersResponse {+ return { users: [], nextPageToken: "" };+}++export const ListUsersResponse: MessageFns<ListUsersResponse> = {+ encode(message: ListUsersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {+ for (const v of message.users) {+ User.encode(v!, writer.uint32(10).fork()).join();+ }+ if (message.nextPageToken !== "") {+ writer.uint32(18).string(message.nextPageToken);+ }+ return writer;+ },++ decode(input: BinaryReader | Uint8Array, length?: number): ListUsersResponse {+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseListUsersResponse();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1: {+ if (tag !== 10) {+ break;+ }++ message.users.push(User.decode(reader, reader.uint32()));+ continue;+ }+ case 2: {+ if (tag !== 18) {+ break;+ }++ message.nextPageToken = reader.string();+ continue;+ }+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skip(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): ListUsersResponse {+ return {+ users: globalThis.Array.isArray(object?.users) ? object.users.map((e: any) => User.fromJSON(e)) : [],+ nextPageToken: isSet(object.nextPageToken) ? globalThis.String(object.nextPageToken) : "",+ };+ },++ toJSON(message: ListUsersResponse): unknown {+ const obj: any = {};+ if (message.users?.length) {+ obj.users = message.users.map((e) => User.toJSON(e));+ }+ if (message.nextPageToken !== "") {+ obj.nextPageToken = message.nextPageToken;+ }+ return obj;+ },++ create(base?: DeepPartial<ListUsersResponse>): ListUsersResponse {+ return ListUsersResponse.fromPartial(base ?? {});+ },+ fromPartial(object: DeepPartial<ListUsersResponse>): ListUsersResponse {+ const message = createBaseListUsersResponse();+ message.users = object.users?.map((e) => User.fromPartial(e)) || [];+ message.nextPageToken = object.nextPageToken ?? "";+ return message;+ },+};++function createBaseCreateUserRequest(): CreateUserRequest {+ return { user: undefined };+}++export const CreateUserRequest: MessageFns<CreateUserRequest> = {+ encode(message: CreateUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {+ if (message.user !== undefined) {+ User.encode(message.user, writer.uint32(10).fork()).join();+ }+ return writer;+ },++ decode(input: BinaryReader | Uint8Array, length?: number): CreateUserRequest {+ const reader = input instanceof BinaryReader ? input : new BinaryReader(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: {+ if (tag !== 10) {+ break;+ }++ message.user = User.decode(reader, reader.uint32());+ continue;+ }+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skip(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): CreateUserRequest {+ return { user: isSet(object.user) ? User.fromJSON(object.user) : undefined };+ },++ toJSON(message: CreateUserRequest): unknown {+ const obj: any = {};+ if (message.user !== undefined) {+ obj.user = User.toJSON(message.user);+ }+ return obj;+ },++ create(base?: DeepPartial<CreateUserRequest>): CreateUserRequest {+ return CreateUserRequest.fromPartial(base ?? {});+ },+ fromPartial(object: DeepPartial<CreateUserRequest>): CreateUserRequest {+ const message = createBaseCreateUserRequest();+ message.user = (object.user !== undefined && object.user !== null) ? User.fromPartial(object.user) : undefined;+ return message;+ },+};++function createBaseUpdateUserRequest(): UpdateUserRequest {+ return {+ user: undefined,+ updateMask: undefined,+ otpCode: undefined,+ regenerateTempMfaSecret: false,+ regenerateRecoveryCodes: false,+ };+}++export const UpdateUserRequest: MessageFns<UpdateUserRequest> = {+ encode(message: UpdateUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {+ if (message.user !== undefined) {+ User.encode(message.user, writer.uint32(10).fork()).join();+ }+ if (message.updateMask !== undefined) {+ FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join();+ }+ if (message.otpCode !== undefined) {+ writer.uint32(26).string(message.otpCode);+ }+ if (message.regenerateTempMfaSecret !== false) {+ writer.uint32(32).bool(message.regenerateTempMfaSecret);+ }+ if (message.regenerateRecoveryCodes !== false) {+ writer.uint32(40).bool(message.regenerateRecoveryCodes);+ }+ return writer;+ },++ decode(input: BinaryReader | Uint8Array, length?: number): UpdateUserRequest {+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseUpdateUserRequest();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1: {+ if (tag !== 10) {+ break;+ }++ message.user = User.decode(reader, reader.uint32());+ continue;+ }+ case 2: {+ if (tag !== 18) {+ break;+ }++ message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32()));+ continue;+ }+ case 3: {+ if (tag !== 26) {+ break;+ }++ message.otpCode = reader.string();+ continue;+ }+ case 4: {+ if (tag !== 32) {+ break;+ }++ message.regenerateTempMfaSecret = reader.bool();+ continue;+ }+ case 5: {+ if (tag !== 40) {+ break;+ }++ message.regenerateRecoveryCodes = reader.bool();+ continue;+ }+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skip(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): UpdateUserRequest {+ return {+ user: isSet(object.user) ? User.fromJSON(object.user) : undefined,+ updateMask: isSet(object.updateMask) ? FieldMask.unwrap(FieldMask.fromJSON(object.updateMask)) : undefined,+ otpCode: isSet(object.otpCode) ? globalThis.String(object.otpCode) : undefined,+ regenerateTempMfaSecret: isSet(object.regenerateTempMfaSecret)+ ? globalThis.Boolean(object.regenerateTempMfaSecret)+ : false,+ regenerateRecoveryCodes: isSet(object.regenerateRecoveryCodes)+ ? globalThis.Boolean(object.regenerateRecoveryCodes)+ : false,+ };+ },++ toJSON(message: UpdateUserRequest): unknown {+ const obj: any = {};+ if (message.user !== undefined) {+ obj.user = User.toJSON(message.user);+ }+ if (message.updateMask !== undefined) {+ obj.updateMask = FieldMask.toJSON(FieldMask.wrap(message.updateMask));+ }+ if (message.otpCode !== undefined) {+ obj.otpCode = message.otpCode;+ }+ if (message.regenerateTempMfaSecret !== false) {+ obj.regenerateTempMfaSecret = message.regenerateTempMfaSecret;+ }+ if (message.regenerateRecoveryCodes !== false) {+ obj.regenerateRecoveryCodes = message.regenerateRecoveryCodes;+ }+ return obj;+ },++ create(base?: DeepPartial<UpdateUserRequest>): UpdateUserRequest {+ return UpdateUserRequest.fromPartial(base ?? {});+ },+ fromPartial(object: DeepPartial<UpdateUserRequest>): UpdateUserRequest {+ const message = createBaseUpdateUserRequest();+ message.user = (object.user !== undefined && object.user !== null) ? User.fromPartial(object.user) : undefined;+ message.updateMask = object.updateMask ?? undefined;+ message.otpCode = object.otpCode ?? undefined;+ message.regenerateTempMfaSecret = object.regenerateTempMfaSecret ?? false;+ message.regenerateRecoveryCodes = object.regenerateRecoveryCodes ?? false;+ return message;+ },+};++function createBaseDeleteUserRequest(): DeleteUserRequest {+ return { name: "" };+}++export const DeleteUserRequest: MessageFns<DeleteUserRequest> = {+ encode(message: DeleteUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {+ if (message.name !== "") {+ writer.uint32(10).string(message.name);+ }+ return writer;+ },++ decode(input: BinaryReader | Uint8Array, length?: number): DeleteUserRequest {+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseDeleteUserRequest();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1: {+ if (tag !== 10) {+ break;+ }++ message.name = reader.string();+ continue;+ }+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skip(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): DeleteUserRequest {+ return { name: isSet(object.name) ? globalThis.String(object.name) : "" };+ },++ toJSON(message: DeleteUserRequest): unknown {+ const obj: any = {};+ if (message.name !== "") {+ obj.name = message.name;+ }+ return obj;+ },++ create(base?: DeepPartial<DeleteUserRequest>): DeleteUserRequest {+ return DeleteUserRequest.fromPartial(base ?? {});+ },+ fromPartial(object: DeepPartial<DeleteUserRequest>): DeleteUserRequest {+ const message = createBaseDeleteUserRequest();+ message.name = object.name ?? "";+ return message;+ },+};++function createBaseUndeleteUserRequest(): UndeleteUserRequest {+ return { name: "" };+}++export const UndeleteUserRequest: MessageFns<UndeleteUserRequest> = {+ encode(message: UndeleteUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {+ if (message.name !== "") {+ writer.uint32(10).string(message.name);+ }+ return writer;+ },++ decode(input: BinaryReader | Uint8Array, length?: number): UndeleteUserRequest {+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseUndeleteUserRequest();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1: {+ if (tag !== 10) {+ break;+ }++ message.name = reader.string();+ continue;+ }+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skip(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): UndeleteUserRequest {+ return { name: isSet(object.name) ? globalThis.String(object.name) : "" };+ },++ toJSON(message: UndeleteUserRequest): unknown {+ const obj: any = {};+ if (message.name !== "") {+ obj.name = message.name;+ }+ return obj;+ },++ create(base?: DeepPartial<UndeleteUserRequest>): UndeleteUserRequest {+ return UndeleteUserRequest.fromPartial(base ?? {});+ },+ fromPartial(object: DeepPartial<UndeleteUserRequest>): UndeleteUserRequest {+ const message = createBaseUndeleteUserRequest();+ message.name = object.name ?? "";+ return message;+ },+};++function createBaseUser(): User {+ return {+ name: "",+ state: State.STATE_UNSPECIFIED,+ email: "",+ title: "",+ userType: UserType.USER_TYPE_UNSPECIFIED,+ password: "",+ serviceKey: "",+ mfaEnabled: false,+ mfaSecret: "",+ recoveryCodes: [],+ phone: "",+ profile: undefined,+ };+}++export const User: MessageFns<User> = {+ encode(message: User, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {+ if (message.name !== "") {+ writer.uint32(10).string(message.name);+ }+ if (message.state !== State.STATE_UNSPECIFIED) {+ writer.uint32(16).int32(stateToNumber(message.state));+ }+ if (message.email !== "") {+ writer.uint32(26).string(message.email);+ }+ if (message.title !== "") {+ writer.uint32(34).string(message.title);+ }+ if (message.userType !== UserType.USER_TYPE_UNSPECIFIED) {+ writer.uint32(40).int32(userTypeToNumber(message.userType));+ }+ if (message.password !== "") {+ writer.uint32(58).string(message.password);+ }+ if (message.serviceKey !== "") {+ writer.uint32(66).string(message.serviceKey);+ }+ if (message.mfaEnabled !== false) {+ writer.uint32(72).bool(message.mfaEnabled);+ }+ if (message.mfaSecret !== "") {+ writer.uint32(82).string(message.mfaSecret);+ }+ for (const v of message.recoveryCodes) {+ writer.uint32(90).string(v!);+ }+ if (message.phone !== "") {+ writer.uint32(98).string(message.phone);+ }+ if (message.profile !== undefined) {+ User_Profile.encode(message.profile, writer.uint32(106).fork()).join();+ }+ return writer;+ },++ decode(input: BinaryReader | Uint8Array, length?: number): User {+ const reader = input instanceof BinaryReader ? input : new BinaryReader(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: {+ if (tag !== 10) {+ break;+ }++ message.name = reader.string();+ continue;+ }+ case 2: {+ if (tag !== 16) {+ break;+ }++ message.state = stateFromJSON(reader.int32());+ continue;+ }+ case 3: {+ if (tag !== 26) {+ break;+ }++ message.email = reader.string();+ continue;+ }+ case 4: {+ if (tag !== 34) {+ break;+ }++ message.title = reader.string();+ continue;+ }+ case 5: {+ if (tag !== 40) {+ break;+ }++ message.userType = userTypeFromJSON(reader.int32());+ continue;+ }+ case 7: {+ if (tag !== 58) {+ break;+ }++ message.password = reader.string();+ continue;+ }+ case 8: {+ if (tag !== 66) {+ break;+ }++ message.serviceKey = reader.string();+ continue;+ }+ case 9: {+ if (tag !== 72) {+ break;+ }++ message.mfaEnabled = reader.bool();+ continue;+ }+ case 10: {+ if (tag !== 82) {+ break;+ }++ message.mfaSecret = reader.string();+ continue;+ }+ case 11: {+ if (tag !== 90) {+ break;+ }++ message.recoveryCodes.push(reader.string());+ continue;+ }+ case 12: {+ if (tag !== 98) {+ break;+ }++ message.phone = reader.string();+ continue;+ }+ case 13: {+ if (tag !== 106) {+ break;+ }++ message.profile = User_Profile.decode(reader, reader.uint32());+ continue;+ }+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skip(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): User {+ return {+ name: isSet(object.name) ? globalThis.String(object.name) : "",+ state: isSet(object.state) ? stateFromJSON(object.state) : State.STATE_UNSPECIFIED,+ email: isSet(object.email) ? globalThis.String(object.email) : "",+ title: isSet(object.title) ? globalThis.String(object.title) : "",+ userType: isSet(object.userType) ? userTypeFromJSON(object.userType) : UserType.USER_TYPE_UNSPECIFIED,+ password: isSet(object.password) ? globalThis.String(object.password) : "",+ serviceKey: isSet(object.serviceKey) ? globalThis.String(object.serviceKey) : "",+ mfaEnabled: isSet(object.mfaEnabled) ? globalThis.Boolean(object.mfaEnabled) : false,+ mfaSecret: isSet(object.mfaSecret) ? globalThis.String(object.mfaSecret) : "",+ recoveryCodes: globalThis.Array.isArray(object?.recoveryCodes)+ ? object.recoveryCodes.map((e: any) => globalThis.String(e))+ : [],+ phone: isSet(object.phone) ? globalThis.String(object.phone) : "",+ profile: isSet(object.profile) ? User_Profile.fromJSON(object.profile) : undefined,+ };+ },++ toJSON(message: User): unknown {+ const obj: any = {};+ if (message.name !== "") {+ obj.name = message.name;+ }+ if (message.state !== State.STATE_UNSPECIFIED) {+ obj.state = stateToJSON(message.state);+ }+ if (message.email !== "") {+ obj.email = message.email;+ }+ if (message.title !== "") {+ obj.title = message.title;+ }+ if (message.userType !== UserType.USER_TYPE_UNSPECIFIED) {+ obj.userType = userTypeToJSON(message.userType);+ }+ if (message.password !== "") {+ obj.password = message.password;+ }+ if (message.serviceKey !== "") {+ obj.serviceKey = message.serviceKey;+ }+ if (message.mfaEnabled !== false) {+ obj.mfaEnabled = message.mfaEnabled;+ }+ if (message.mfaSecret !== "") {+ obj.mfaSecret = message.mfaSecret;+ }+ if (message.recoveryCodes?.length) {+ obj.recoveryCodes = message.recoveryCodes;+ }+ if (message.phone !== "") {+ obj.phone = message.phone;+ }+ if (message.profile !== undefined) {+ obj.profile = User_Profile.toJSON(message.profile);+ }+ return obj;+ },++ create(base?: DeepPartial<User>): User {+ return User.fromPartial(base ?? {});+ },+ fromPartial(object: DeepPartial<User>): User {+ const message = createBaseUser();+ message.name = object.name ?? "";+ message.state = object.state ?? State.STATE_UNSPECIFIED;+ message.email = object.email ?? "";+ message.title = object.title ?? "";+ message.userType = object.userType ?? UserType.USER_TYPE_UNSPECIFIED;+ message.password = object.password ?? "";+ message.serviceKey = object.serviceKey ?? "";+ message.mfaEnabled = object.mfaEnabled ?? false;+ message.mfaSecret = object.mfaSecret ?? "";+ message.recoveryCodes = object.recoveryCodes?.map((e) => e) || [];+ message.phone = object.phone ?? "";+ message.profile = (object.profile !== undefined && object.profile !== null)+ ? User_Profile.fromPartial(object.profile)+ : undefined;+ return message;+ },+};++function createBaseUser_Profile(): User_Profile {+ return { lastLoginTime: undefined, lastChangePasswordTime: undefined, source: "" };+}++export const User_Profile: MessageFns<User_Profile> = {+ encode(message: User_Profile, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {+ if (message.lastLoginTime !== undefined) {+ Timestamp.encode(message.lastLoginTime, writer.uint32(10).fork()).join();+ }+ if (message.lastChangePasswordTime !== undefined) {+ Timestamp.encode(message.lastChangePasswordTime, writer.uint32(18).fork()).join();+ }+ if (message.source !== "") {+ writer.uint32(26).string(message.source);+ }+ return writer;+ },++ decode(input: BinaryReader | Uint8Array, length?: number): User_Profile {+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseUser_Profile();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1: {+ if (tag !== 10) {+ break;+ }++ message.lastLoginTime = Timestamp.decode(reader, reader.uint32());+ continue;+ }+ case 2: {+ if (tag !== 18) {+ break;+ }++ message.lastChangePasswordTime = Timestamp.decode(reader, reader.uint32());+ continue;+ }+ case 3: {+ if (tag !== 26) {+ break;+ }++ message.source = reader.string();+ continue;+ }+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skip(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): User_Profile {+ return {+ lastLoginTime: isSet(object.lastLoginTime) ? fromJsonTimestamp(object.lastLoginTime) : undefined,+ lastChangePasswordTime: isSet(object.lastChangePasswordTime)+ ? fromJsonTimestamp(object.lastChangePasswordTime)+ : undefined,+ source: isSet(object.source) ? globalThis.String(object.source) : "",+ };+ },++ toJSON(message: User_Profile): unknown {+ const obj: any = {};+ if (message.lastLoginTime !== undefined) {+ obj.lastLoginTime = fromTimestamp(message.lastLoginTime).toISOString();+ }+ if (message.lastChangePasswordTime !== undefined) {+ obj.lastChangePasswordTime = fromTimestamp(message.lastChangePasswordTime).toISOString();+ }+ if (message.source !== "") {+ obj.source = message.source;+ }+ return obj;+ },++ create(base?: DeepPartial<User_Profile>): User_Profile {+ return User_Profile.fromPartial(base ?? {});+ },+ fromPartial(object: DeepPartial<User_Profile>): User_Profile {+ const message = createBaseUser_Profile();+ message.lastLoginTime = (object.lastLoginTime !== undefined && object.lastLoginTime !== null)+ ? Timestamp.fromPartial(object.lastLoginTime)+ : undefined;+ message.lastChangePasswordTime =+ (object.lastChangePasswordTime !== undefined && object.lastChangePasswordTime !== null)+ ? Timestamp.fromPartial(object.lastChangePasswordTime)+ : undefined;+ message.source = object.source ?? "";+ return message;+ },+};++export type UserServiceDefinition = typeof UserServiceDefinition;+export const UserServiceDefinition = {+ name: "UserService",+ fullName: "bytebase.v1.UserService",+ methods: {+ /**+ * Get the user.+ * Any authenticated user can get the user.+ */+ getUser: {+ name: "GetUser",+ requestType: GetUserRequest,+ requestStream: false,+ responseType: User,+ responseStream: false,+ options: {+ _unknownFields: {+ 8410: [new Uint8Array([4, 110, 97, 109, 101])],+ 800016: [new Uint8Array([2])],+ 578365826: [+ new Uint8Array([+ 20,+ 18,+ 18,+ 47,+ 118,+ 49,+ 47,+ 123,+ 110,+ 97,+ 109,+ 101,+ 61,+ 117,+ 115,+ 101,+ 114,+ 115,+ 47,+ 42,+ 125,+ ]),+ ],+ },+ },+ },+ /**+ * List all users.+ * Any authenticated user can list users.+ */+ listUsers: {+ name: "ListUsers",+ requestType: ListUsersRequest,+ requestStream: false,+ responseType: ListUsersResponse,+ responseStream: false,+ options: {+ _unknownFields: {+ 8410: [new Uint8Array([6, 112, 97, 114, 101, 110, 116])],+ 800016: [new Uint8Array([2])],+ 578365826: [new Uint8Array([11, 18, 9, 47, 118, 49, 47, 117, 115, 101, 114, 115])],+ },+ },+ },+ /**+ * Create a user.+ * When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user.+ * Otherwise, any unauthenticated user can create a user.+ */+ createUser: {+ name: "CreateUser",+ requestType: CreateUserRequest,+ requestStream: false,+ responseType: User,+ responseStream: false,+ options: {+ _unknownFields: {+ 8410: [new Uint8Array([4, 117, 115, 101, 114])],+ 800000: [new Uint8Array([1])],+ 800016: [new Uint8Array([2])],+ 800024: [new Uint8Array([1])],+ 578365826: [new Uint8Array([17, 58, 4, 117, 115, 101, 114, 34, 9, 47, 118, 49, 47, 117, 115, 101, 114, 115])],+ },+ },+ },+ /** Only the user itself and the user with bb.users.update permission on the workspace can update the user. */+ updateUser: {+ name: "UpdateUser",+ requestType: UpdateUserRequest,+ requestStream: false,+ responseType: User,+ responseStream: false,+ options: {+ _unknownFields: {+ 8410: [new Uint8Array([16, 117, 115, 101, 114, 44, 117, 112, 100, 97, 116, 101, 95, 109, 97, 115, 107])],+ 800016: [new Uint8Array([2])],+ 800024: [new Uint8Array([1])],+ 578365826: [+ new Uint8Array([+ 31,+ 58,+ 4,+ 117,+ 115,+ 101,+ 114,+ 50,+ 23,+ 47,+ 118,+ 49,+ 47,+ 123,+ 117,+ 115,+ 101,+ 114,+ 46,+ 110,+ 97,+ 109,+ 101,+ 61,+ 117,+ 115,+ 101,+ 114,+ 115,+ 47,+ 42,+ 125,+ ]),+ ],+ },+ },+ },+ /**+ * Only the user with bb.users.delete permission on the workspace can delete the user.+ * The last remaining workspace admin cannot be deleted.+ */+ deleteUser: {+ name: "DeleteUser",+ requestType: DeleteUserRequest,+ requestStream: false,+ responseType: Empty,+ responseStream: false,+ options: {+ _unknownFields: {+ 8410: [new Uint8Array([4, 110, 97, 109, 101])],+ 800016: [new Uint8Array([2])],+ 800024: [new Uint8Array([1])],+ 578365826: [+ new Uint8Array([+ 20,+ 42,+ 18,+ 47,+ 118,+ 49,+ 47,+ 123,+ 110,+ 97,+ 109,+ 101,+ 61,+ 117,+ 115,+ 101,+ 114,+ 115,+ 47,+ 42,+ 125,+ ]),+ ],+ },+ },+ },+ /** Only the user with bb.users.undelete permission on the workspace can undelete the user. */+ undeleteUser: {+ name: "UndeleteUser",+ requestType: UndeleteUserRequest,+ requestStream: false,+ responseType: User,+ responseStream: false,+ options: {+ _unknownFields: {+ 800016: [new Uint8Array([2])],+ 800024: [new Uint8Array([1])],+ 578365826: [+ new Uint8Array([+ 32,+ 58,+ 1,+ 42,+ 34,+ 27,+ 47,+ 118,+ 49,+ 47,+ 123,+ 110,+ 97,+ 109,+ 101,+ 61,+ 117,+ 115,+ 101,+ 114,+ 115,+ 47,+ 42,+ 125,+ 58,+ 117,+ 110,+ 100,+ 101,+ 108,+ 101,+ 116,+ 101,+ ]),+ ],+ },+ },+ },+ },+} as const;++type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;++export type DeepPartial<T> = T extends Builtin ? T+ : T extends Long ? string | number | Long : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }+ : Partial<T>;++function toTimestamp(date: Date): Timestamp {+ const seconds = numberToLong(Math.trunc(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): Timestamp {+ if (o instanceof globalThis.Date) {+ return toTimestamp(o);+ } else if (typeof o === "string") {+ return toTimestamp(new globalThis.Date(o));+ } else {+ return Timestamp.fromJSON(o);+ }+}++function numberToLong(number: number) {+ return Long.fromNumber(number);+}++function isSet(value: any): boolean {+ return value !== null && value !== undefined;+}++export interface MessageFns<T> {+ encode(message: T, writer?: BinaryWriter): BinaryWriter;+ decode(input: BinaryReader | Uint8Array, length?: number): T;+ fromJSON(object: any): T;+ toJSON(message: T): unknown;+ create(base?: DeepPartial<T>): T;+ fromPartial(object: DeepPartial<T>): T;+}diff --git a/frontend/src/types/release.ts b/frontend/src/types/release.tsindex cf742e9399..0a85188306 100644--- a/frontend/src/types/release.ts+++ b/frontend/src/types/release.ts@@ -1,6 +1,6 @@import { getProjectNameReleaseId } from "@/store/modules/v1/common";import { EMPTY_ID, UNKNOWN_ID } from "./const";-import type { User } from "./proto/v1/auth_service";+import type { User } from "./proto/v1/user_service";import { Release } from "./proto/v1/release_service";import { emptyUser, unknownUser } from "./v1";import {diff --git a/frontend/src/types/review.ts b/frontend/src/types/review.tsindex cca2f0e034..82242ec590 100644--- a/frontend/src/types/review.ts+++ b/frontend/src/types/review.ts@@ -1,4 +1,4 @@-import { type User } from "@/types/proto/v1/auth_service";+import { type User } from "@/types/proto/v1/user_service";import type { ApprovalStep, Issue_Approver } from "./proto/v1/issue_service";import { ApprovalTemplate } from "./proto/v1/issue_service";diff --git a/frontend/src/types/rollout.ts b/frontend/src/types/rollout.tsindex 7cdf6fef0d..77fb9cc8d7 100644--- a/frontend/src/types/rollout.ts+++ b/frontend/src/types/rollout.ts@@ -1,6 +1,6 @@import { getProjectNameRolloutId } from "@/store/modules/v1/common";import { EMPTY_ID, UNKNOWN_ID } from "./const";-import type { User } from "./proto/v1/auth_service";+import type { User } from "./proto/v1/user_service";import { Rollout } from "./proto/v1/rollout_service";import { emptyUser, unknownUser } from "./v1";import {diff --git a/frontend/src/types/v1/issue/issue.ts b/frontend/src/types/v1/issue/issue.tsindex d21e04ab1b..f67b93b056 100644--- a/frontend/src/types/v1/issue/issue.ts+++ b/frontend/src/types/v1/issue/issue.ts@@ -10,7 +10,7 @@ import {UNKNOWN_ROLLOUT_NAME,} from "@/types";import type { Rollout } from "@/types//proto/v1/rollout_service";-import { type User } from "@/types/proto/v1/auth_service";+import { type User } from "@/types/proto/v1/user_service";import { Issue, IssueStatus, Issue_Type } from "@/types/proto/v1/issue_service";import type { Plan, PlanCheckRun } from "@/types/proto/v1/plan_service";import { EMPTY_ID, UNKNOWN_ID } from "../../const";diff --git a/frontend/src/types/v1/issue/plan.ts b/frontend/src/types/v1/issue/plan.tsindex 5c5ec5ca09..b6ad76bcb4 100644--- a/frontend/src/types/v1/issue/plan.ts+++ b/frontend/src/types/v1/issue/plan.ts@@ -1,6 +1,6 @@import { emptyUser, unknownUser } from "@/types";import { EMPTY_ID, UNKNOWN_ID } from "@/types/const";-import { type User } from "@/types/proto/v1/auth_service";+import { type User } from "@/types/proto/v1/user_service";import {Plan,PlanCheckRun,diff --git a/frontend/src/types/v1/user.ts b/frontend/src/types/v1/user.tsindex 0b10187d74..56e3a60880 100644--- a/frontend/src/types/v1/user.ts+++ b/frontend/src/types/v1/user.ts@@ -1,6 +1,6 @@import { SYSTEM_BOT_ID } from "../common";import { EMPTY_ID, UNKNOWN_ID } from "../const";-import { User, UserType } from "../proto/v1/auth_service";+import { User, UserType } from "../proto/v1/user_service";import { State } from "../proto/v1/common";export const UNKNOWN_USER_NAME = `users/${UNKNOWN_ID}`;diff --git a/frontend/src/utils/auto-route.ts b/frontend/src/utils/auto-route.tsindex a69378ea78..fb7879b772 100644--- a/frontend/src/utils/auto-route.ts+++ b/frontend/src/utils/auto-route.ts@@ -18,7 +18,7 @@ import {SQL_EDITOR_SETTING_USERS_MODULE,} from "@/router/sqlEditor";import { useAppFeature } from "@/store";-import type { User } from "@/types/proto/v1/auth_service";+import type { User } from "@/types/proto/v1/user_service";import type { Database } from "@/types/proto/v1/database_service";import type { Environment } from "@/types/proto/v1/environment_service";import type {diff --git a/frontend/src/utils/v1/iam.ts b/frontend/src/utils/v1/iam.tsindex 9493c54a51..8dd507bf9f 100644--- a/frontend/src/utils/v1/iam.ts+++ b/frontend/src/utils/v1/iam.ts@@ -12,7 +12,7 @@ import {groupBindingPrefix,PRESET_WORKSPACE_ROLES,} from "@/types";-import type { User } from "@/types/proto/v1/auth_service";+import type { User } from "@/types/proto/v1/user_service";import type { IamPolicy, Binding } from "@/types/proto/v1/iam_policy";import { convertFromExpr } from "@/utils/issue/cel";diff --git a/frontend/src/views/ProfileDashboard.vue b/frontend/src/views/ProfileDashboard.vueindex 983ef87ab7..23bdbd21ea 100644--- a/frontend/src/views/ProfileDashboard.vue+++ b/frontend/src/views/ProfileDashboard.vue@@ -263,7 +263,7 @@ import {UpdateUserRequest,UserType,type User,-} from "@/types/proto/v1/auth_service";+} from "@/types/proto/v1/user_service";import { State } from "@/types/proto/v1/common";import { displayRoleTitle, hasWorkspacePermissionV2, sortRoles } from "@/utils";diff --git a/frontend/src/views/SettingWorkspaceMembers.vue b/frontend/src/views/SettingWorkspaceMembers.vueindex fa973d81dd..7aa317e09e 100644--- a/frontend/src/views/SettingWorkspaceMembers.vue+++ b/frontend/src/views/SettingWorkspaceMembers.vue@@ -99,7 +99,7 @@ import {usePermissionStore,} from "@/store";import { userBindingPrefix, PresetRoleType } from "@/types";-import { User, UserType } from "@/types/proto/v1/auth_service";+import { User, UserType } from "@/types/proto/v1/user_service";import { hasWorkspacePermissionV2 } from "@/utils";interface LocalState {diff --git a/frontend/src/views/SettingWorkspaceUsers.vue b/frontend/src/views/SettingWorkspaceUsers.vueindex feef7a4962..0307c9393d 100644--- a/frontend/src/views/SettingWorkspaceUsers.vue+++ b/frontend/src/views/SettingWorkspaceUsers.vue@@ -187,7 +187,7 @@ import {} from "@/store";import { groupNamePrefix } from "@/store/modules/v1/common";import { ALL_USERS_USER_EMAIL, filterUserListByKeyword } from "@/types";-import { UserType, type User } from "@/types/proto/v1/auth_service";+import { UserType, type User } from "@/types/proto/v1/user_service";import { State } from "@/types/proto/v1/common";import type { Group } from "@/types/proto/v1/group_service";import { WorkspaceProfileSetting } from "@/types/proto/v1/setting_service";diff --git a/frontend/src/views/TwoFactorSetup.vue b/frontend/src/views/TwoFactorSetup.vueindex e6212591b2..839060b29d 100644--- a/frontend/src/views/TwoFactorSetup.vue+++ b/frontend/src/views/TwoFactorSetup.vue@@ -92,7 +92,7 @@ import { StepTab } from "@/components/v2";import { AUTH_2FA_SETUP_MODULE } from "@/router/auth";import { SETTING_ROUTE_PROFILE } from "@/router/dashboard/workspaceSetting";import { pushNotification, useAuthStore, useUserStore } from "@/store";-import { UpdateUserRequest } from "@/types/proto/v1/auth_service";+import { UpdateUserRequest } from "@/types/proto/v1/user_service";const issuerName = "Bytebase";diff --git a/frontend/src/views/auth/PasswordReset.vue b/frontend/src/views/auth/PasswordReset.vueindex 5004699d42..8182462f5c 100644--- a/frontend/src/views/auth/PasswordReset.vue+++ b/frontend/src/views/auth/PasswordReset.vue@@ -46,7 +46,7 @@ import {useAuthStore,useCurrentUserV1,} from "@/store";-import { UpdateUserRequest, User } from "@/types/proto/v1/auth_service";+import { UpdateUserRequest, User } from "@/types/proto/v1/user_service";interface LocalState {password: string;diff --git a/frontend/src/views/auth/Signup.vue b/frontend/src/views/auth/Signup.vueindex f94ad9369c..50b602b9a4 100644--- a/frontend/src/views/auth/Signup.vue+++ b/frontend/src/views/auth/Signup.vue@@ -158,7 +158,7 @@ import {useAuthStore,useOnboardingStateStore,} from "@/store";-import type { User } from "@/types/proto/v1/auth_service";+import type { User } from "@/types/proto/v1/user_service";import { isValidEmail } from "@/utils";import AuthFooter from "./AuthFooter.vue";diff --git a/frontend/src/views/sql-editor/Setting/Members/Members.vue b/frontend/src/views/sql-editor/Setting/Members/Members.vueindex df9203f793..32e64853db 100644--- a/frontend/src/views/sql-editor/Setting/Members/Members.vue+++ b/frontend/src/views/sql-editor/Setting/Members/Members.vue@@ -21,7 +21,7 @@ import { useRoute, useRouter } from "vue-router";import Drawer from "@/components/v2/Container/Drawer.vue";import DrawerContent from "@/components/v2/Container/DrawerContent.vue";import { useUserStore } from "@/store";-import type { User } from "@/types/proto/v1/auth_service";+import type { User } from "@/types/proto/v1/user_service";import ProfileDashboard from "@/views/ProfileDashboard.vue";import SettingWorkspaceMembers from "@/views/SettingWorkspaceMembers.vue";diff --git a/frontend/src/views/sql-editor/Setting/Users/Users.vue b/frontend/src/views/sql-editor/Setting/Users/Users.vueindex 0828402738..5fe9f54941 100644--- a/frontend/src/views/sql-editor/Setting/Users/Users.vue+++ b/frontend/src/views/sql-editor/Setting/Users/Users.vue@@ -23,7 +23,7 @@ import { computed, onMounted, reactive, watch } from "vue";import { useRoute, useRouter } from "vue-router";import { Drawer, DrawerContent } from "@/components/v2";import { useUserStore } from "@/store";-import type { User } from "@/types/proto/v1/auth_service";+import type { User } from "@/types/proto/v1/user_service";import ProfileDashboard from "@/views/ProfileDashboard.vue";import SettingWorkspaceUsers from "@/views/SettingWorkspaceUsers.vue";diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yamlindex bb7214e8fa..51f1ce31fb 100644--- a/proto/gen/grpc-doc/openapi.yaml+++ b/proto/gen/grpc-doc/openapi.yaml@@ -7338,11 +7338,11 @@ paths:/v1/users:get:tags:- - AuthService+ - UserServicedescription: |-List all users.Any authenticated user can list users.- operationId: AuthService_ListUsers+ operationId: UserService_ListUsersparameters:- name: pageSizein: query@@ -7386,12 +7386,12 @@ paths:$ref: '#/components/schemas/Status'post:tags:- - AuthService+ - UserServicedescription: |-Create a user.When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user.Otherwise, any unauthenticated user can create a user.- operationId: AuthService_CreateUser+ operationId: UserService_CreateUserrequestBody:content:application/json:@@ -7414,11 +7414,11 @@ paths:/v1/users/{user}:get:tags:- - AuthService+ - UserServicedescription: |-Get the user.Any authenticated user can get the user.- operationId: AuthService_GetUser+ operationId: UserService_GetUserparameters:- name: userin: path@@ -7441,11 +7441,11 @@ paths:$ref: '#/components/schemas/Status'delete:tags:- - AuthService+ - UserServicedescription: |-Only the user with bb.users.delete permission on the workspace can delete the user.The last remaining workspace admin cannot be deleted.- operationId: AuthService_DeleteUser+ operationId: UserService_DeleteUserparameters:- name: userin: path@@ -7465,9 +7465,9 @@ paths:$ref: '#/components/schemas/Status'patch:tags:- - AuthService+ - UserServicedescription: Only the user itself and the user with bb.users.update permission on the workspace can update the user.- operationId: AuthService_UpdateUser+ operationId: UserService_UpdateUserparameters:- name: userin: path@@ -7520,9 +7520,9 @@ paths:/v1/users/{user}:undelete:post:tags:- - AuthService+ - UserServicedescription: Only the user with bb.users.undelete permission on the workspace can undelete the user.- operationId: AuthService_UndeleteUser+ operationId: UserService_UndeleteUserparameters:- name: userin: path@@ -14861,6 +14861,7 @@ tags:- name: SettingService- name: SheetService- name: SubscriptionService+ - name: UserService- name: VCSConnectorService- name: VCSProviderService- name: WorksheetServicediff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.mdindex d459bc1b57..a774a8cf96 100644--- a/proto/gen/grpc-doc/v1/README.md+++ b/proto/gen/grpc-doc/v1/README.md@@ -321,18 +321,12 @@- [AuditLogService](#bytebase-v1-AuditLogService)-- [v1/auth_service.proto](#v1_auth_service-proto)+- [v1/user_service.proto](#v1_user_service-proto)- [CreateUserRequest](#bytebase-v1-CreateUserRequest)- [DeleteUserRequest](#bytebase-v1-DeleteUserRequest)- [GetUserRequest](#bytebase-v1-GetUserRequest)- - [IdentityProviderContext](#bytebase-v1-IdentityProviderContext)- [ListUsersRequest](#bytebase-v1-ListUsersRequest)- [ListUsersResponse](#bytebase-v1-ListUsersResponse)- - [LoginRequest](#bytebase-v1-LoginRequest)- - [LoginResponse](#bytebase-v1-LoginResponse)- - [LogoutRequest](#bytebase-v1-LogoutRequest)- - [OAuth2IdentityProviderContext](#bytebase-v1-OAuth2IdentityProviderContext)- - [OIDCIdentityProviderContext](#bytebase-v1-OIDCIdentityProviderContext)- [UndeleteUserRequest](#bytebase-v1-UndeleteUserRequest)- [UpdateUserRequest](#bytebase-v1-UpdateUserRequest)- [User](#bytebase-v1-User)@@ -340,6 +334,16 @@- [UserType](#bytebase-v1-UserType)+ - [UserService](#bytebase-v1-UserService)++- [v1/auth_service.proto](#v1_auth_service-proto)+ - [IdentityProviderContext](#bytebase-v1-IdentityProviderContext)+ - [LoginRequest](#bytebase-v1-LoginRequest)+ - [LoginResponse](#bytebase-v1-LoginResponse)+ - [LogoutRequest](#bytebase-v1-LogoutRequest)+ - [OAuth2IdentityProviderContext](#bytebase-v1-OAuth2IdentityProviderContext)+ - [OIDCIdentityProviderContext](#bytebase-v1-OIDCIdentityProviderContext)+- [AuthService](#bytebase-v1-AuthService)- [v1/cel_service.proto](#v1_cel_service-proto)@@ -5606,10 +5610,10 @@ Metadata about the request.-<a name="v1_auth_service-proto"></a>+<a name="v1_user_service-proto"></a><p align="right"><a href="#top">Top</a></p>-## v1/auth_service.proto+## v1/user_service.proto@@ -5658,22 +5662,6 @@ Metadata about the request.-<a name="bytebase-v1-IdentityProviderContext"></a>--### IdentityProviderContext----| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| oauth2_context | [OAuth2IdentityProviderContext](#bytebase-v1-OAuth2IdentityProviderContext) | | |-| oidc_context | [OIDCIdentityProviderContext](#bytebase-v1-OIDCIdentityProviderContext) | | |------<a name="bytebase-v1-ListUsersRequest"></a>### ListUsersRequest@@ -5709,175 +5697,222 @@ When paginating, all other parameters provided to `ListUsers` must match the cal-<a name="bytebase-v1-LoginRequest"></a>+<a name="bytebase-v1-UndeleteUserRequest"></a>-### LoginRequest+### UndeleteUserRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| email | [string](#string) | | |-| password | [string](#string) | | |-| web | [bool](#bool) | | If web is set, we will set access token, refresh token, and user to the cookie. |-| idp_name | [string](#string) | | The name of the identity provider. Format: idps/{idp} |-| idp_context | [IdentityProviderContext](#bytebase-v1-IdentityProviderContext) | | The idp_context is using to get the user information from identity provider. |-| otp_code | [string](#string) | optional | The otp_code is used to verify the user's identity by MFA. |-| recovery_code | [string](#string) | optional | The recovery_code is used to recovery the user's identity with MFA. |-| mfa_temp_token | [string](#string) | optional | The mfa_temp_token is used to verify the user's identity by MFA. |+| name | [string](#string) | | The name of the deleted user. Format: users/{user} |-<a name="bytebase-v1-LoginResponse"></a>+<a name="bytebase-v1-UpdateUserRequest"></a>-### LoginResponse+### UpdateUserRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| token | [string](#string) | | |-| mfa_temp_token | [string](#string) | optional | |-| require_reset_password | [bool](#bool) | | |-| user | [User](#bytebase-v1-User) | | The user of successful login. |+| user | [User](#bytebase-v1-User) | | The user to update.+The user's `name` field is used to identify the user to update. Format: users/{user} |+| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to update. |+| otp_code | [string](#string) | optional | The otp_code is used to verify the user's identity by MFA. |+| regenerate_temp_mfa_secret | [bool](#bool) | | The regenerate_temp_mfa_secret flag means to regenerate temporary MFA secret for user. This is used for MFA setup. The temporary MFA secret and recovery codes will be returned in the response. |+| regenerate_recovery_codes | [bool](#bool) | | The regenerate_recovery_codes flag means to regenerate recovery codes for user. |-<a name="bytebase-v1-LogoutRequest"></a>-### LogoutRequest+<a name="bytebase-v1-User"></a>++### User+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| name | [string](#string) | | The name of the user. Format: users/{user}. {user} is a system-generated unique ID. |+| state | [State](#bytebase-v1-State) | | |+| email | [string](#string) | | |+| title | [string](#string) | | |+| user_type | [UserType](#bytebase-v1-UserType) | | |+| password | [string](#string) | | |+| service_key | [string](#string) | | |+| mfa_enabled | [bool](#bool) | | The mfa_enabled flag means if the user has enabled MFA. |+| mfa_secret | [string](#string) | | The mfa_secret is the temporary secret using in two phase verification. |+| recovery_codes | [string](#string) | repeated | The recovery_codes is the temporary recovery codes using in two phase verification. |+| phone | [string](#string) | | Should be a valid E.164 compliant phone number. Could be empty. |+| profile | [User.Profile](#bytebase-v1-User-Profile) | | |++-<a name="bytebase-v1-OAuth2IdentityProviderContext"></a>+<a name="bytebase-v1-User-Profile"></a>-### OAuth2IdentityProviderContext+### User.Profile| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| code | [string](#string) | | |+| last_login_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |+| last_change_password_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |+| source | [string](#string) | | source means where the user comes from. For now we support Entra ID SCIM sync, so the source could be Entra ID. |+-<a name="bytebase-v1-OIDCIdentityProviderContext"></a>-### OIDCIdentityProviderContext+<a name="bytebase-v1-UserType"></a>+### UserType+| Name | Number | Description |+| ---- | ------ | ----------- |+| USER_TYPE_UNSPECIFIED | 0 | |+| USER | 1 | |+| SYSTEM_BOT | 2 | |+| SERVICE_ACCOUNT | 3 | |++-<a name="bytebase-v1-UndeleteUserRequest"></a>-### UndeleteUserRequest+<a name="bytebase-v1-UserService"></a>++### UserService+++| Method Name | Request Type | Response Type | Description |+| ----------- | ------------ | ------------- | ------------|+| GetUser | [GetUserRequest](#bytebase-v1-GetUserRequest) | [User](#bytebase-v1-User) | Get the user. Any authenticated user can get the user. |+| ListUsers | [ListUsersRequest](#bytebase-v1-ListUsersRequest) | [ListUsersResponse](#bytebase-v1-ListUsersResponse) | List all users. Any authenticated user can list users. |+| CreateUser | [CreateUserRequest](#bytebase-v1-CreateUserRequest) | [User](#bytebase-v1-User) | Create a user. When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user. Otherwise, any unauthenticated user can create a user. |+| UpdateUser | [UpdateUserRequest](#bytebase-v1-UpdateUserRequest) | [User](#bytebase-v1-User) | Only the user itself and the user with bb.users.update permission on the workspace can update the user. |+| DeleteUser | [DeleteUserRequest](#bytebase-v1-DeleteUserRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | Only the user with bb.users.delete permission on the workspace can delete the user. The last remaining workspace admin cannot be deleted. |+| UndeleteUser | [UndeleteUserRequest](#bytebase-v1-UndeleteUserRequest) | [User](#bytebase-v1-User) | Only the user with bb.users.undelete permission on the workspace can undelete the user. |++++++<a name="v1_auth_service-proto"></a>+<p align="right"><a href="#top">Top</a></p>++## v1/auth_service.proto++++<a name="bytebase-v1-IdentityProviderContext"></a>++### IdentityProviderContext| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the deleted user. Format: users/{user} |+| oauth2_context | [OAuth2IdentityProviderContext](#bytebase-v1-OAuth2IdentityProviderContext) | | |+| oidc_context | [OIDCIdentityProviderContext](#bytebase-v1-OIDCIdentityProviderContext) | | |-<a name="bytebase-v1-UpdateUserRequest"></a>+<a name="bytebase-v1-LoginRequest"></a>-### UpdateUserRequest+### LoginRequest| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| user | [User](#bytebase-v1-User) | | The user to update.--The user's `name` field is used to identify the user to update. Format: users/{user} |-| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to update. |+| email | [string](#string) | | |+| password | [string](#string) | | |+| web | [bool](#bool) | | If web is set, we will set access token, refresh token, and user to the cookie. |+| idp_name | [string](#string) | | The name of the identity provider. Format: idps/{idp} |+| idp_context | [IdentityProviderContext](#bytebase-v1-IdentityProviderContext) | | The idp_context is using to get the user information from identity provider. || otp_code | [string](#string) | optional | The otp_code is used to verify the user's identity by MFA. |-| regenerate_temp_mfa_secret | [bool](#bool) | | The regenerate_temp_mfa_secret flag means to regenerate temporary MFA secret for user. This is used for MFA setup. The temporary MFA secret and recovery codes will be returned in the response. |-| regenerate_recovery_codes | [bool](#bool) | | The regenerate_recovery_codes flag means to regenerate recovery codes for user. |+| recovery_code | [string](#string) | optional | The recovery_code is used to recovery the user's identity with MFA. |+| mfa_temp_token | [string](#string) | optional | The mfa_temp_token is used to verify the user's identity by MFA. |-<a name="bytebase-v1-User"></a>+<a name="bytebase-v1-LoginResponse"></a>-### User+### LoginResponse| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the user. Format: users/{user}. {user} is a system-generated unique ID. |-| state | [State](#bytebase-v1-State) | | |-| email | [string](#string) | | |-| title | [string](#string) | | |-| user_type | [UserType](#bytebase-v1-UserType) | | |-| password | [string](#string) | | |-| service_key | [string](#string) | | |-| mfa_enabled | [bool](#bool) | | The mfa_enabled flag means if the user has enabled MFA. |-| mfa_secret | [string](#string) | | The mfa_secret is the temporary secret using in two phase verification. |-| recovery_codes | [string](#string) | repeated | The recovery_codes is the temporary recovery codes using in two phase verification. |-| phone | [string](#string) | | Should be a valid E.164 compliant phone number. Could be empty. |-| profile | [User.Profile](#bytebase-v1-User-Profile) | | |+| token | [string](#string) | | |+| mfa_temp_token | [string](#string) | optional | |+| require_reset_password | [bool](#bool) | | |+| user | [User](#bytebase-v1-User) | | The user of successful login. |-<a name="bytebase-v1-User-Profile"></a>+<a name="bytebase-v1-LogoutRequest"></a>-### User.Profile+### LogoutRequest++++++++<a name="bytebase-v1-OAuth2IdentityProviderContext"></a>++### OAuth2IdentityProviderContext| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| last_login_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |-| last_change_password_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |-| source | [string](#string) | | source means where the user comes from. For now we support Entra ID SCIM sync, so the source could be Entra ID. |+| code | [string](#string) | | |-+<a name="bytebase-v1-OIDCIdentityProviderContext"></a>-<a name="bytebase-v1-UserType"></a>+### OIDCIdentityProviderContext-### UserType-| Name | Number | Description |-| ---- | ------ | ----------- |-| USER_TYPE_UNSPECIFIED | 0 | |-| USER | 1 | |-| SYSTEM_BOT | 2 | |-| SERVICE_ACCOUNT | 3 | |+++@@ -5890,12 +5925,6 @@ The user's `name` field is used to identify the user to update. Format: user| Method Name | Request Type | Response Type | Description || ----------- | ------------ | ------------- | ------------|-| GetUser | [GetUserRequest](#bytebase-v1-GetUserRequest) | [User](#bytebase-v1-User) | Get the user. Any authenticated user can get the user. |-| ListUsers | [ListUsersRequest](#bytebase-v1-ListUsersRequest) | [ListUsersResponse](#bytebase-v1-ListUsersResponse) | List all users. Any authenticated user can list users. |-| CreateUser | [CreateUserRequest](#bytebase-v1-CreateUserRequest) | [User](#bytebase-v1-User) | Create a user. When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user. Otherwise, any unauthenticated user can create a user. |-| UpdateUser | [UpdateUserRequest](#bytebase-v1-UpdateUserRequest) | [User](#bytebase-v1-User) | Only the user itself and the user with bb.users.update permission on the workspace can update the user. |-| DeleteUser | [DeleteUserRequest](#bytebase-v1-DeleteUserRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | Only the user with bb.users.delete permission on the workspace can delete the user. The last remaining workspace admin cannot be deleted. |-| UndeleteUser | [UndeleteUserRequest](#bytebase-v1-UndeleteUserRequest) | [User](#bytebase-v1-User) | Only the user with bb.users.undelete permission on the workspace can undelete the user. || Login | [LoginRequest](#bytebase-v1-LoginRequest) | [LoginResponse](#bytebase-v1-LoginResponse) | || Logout | [LogoutRequest](#bytebase-v1-LogoutRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.htmlindex 01aa595ea2..01df9062ab 100644--- a/proto/gen/grpc-doc/v1/index.html+++ b/proto/gen/grpc-doc/v1/index.html@@ -1402,7 +1402,7 @@<li>- <a href="#v1%2fauth_service.proto">v1/auth_service.proto</a>+ <a href="#v1%2fuser_service.proto">v1/user_service.proto</a><ul><li>@@ -1418,60 +1418,75 @@</li><li>- <a href="#bytebase.v1.IdentityProviderContext"><span class="badge">M</span>IdentityProviderContext</a>+ <a href="#bytebase.v1.ListUsersRequest"><span class="badge">M</span>ListUsersRequest</a></li><li>- <a href="#bytebase.v1.ListUsersRequest"><span class="badge">M</span>ListUsersRequest</a>+ <a href="#bytebase.v1.ListUsersResponse"><span class="badge">M</span>ListUsersResponse</a></li><li>- <a href="#bytebase.v1.ListUsersResponse"><span class="badge">M</span>ListUsersResponse</a>+ <a href="#bytebase.v1.UndeleteUserRequest"><span class="badge">M</span>UndeleteUserRequest</a></li><li>- <a href="#bytebase.v1.LoginRequest"><span class="badge">M</span>LoginRequest</a>+ <a href="#bytebase.v1.UpdateUserRequest"><span class="badge">M</span>UpdateUserRequest</a></li><li>- <a href="#bytebase.v1.LoginResponse"><span class="badge">M</span>LoginResponse</a>+ <a href="#bytebase.v1.User"><span class="badge">M</span>User</a></li><li>- <a href="#bytebase.v1.LogoutRequest"><span class="badge">M</span>LogoutRequest</a>+ <a href="#bytebase.v1.User.Profile"><span class="badge">M</span>User.Profile</a></li>+<li>- <a href="#bytebase.v1.OAuth2IdentityProviderContext"><span class="badge">M</span>OAuth2IdentityProviderContext</a>+ <a href="#bytebase.v1.UserType"><span class="badge">E</span>UserType</a></li>++<li>- <a href="#bytebase.v1.OIDCIdentityProviderContext"><span class="badge">M</span>OIDCIdentityProviderContext</a>+ <a href="#bytebase.v1.UserService"><span class="badge">S</span>UserService</a></li>+ </ul>+ </li>+++ <li>+ <a href="#v1%2fauth_service.proto">v1/auth_service.proto</a>+ <ul>+<li>- <a href="#bytebase.v1.UndeleteUserRequest"><span class="badge">M</span>UndeleteUserRequest</a>+ <a href="#bytebase.v1.IdentityProviderContext"><span class="badge">M</span>IdentityProviderContext</a></li><li>- <a href="#bytebase.v1.UpdateUserRequest"><span class="badge">M</span>UpdateUserRequest</a>+ <a href="#bytebase.v1.LoginRequest"><span class="badge">M</span>LoginRequest</a></li><li>- <a href="#bytebase.v1.User"><span class="badge">M</span>User</a>+ <a href="#bytebase.v1.LoginResponse"><span class="badge">M</span>LoginResponse</a></li><li>- <a href="#bytebase.v1.User.Profile"><span class="badge">M</span>User.Profile</a>+ <a href="#bytebase.v1.LogoutRequest"><span class="badge">M</span>LogoutRequest</a></li>+ <li>+ <a href="#bytebase.v1.OAuth2IdentityProviderContext"><span class="badge">M</span>OAuth2IdentityProviderContext</a>+ </li><li>- <a href="#bytebase.v1.UserType"><span class="badge">E</span>UserType</a>+ <a href="#bytebase.v1.OIDCIdentityProviderContext"><span class="badge">M</span>OIDCIdentityProviderContext</a></li>+<li><a href="#bytebase.v1.AuthService"><span class="badge">S</span>AuthService</a></li>@@ -16026,7 +16041,7 @@ to retrieve the next page of log entities. </p></td><div class="file-heading">- <h2 id="v1/auth_service.proto">v1/auth_service.proto</h2><a href="#title">Top</a>+ <h2 id="v1/user_service.proto">v1/user_service.proto</h2><a href="#title">Top</a></div><p></p>@@ -16105,37 +16120,6 @@ Format: users/{user uid or user email} </p></td>- <h3 id="bytebase.v1.IdentityProviderContext">IdentityProviderContext</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>oauth2_context</td>- <td><a href="#bytebase.v1.OAuth2IdentityProviderContext">OAuth2IdentityProviderContext</a></td>- <td></td>- <td><p> </p></td>- </tr>-- <tr>- <td>oidc_context</td>- <td><a href="#bytebase.v1.OIDCIdentityProviderContext">OIDCIdentityProviderContext</a></td>- <td></td>- <td><p> </p></td>- </tr>-- </tbody>- </table>-----<h3 id="bytebase.v1.ListUsersRequest">ListUsersRequest</h3><p></p>@@ -16215,163 +16199,6 @@ If this field is omitted, there are no subsequent pages. </p></td>- <h3 id="bytebase.v1.LoginRequest">LoginRequest</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>email</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p> </p></td>- </tr>-- <tr>- <td>password</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p> </p></td>- </tr>-- <tr>- <td>web</td>- <td><a href="#bool">bool</a></td>- <td></td>- <td><p>If web is set, we will set access token, refresh token, and user to the cookie. </p></td>- </tr>-- <tr>- <td>idp_name</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>The name of the identity provider.-Format: idps/{idp} </p></td>- </tr>-- <tr>- <td>idp_context</td>- <td><a href="#bytebase.v1.IdentityProviderContext">IdentityProviderContext</a></td>- <td></td>- <td><p>The idp_context is using to get the user information from identity provider. </p></td>- </tr>-- <tr>- <td>otp_code</td>- <td><a href="#string">string</a></td>- <td>optional</td>- <td><p>The otp_code is used to verify the user's identity by MFA. </p></td>- </tr>-- <tr>- <td>recovery_code</td>- <td><a href="#string">string</a></td>- <td>optional</td>- <td><p>The recovery_code is used to recovery the user's identity with MFA. </p></td>- </tr>-- <tr>- <td>mfa_temp_token</td>- <td><a href="#string">string</a></td>- <td>optional</td>- <td><p>The mfa_temp_token is used to verify the user's identity by MFA. </p></td>- </tr>-- </tbody>- </table>------ <h3 id="bytebase.v1.LoginResponse">LoginResponse</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>token</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p> </p></td>- </tr>-- <tr>- <td>mfa_temp_token</td>- <td><a href="#string">string</a></td>- <td>optional</td>- <td><p> </p></td>- </tr>-- <tr>- <td>require_reset_password</td>- <td><a href="#bool">bool</a></td>- <td></td>- <td><p> </p></td>- </tr>-- <tr>- <td>user</td>- <td><a href="#bytebase.v1.User">User</a></td>- <td></td>- <td><p>The user of successful login. </p></td>- </tr>-- </tbody>- </table>------ <h3 id="bytebase.v1.LogoutRequest">LogoutRequest</h3>- <p></p>------ <h3 id="bytebase.v1.OAuth2IdentityProviderContext">OAuth2IdentityProviderContext</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>code</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p> </p></td>- </tr>-- </tbody>- </table>------ <h3 id="bytebase.v1.OIDCIdentityProviderContext">OIDCIdentityProviderContext</h3>- <p></p>-----<h3 id="bytebase.v1.UndeleteUserRequest">UndeleteUserRequest</h3><p></p>@@ -16635,7 +16462,7 @@ Could be empty. </p></td>- <h3 id="bytebase.v1.AuthService">AuthService</h3>+ <h3 id="bytebase.v1.UserService">UserService</h3><p></p><table class="enum-table"><thead>@@ -16690,20 +16517,6 @@ The last remaining workspace admin cannot be deleted.</p></td><td><p>Only the user with bb.users.undelete permission on the workspace can undelete the user.</p></td></tr>- <tr>- <td>Login</td>- <td><a href="#bytebase.v1.LoginRequest">LoginRequest</a></td>- <td><a href="#bytebase.v1.LoginResponse">LoginResponse</a></td>- <td><p></p></td>- </tr>-- <tr>- <td>Logout</td>- <td><a href="#bytebase.v1.LogoutRequest">LogoutRequest</a></td>- <td><a href="#google.protobuf.Empty">.google.protobuf.Empty</a></td>- <td><p></p></td>- </tr>-</tbody></table>@@ -16782,6 +16595,252 @@ The last remaining workspace admin cannot be deleted.</p></td></tr>+ </tbody>+ </table>+++++ <div class="file-heading">+ <h2 id="v1/auth_service.proto">v1/auth_service.proto</h2><a href="#title">Top</a>+ </div>+ <p></p>+++ <h3 id="bytebase.v1.IdentityProviderContext">IdentityProviderContext</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>oauth2_context</td>+ <td><a href="#bytebase.v1.OAuth2IdentityProviderContext">OAuth2IdentityProviderContext</a></td>+ <td></td>+ <td><p> </p></td>+ </tr>++ <tr>+ <td>oidc_context</td>+ <td><a href="#bytebase.v1.OIDCIdentityProviderContext">OIDCIdentityProviderContext</a></td>+ <td></td>+ <td><p> </p></td>+ </tr>++ </tbody>+ </table>++++++ <h3 id="bytebase.v1.LoginRequest">LoginRequest</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>email</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p> </p></td>+ </tr>++ <tr>+ <td>password</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p> </p></td>+ </tr>++ <tr>+ <td>web</td>+ <td><a href="#bool">bool</a></td>+ <td></td>+ <td><p>If web is set, we will set access token, refresh token, and user to the cookie. </p></td>+ </tr>++ <tr>+ <td>idp_name</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>The name of the identity provider.+Format: idps/{idp} </p></td>+ </tr>++ <tr>+ <td>idp_context</td>+ <td><a href="#bytebase.v1.IdentityProviderContext">IdentityProviderContext</a></td>+ <td></td>+ <td><p>The idp_context is using to get the user information from identity provider. </p></td>+ </tr>++ <tr>+ <td>otp_code</td>+ <td><a href="#string">string</a></td>+ <td>optional</td>+ <td><p>The otp_code is used to verify the user's identity by MFA. </p></td>+ </tr>++ <tr>+ <td>recovery_code</td>+ <td><a href="#string">string</a></td>+ <td>optional</td>+ <td><p>The recovery_code is used to recovery the user's identity with MFA. </p></td>+ </tr>++ <tr>+ <td>mfa_temp_token</td>+ <td><a href="#string">string</a></td>+ <td>optional</td>+ <td><p>The mfa_temp_token is used to verify the user's identity by MFA. </p></td>+ </tr>++ </tbody>+ </table>++++++ <h3 id="bytebase.v1.LoginResponse">LoginResponse</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>token</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p> </p></td>+ </tr>++ <tr>+ <td>mfa_temp_token</td>+ <td><a href="#string">string</a></td>+ <td>optional</td>+ <td><p> </p></td>+ </tr>++ <tr>+ <td>require_reset_password</td>+ <td><a href="#bool">bool</a></td>+ <td></td>+ <td><p> </p></td>+ </tr>++ <tr>+ <td>user</td>+ <td><a href="#bytebase.v1.User">User</a></td>+ <td></td>+ <td><p>The user of successful login. </p></td>+ </tr>++ </tbody>+ </table>++++++ <h3 id="bytebase.v1.LogoutRequest">LogoutRequest</h3>+ <p></p>++++++ <h3 id="bytebase.v1.OAuth2IdentityProviderContext">OAuth2IdentityProviderContext</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>code</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p> </p></td>+ </tr>++ </tbody>+ </table>++++++ <h3 id="bytebase.v1.OIDCIdentityProviderContext">OIDCIdentityProviderContext</h3>+ <p></p>++++++++++++ <h3 id="bytebase.v1.AuthService">AuthService</h3>+ <p></p>+ <table class="enum-table">+ <thead>+ <tr><td>Method Name</td><td>Request Type</td><td>Response Type</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>Login</td>+ <td><a href="#bytebase.v1.LoginRequest">LoginRequest</a></td>+ <td><a href="#bytebase.v1.LoginResponse">LoginResponse</a></td>+ <td><p></p></td>+ </tr>++ <tr>+ <td>Logout</td>+ <td><a href="#bytebase.v1.LogoutRequest">LogoutRequest</a></td>+ <td><a href="#google.protobuf.Empty">.google.protobuf.Empty</a></td>+ <td><p></p></td>+ </tr>++ </tbody>+ </table>+++++ <h4>Methods with HTTP bindings</h4>+ <table>+ <thead>+ <tr>+ <td>Method Name</td>+ <td>Method</td>+ <td>Pattern</td>+ <td>Body</td>+ </tr>+ </thead>+ <tbody>+<tr>diff --git a/proto/generated-go/v1/auth_service.pb.go b/proto/generated-go/v1/auth_service.pb.goindex e5d692568d..ca80184d4e 100644--- a/proto/generated-go/v1/auth_service.pb.go+++ b/proto/generated-go/v1/auth_service.pb.go@@ -11,8 +11,6 @@ import (protoreflect "google.golang.org/protobuf/reflect/protoreflect"protoimpl "google.golang.org/protobuf/runtime/protoimpl"emptypb "google.golang.org/protobuf/types/known/emptypb"- fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"- timestamppb "google.golang.org/protobuf/types/known/timestamppb"reflect "reflect"sync "sync"unsafe "unsafe"@@ -25,453 +23,6 @@ const (_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20))-type UserType int32--const (- UserType_USER_TYPE_UNSPECIFIED UserType = 0- UserType_USER UserType = 1- UserType_SYSTEM_BOT UserType = 2- UserType_SERVICE_ACCOUNT UserType = 3-)--// Enum value maps for UserType.-var (- UserType_name = map[int32]string{- 0: "USER_TYPE_UNSPECIFIED",- 1: "USER",- 2: "SYSTEM_BOT",- 3: "SERVICE_ACCOUNT",- }- UserType_value = map[string]int32{- "USER_TYPE_UNSPECIFIED": 0,- "USER": 1,- "SYSTEM_BOT": 2,- "SERVICE_ACCOUNT": 3,- }-)--func (x UserType) Enum() *UserType {- p := new(UserType)- *p = x- return p-}--func (x UserType) String() string {- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))-}--func (UserType) Descriptor() protoreflect.EnumDescriptor {- return file_v1_auth_service_proto_enumTypes[0].Descriptor()-}--func (UserType) Type() protoreflect.EnumType {- return &file_v1_auth_service_proto_enumTypes[0]-}--func (x UserType) Number() protoreflect.EnumNumber {- return protoreflect.EnumNumber(x)-}--// Deprecated: Use UserType.Descriptor instead.-func (UserType) EnumDescriptor() ([]byte, []int) {- return file_v1_auth_service_proto_rawDescGZIP(), []int{0}-}--type GetUserRequest struct {- state protoimpl.MessageState `protogen:"open.v1"`- // The name of the user to retrieve.- // Format: users/{user uid or user email}- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache-}--func (x *GetUserRequest) Reset() {- *x = GetUserRequest{}- mi := &file_v1_auth_service_proto_msgTypes[0]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)-}--func (x *GetUserRequest) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*GetUserRequest) ProtoMessage() {}--func (x *GetUserRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_auth_service_proto_msgTypes[0]- if x != nil {- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- if ms.LoadMessageInfo() == nil {- ms.StoreMessageInfo(mi)- }- return ms- }- return mi.MessageOf(x)-}--// Deprecated: Use GetUserRequest.ProtoReflect.Descriptor instead.-func (*GetUserRequest) Descriptor() ([]byte, []int) {- return file_v1_auth_service_proto_rawDescGZIP(), []int{0}-}--func (x *GetUserRequest) GetName() string {- if x != nil {- return x.Name- }- return ""-}--type ListUsersRequest struct {- state protoimpl.MessageState `protogen:"open.v1"`- // Not used.- // The maximum number of users to return. The service may return fewer than- // this value.- // If unspecified, at most 50 users will be returned.- // The maximum value is 1000; values above 1000 will be coerced to 1000.- PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`- // Not used.- // A page token, received from a previous `ListUsers` call.- // Provide this to retrieve the subsequent page.- //- // When paginating, all other parameters provided to `ListUsers` must match- // the call that provided the page token.- PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`- // Show deleted users if specified.- ShowDeleted bool `protobuf:"varint,3,opt,name=show_deleted,json=showDeleted,proto3" json:"show_deleted,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache-}--func (x *ListUsersRequest) Reset() {- *x = ListUsersRequest{}- mi := &file_v1_auth_service_proto_msgTypes[1]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)-}--func (x *ListUsersRequest) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*ListUsersRequest) ProtoMessage() {}--func (x *ListUsersRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_auth_service_proto_msgTypes[1]- if x != nil {- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- if ms.LoadMessageInfo() == nil {- ms.StoreMessageInfo(mi)- }- return ms- }- return mi.MessageOf(x)-}--// Deprecated: Use ListUsersRequest.ProtoReflect.Descriptor instead.-func (*ListUsersRequest) Descriptor() ([]byte, []int) {- return file_v1_auth_service_proto_rawDescGZIP(), []int{1}-}--func (x *ListUsersRequest) GetPageSize() int32 {- if x != nil {- return x.PageSize- }- return 0-}--func (x *ListUsersRequest) GetPageToken() string {- if x != nil {- return x.PageToken- }- return ""-}--func (x *ListUsersRequest) GetShowDeleted() bool {- if x != nil {- return x.ShowDeleted- }- return false-}--type ListUsersResponse struct {- state protoimpl.MessageState `protogen:"open.v1"`- // The users from the specified request.- Users []*User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"`- // A token, which can be sent as `page_token` to retrieve the next page.- // If this field is omitted, there are no subsequent pages.- NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache-}--func (x *ListUsersResponse) Reset() {- *x = ListUsersResponse{}- mi := &file_v1_auth_service_proto_msgTypes[2]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)-}--func (x *ListUsersResponse) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*ListUsersResponse) ProtoMessage() {}--func (x *ListUsersResponse) ProtoReflect() protoreflect.Message {- mi := &file_v1_auth_service_proto_msgTypes[2]- if x != nil {- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- if ms.LoadMessageInfo() == nil {- ms.StoreMessageInfo(mi)- }- return ms- }- return mi.MessageOf(x)-}--// Deprecated: Use ListUsersResponse.ProtoReflect.Descriptor instead.-func (*ListUsersResponse) Descriptor() ([]byte, []int) {- return file_v1_auth_service_proto_rawDescGZIP(), []int{2}-}--func (x *ListUsersResponse) GetUsers() []*User {- if x != nil {- return x.Users- }- return nil-}--func (x *ListUsersResponse) GetNextPageToken() string {- if x != nil {- return x.NextPageToken- }- return ""-}--type CreateUserRequest struct {- state protoimpl.MessageState `protogen:"open.v1"`- // The user to create.- User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache-}--func (x *CreateUserRequest) Reset() {- *x = CreateUserRequest{}- mi := &file_v1_auth_service_proto_msgTypes[3]- 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[3]- if 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{3}-}--func (x *CreateUserRequest) GetUser() *User {- if x != nil {- return x.User- }- return nil-}--type UpdateUserRequest struct {- state protoimpl.MessageState `protogen:"open.v1"`- // The user to update.- //- // The user's `name` field is used to identify the user to update.- // Format: users/{user}- User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`- // The list of fields to update.- UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`- // The otp_code is used to verify the user's identity by MFA.- OtpCode *string `protobuf:"bytes,3,opt,name=otp_code,json=otpCode,proto3,oneof" json:"otp_code,omitempty"`- // The regenerate_temp_mfa_secret flag means to regenerate temporary MFA secret for user.- // This is used for MFA setup. The temporary MFA secret and recovery codes will be returned in the response.- RegenerateTempMfaSecret bool `protobuf:"varint,4,opt,name=regenerate_temp_mfa_secret,json=regenerateTempMfaSecret,proto3" json:"regenerate_temp_mfa_secret,omitempty"`- // The regenerate_recovery_codes flag means to regenerate recovery codes for user.- RegenerateRecoveryCodes bool `protobuf:"varint,5,opt,name=regenerate_recovery_codes,json=regenerateRecoveryCodes,proto3" json:"regenerate_recovery_codes,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache-}--func (x *UpdateUserRequest) Reset() {- *x = UpdateUserRequest{}- mi := &file_v1_auth_service_proto_msgTypes[4]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)-}--func (x *UpdateUserRequest) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*UpdateUserRequest) ProtoMessage() {}--func (x *UpdateUserRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_auth_service_proto_msgTypes[4]- if x != nil {- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- if ms.LoadMessageInfo() == nil {- ms.StoreMessageInfo(mi)- }- return ms- }- return mi.MessageOf(x)-}--// Deprecated: Use UpdateUserRequest.ProtoReflect.Descriptor instead.-func (*UpdateUserRequest) Descriptor() ([]byte, []int) {- return file_v1_auth_service_proto_rawDescGZIP(), []int{4}-}--func (x *UpdateUserRequest) GetUser() *User {- if x != nil {- return x.User- }- return nil-}--func (x *UpdateUserRequest) GetUpdateMask() *fieldmaskpb.FieldMask {- if x != nil {- return x.UpdateMask- }- return nil-}--func (x *UpdateUserRequest) GetOtpCode() string {- if x != nil && x.OtpCode != nil {- return *x.OtpCode- }- return ""-}--func (x *UpdateUserRequest) GetRegenerateTempMfaSecret() bool {- if x != nil {- return x.RegenerateTempMfaSecret- }- return false-}--func (x *UpdateUserRequest) GetRegenerateRecoveryCodes() bool {- if x != nil {- return x.RegenerateRecoveryCodes- }- return false-}--type DeleteUserRequest struct {- state protoimpl.MessageState `protogen:"open.v1"`- // The name of the user to delete.- // Format: users/{user}- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache-}--func (x *DeleteUserRequest) Reset() {- *x = DeleteUserRequest{}- mi := &file_v1_auth_service_proto_msgTypes[5]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)-}--func (x *DeleteUserRequest) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*DeleteUserRequest) ProtoMessage() {}--func (x *DeleteUserRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_auth_service_proto_msgTypes[5]- if x != nil {- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- if ms.LoadMessageInfo() == nil {- ms.StoreMessageInfo(mi)- }- return ms- }- return mi.MessageOf(x)-}--// Deprecated: Use DeleteUserRequest.ProtoReflect.Descriptor instead.-func (*DeleteUserRequest) Descriptor() ([]byte, []int) {- return file_v1_auth_service_proto_rawDescGZIP(), []int{5}-}--func (x *DeleteUserRequest) GetName() string {- if x != nil {- return x.Name- }- return ""-}--type UndeleteUserRequest struct {- state protoimpl.MessageState `protogen:"open.v1"`- // The name of the deleted user.- // Format: users/{user}- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache-}--func (x *UndeleteUserRequest) Reset() {- *x = UndeleteUserRequest{}- mi := &file_v1_auth_service_proto_msgTypes[6]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)-}--func (x *UndeleteUserRequest) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*UndeleteUserRequest) ProtoMessage() {}--func (x *UndeleteUserRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_auth_service_proto_msgTypes[6]- if x != nil {- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- if ms.LoadMessageInfo() == nil {- ms.StoreMessageInfo(mi)- }- return ms- }- return mi.MessageOf(x)-}--// Deprecated: Use UndeleteUserRequest.ProtoReflect.Descriptor instead.-func (*UndeleteUserRequest) Descriptor() ([]byte, []int) {- return file_v1_auth_service_proto_rawDescGZIP(), []int{6}-}--func (x *UndeleteUserRequest) GetName() string {- if x != nil {- return x.Name- }- return ""-}-type LoginRequest struct {state protoimpl.MessageState `protogen:"open.v1"`Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"`@@ -495,7 +46,7 @@ type LoginRequest struct {func (x *LoginRequest) Reset() {*x = LoginRequest{}- mi := &file_v1_auth_service_proto_msgTypes[7]+ mi := &file_v1_auth_service_proto_msgTypes[0]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -507,7 +58,7 @@ func (x *LoginRequest) String() string {func (*LoginRequest) ProtoMessage() {}func (x *LoginRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_auth_service_proto_msgTypes[7]+ mi := &file_v1_auth_service_proto_msgTypes[0]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -520,7 +71,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{7}+ return file_v1_auth_service_proto_rawDescGZIP(), []int{0}}func (x *LoginRequest) GetEmail() string {@@ -592,7 +143,7 @@ type IdentityProviderContext struct {func (x *IdentityProviderContext) Reset() {*x = IdentityProviderContext{}- mi := &file_v1_auth_service_proto_msgTypes[8]+ mi := &file_v1_auth_service_proto_msgTypes[1]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -604,7 +155,7 @@ func (x *IdentityProviderContext) String() string {func (*IdentityProviderContext) ProtoMessage() {}func (x *IdentityProviderContext) ProtoReflect() protoreflect.Message {- mi := &file_v1_auth_service_proto_msgTypes[8]+ mi := &file_v1_auth_service_proto_msgTypes[1]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -617,7 +168,7 @@ func (x *IdentityProviderContext) ProtoReflect() protoreflect.Message {// Deprecated: Use IdentityProviderContext.ProtoReflect.Descriptor instead.func (*IdentityProviderContext) Descriptor() ([]byte, []int) {- return file_v1_auth_service_proto_rawDescGZIP(), []int{8}+ return file_v1_auth_service_proto_rawDescGZIP(), []int{1}}func (x *IdentityProviderContext) GetContext() isIdentityProviderContext_Context {@@ -670,7 +221,7 @@ type OAuth2IdentityProviderContext struct {func (x *OAuth2IdentityProviderContext) Reset() {*x = OAuth2IdentityProviderContext{}- mi := &file_v1_auth_service_proto_msgTypes[9]+ mi := &file_v1_auth_service_proto_msgTypes[2]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -682,7 +233,7 @@ func (x *OAuth2IdentityProviderContext) String() string {func (*OAuth2IdentityProviderContext) ProtoMessage() {}func (x *OAuth2IdentityProviderContext) ProtoReflect() protoreflect.Message {- mi := &file_v1_auth_service_proto_msgTypes[9]+ mi := &file_v1_auth_service_proto_msgTypes[2]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -695,7 +246,7 @@ func (x *OAuth2IdentityProviderContext) ProtoReflect() protoreflect.Message {// Deprecated: Use OAuth2IdentityProviderContext.ProtoReflect.Descriptor instead.func (*OAuth2IdentityProviderContext) Descriptor() ([]byte, []int) {- return file_v1_auth_service_proto_rawDescGZIP(), []int{9}+ return file_v1_auth_service_proto_rawDescGZIP(), []int{2}}func (x *OAuth2IdentityProviderContext) GetCode() string {@@ -713,7 +264,7 @@ type OIDCIdentityProviderContext struct {func (x *OIDCIdentityProviderContext) Reset() {*x = OIDCIdentityProviderContext{}- mi := &file_v1_auth_service_proto_msgTypes[10]+ mi := &file_v1_auth_service_proto_msgTypes[3]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -725,7 +276,7 @@ func (x *OIDCIdentityProviderContext) String() string {func (*OIDCIdentityProviderContext) ProtoMessage() {}func (x *OIDCIdentityProviderContext) ProtoReflect() protoreflect.Message {- mi := &file_v1_auth_service_proto_msgTypes[10]+ mi := &file_v1_auth_service_proto_msgTypes[3]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -738,7 +289,7 @@ func (x *OIDCIdentityProviderContext) ProtoReflect() protoreflect.Message {// Deprecated: Use OIDCIdentityProviderContext.ProtoReflect.Descriptor instead.func (*OIDCIdentityProviderContext) Descriptor() ([]byte, []int) {- return file_v1_auth_service_proto_rawDescGZIP(), []int{10}+ return file_v1_auth_service_proto_rawDescGZIP(), []int{3}}type LoginResponse struct {@@ -754,7 +305,7 @@ type LoginResponse struct {func (x *LoginResponse) Reset() {*x = LoginResponse{}- mi := &file_v1_auth_service_proto_msgTypes[11]+ mi := &file_v1_auth_service_proto_msgTypes[4]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -766,7 +317,7 @@ func (x *LoginResponse) String() string {func (*LoginResponse) ProtoMessage() {}func (x *LoginResponse) ProtoReflect() protoreflect.Message {- mi := &file_v1_auth_service_proto_msgTypes[11]+ mi := &file_v1_auth_service_proto_msgTypes[4]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -779,7 +330,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{11}+ return file_v1_auth_service_proto_rawDescGZIP(), []int{4}}func (x *LoginResponse) GetToken() string {@@ -818,7 +369,7 @@ type LogoutRequest struct {func (x *LogoutRequest) Reset() {*x = LogoutRequest{}- mi := &file_v1_auth_service_proto_msgTypes[12]+ mi := &file_v1_auth_service_proto_msgTypes[5]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -830,7 +381,7 @@ func (x *LogoutRequest) String() string {func (*LogoutRequest) ProtoMessage() {}func (x *LogoutRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_auth_service_proto_msgTypes[12]+ mi := &file_v1_auth_service_proto_msgTypes[5]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -843,207 +394,7 @@ 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{12}-}--type User struct {- state protoimpl.MessageState `protogen:"open.v1"`- // 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"`- UserType UserType `protobuf:"varint,5,opt,name=user_type,json=userType,proto3,enum=bytebase.v1.UserType" json:"user_type,omitempty"`- Password string `protobuf:"bytes,7,opt,name=password,proto3" json:"password,omitempty"`- ServiceKey string `protobuf:"bytes,8,opt,name=service_key,json=serviceKey,proto3" json:"service_key,omitempty"`- // The mfa_enabled flag means if the user has enabled MFA.- MfaEnabled bool `protobuf:"varint,9,opt,name=mfa_enabled,json=mfaEnabled,proto3" json:"mfa_enabled,omitempty"`- // The mfa_secret is the temporary secret using in two phase verification.- MfaSecret string `protobuf:"bytes,10,opt,name=mfa_secret,json=mfaSecret,proto3" json:"mfa_secret,omitempty"`- // The recovery_codes is the temporary recovery codes using in two phase verification.- RecoveryCodes []string `protobuf:"bytes,11,rep,name=recovery_codes,json=recoveryCodes,proto3" json:"recovery_codes,omitempty"`- // Should be a valid E.164 compliant phone number.- // Could be empty.- Phone string `protobuf:"bytes,12,opt,name=phone,proto3" json:"phone,omitempty"`- Profile *User_Profile `protobuf:"bytes,13,opt,name=profile,proto3" json:"profile,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache-}--func (x *User) Reset() {- *x = User{}- mi := &file_v1_auth_service_proto_msgTypes[13]- 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[13]- if 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{13}-}--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) GetUserType() UserType {- if x != nil {- return x.UserType- }- return UserType_USER_TYPE_UNSPECIFIED-}--func (x *User) GetPassword() string {- if x != nil {- return x.Password- }- return ""-}--func (x *User) GetServiceKey() string {- if x != nil {- return x.ServiceKey- }- return ""-}--func (x *User) GetMfaEnabled() bool {- if x != nil {- return x.MfaEnabled- }- return false-}--func (x *User) GetMfaSecret() string {- if x != nil {- return x.MfaSecret- }- return ""-}--func (x *User) GetRecoveryCodes() []string {- if x != nil {- return x.RecoveryCodes- }- return nil-}--func (x *User) GetPhone() string {- if x != nil {- return x.Phone- }- return ""-}--func (x *User) GetProfile() *User_Profile {- if x != nil {- return x.Profile- }- return nil-}--type User_Profile struct {- state protoimpl.MessageState `protogen:"open.v1"`- 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"`- // source means where the user comes from. For now we support Entra ID SCIM sync, so the source could be Entra ID.- Source string `protobuf:"bytes,3,opt,name=source,proto3" json:"source,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache-}--func (x *User_Profile) Reset() {- *x = User_Profile{}- mi := &file_v1_auth_service_proto_msgTypes[14]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)-}--func (x *User_Profile) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*User_Profile) ProtoMessage() {}--func (x *User_Profile) ProtoReflect() protoreflect.Message {- mi := &file_v1_auth_service_proto_msgTypes[14]- if 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_Profile.ProtoReflect.Descriptor instead.-func (*User_Profile) Descriptor() ([]byte, []int) {- return file_v1_auth_service_proto_rawDescGZIP(), []int{13, 0}-}--func (x *User_Profile) GetLastLoginTime() *timestamppb.Timestamp {- if x != nil {- return x.LastLoginTime- }- return nil-}--func (x *User_Profile) GetLastChangePasswordTime() *timestamppb.Timestamp {- if x != nil {- return x.LastChangePasswordTime- }- return nil-}--func (x *User_Profile) GetSource() string {- if x != nil {- return x.Source- }- return ""+ return file_v1_auth_service_proto_rawDescGZIP(), []int{5}}var File_v1_auth_service_proto protoreflect.FileDescriptor@@ -1053,226 +404,79 @@ var file_v1_auth_service_proto_rawDesc = string([]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, 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, 0x19, 0x67, 0x6f,- 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,- 0x65, 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, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f,- 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b,- 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 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, 0x1a, 0x13, 0x76, 0x31, 0x2f, 0x61, 0x6e, 0x6e, 0x6f,- 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x76, 0x31,- 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x40, 0x0a,- 0x0e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,- 0x2e, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1a, 0xe2,- 0x41, 0x01, 0x02, 0xfa, 0x41, 0x13, 0x0a, 0x11, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,- 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22,- 0x71, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75,- 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65,- 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65,- 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02,- 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12,- 0x21, 0x0a, 0x0c, 0x73, 0x68, 0x6f, 0x77, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18,- 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x73, 0x68, 0x6f, 0x77, 0x44, 0x65, 0x6c, 0x65, 0x74,- 0x65, 0x64, 0x22, 0x64, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52,- 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73,- 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,- 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73,- 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f,- 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50,- 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x40, 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, 0x22, 0xa3, 0x02, 0x0a, 0x11, 0x55,- 0x70, 0x64, 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, 0x3b, 0x0a,- 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 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, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a,- 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x12, 0x1e, 0x0a, 0x08, 0x6f, 0x74,- 0x70, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07,- 0x6f, 0x74, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x88, 0x01, 0x01, 0x12, 0x3b, 0x0a, 0x1a, 0x72, 0x65,- 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x6d, 0x66,- 0x61, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x17,- 0x72, 0x65, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x4d, 0x66,- 0x61, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x3a, 0x0a, 0x19, 0x72, 0x65, 0x67, 0x65, 0x6e,- 0x65, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x5f, 0x63,- 0x6f, 0x64, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x17, 0x72, 0x65, 0x67, 0x65,- 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x43, 0x6f,- 0x64, 0x65, 0x73, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x6f, 0x74, 0x70, 0x5f, 0x63, 0x6f, 0x64, 0x65,- 0x22, 0x43, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65,- 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2e, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20,- 0x01, 0x28, 0x09, 0x42, 0x1a, 0xe2, 0x41, 0x01, 0x02, 0xfa, 0x41, 0x13, 0x0a, 0x11, 0x62, 0x79,- 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x55, 0x73, 0x65, 0x72, 0x52,- 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x45, 0x0a, 0x13, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x74,- 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2e, 0x0a, 0x04,- 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1a, 0xe2, 0x41, 0x01, 0x02,- 0xfa, 0x41, 0x13, 0x0a, 0x11, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x63, 0x6f,- 0x6d, 0x2f, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xdb, 0x02, 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, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x64, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20,- 0x01, 0x28, 0x09, 0x52, 0x07, 0x69, 0x64, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x45, 0x0a, 0x0b,- 0x69, 0x64, 0x70, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28,- 0x0b, 0x32, 0x24, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,- 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72,- 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, 0x0a, 0x69, 0x64, 0x70, 0x43, 0x6f, 0x6e, 0x74,- 0x65, 0x78, 0x74, 0x12, 0x1e, 0x0a, 0x08, 0x6f, 0x74, 0x70, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18,- 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x6f, 0x74, 0x70, 0x43, 0x6f, 0x64, 0x65,- 0x88, 0x01, 0x01, 0x12, 0x28, 0x0a, 0x0d, 0x72, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x5f,- 0x63, 0x6f, 0x64, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x0c, 0x72, 0x65,- 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x88, 0x01, 0x01, 0x12, 0x29, 0x0a,- 0x0e, 0x6d, 0x66, 0x61, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18,- 0x08, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x0c, 0x6d, 0x66, 0x61, 0x54, 0x65, 0x6d, 0x70,- 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x88, 0x01, 0x01, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x6f, 0x74, 0x70,- 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x42, 0x10, 0x0a, 0x0e, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x76, 0x65,- 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x42, 0x11, 0x0a, 0x0f, 0x5f, 0x6d, 0x66, 0x61, 0x5f,- 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xc8, 0x01, 0x0a, 0x17, 0x49,+ 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,+ 0x13, 0x76, 0x31, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70,+ 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65,+ 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xdb, 0x02, 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,+ 0x12, 0x19, 0x0a, 0x08, 0x69, 0x64, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01,+ 0x28, 0x09, 0x52, 0x07, 0x69, 0x64, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x45, 0x0a, 0x0b, 0x69,+ 0x64, 0x70, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b,+ 0x32, 0x24, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x49,0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43,- 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x53, 0x0a, 0x0e, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32,- 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a,- 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x41, 0x75,- 0x74, 0x68, 0x32, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69,- 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x0d, 0x6f, 0x61,- 0x75, 0x74, 0x68, 0x32, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x4d, 0x0a, 0x0c, 0x6f,- 0x69, 0x64, 0x63, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28,- 0x0b, 0x32, 0x28, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,- 0x4f, 0x49, 0x44, 0x43, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76,- 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x0b, 0x6f,- 0x69, 0x64, 0x63, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x63, 0x6f,- 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x33, 0x0a, 0x1d, 0x4f, 0x41, 0x75, 0x74, 0x68, 0x32, 0x49,- 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43,- 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01,- 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x1d, 0x0a, 0x1b, 0x4f, 0x49,- 0x44, 0x43, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64,- 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0xc0, 0x01, 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, 0x12, 0x29, 0x0a, 0x0e, 0x6d, 0x66, 0x61, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x74, 0x6f,- 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0c, 0x6d, 0x66, 0x61,- 0x54, 0x65, 0x6d, 0x70, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x34, 0x0a, 0x16,- 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x5f, 0x72, 0x65, 0x73, 0x65, 0x74, 0x5f, 0x70, 0x61,- 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x72, 0x65,- 0x71, 0x75, 0x69, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f,- 0x72, 0x64, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b,- 0x32, 0x11, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55,- 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x42, 0x11, 0x0a, 0x0f, 0x5f, 0x6d, 0x66,- 0x61, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x0f, 0x0a, 0x0d,- 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x8a, 0x05,- 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, 0x32, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x74,- 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x62, 0x79, 0x74, 0x65,- 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65,- 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x08, 0x70, 0x61,- 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41,- 0x01, 0x04, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x25, 0x0a, 0x0b,- 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28,- 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x04, 0x52, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,- 0x4b, 0x65, 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x66, 0x61, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c,- 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x6d, 0x66, 0x61, 0x45, 0x6e, 0x61,- 0x62, 0x6c, 0x65, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x66, 0x61, 0x5f, 0x73, 0x65, 0x63, 0x72,- 0x65, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x66, 0x61, 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, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x72, 0x65, 0x63,- 0x6f, 0x76, 0x65, 0x72, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68,- 0x6f, 0x6e, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65,- 0x12, 0x33, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28,- 0x0b, 0x32, 0x19, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,- 0x55, 0x73, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x07, 0x70, 0x72,- 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x1a, 0xbc, 0x01, 0x0a, 0x07, 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, 0x12, 0x16, 0x0a, 0x06,- 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x6f,- 0x75, 0x72, 0x63, 0x65, 0x3a, 0x24, 0xea, 0x41, 0x21, 0x0a, 0x11, 0x62, 0x79, 0x74, 0x65, 0x62,- 0x61, 0x73, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0c, 0x75, 0x73,- 0x65, 0x72, 0x73, 0x2f, 0x7b, 0x75, 0x73, 0x65, 0x72, 0x7d, 0x2a, 0x54, 0x0a, 0x08, 0x55, 0x73,- 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x15, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x54,- 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10,- 0x00, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x53, 0x45, 0x52, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x53,- 0x59, 0x53, 0x54, 0x45, 0x4d, 0x5f, 0x42, 0x4f, 0x54, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x53,- 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x5f, 0x41, 0x43, 0x43, 0x4f, 0x55, 0x4e, 0x54, 0x10, 0x03,- 0x32, 0xf7, 0x06, 0x0a, 0x0b, 0x41, 0x75, 0x74, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,- 0x12, 0x60, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1b, 0x2e, 0x62, 0x79,- 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 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, 0x25, 0xda, 0x41, 0x04,- 0x6e, 0x61, 0x6d, 0x65, 0x90, 0xea, 0x30, 0x02, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x12, 0x12,- 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f,- 0x2a, 0x7d, 0x12, 0x6a, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12,- 0x1d, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69,- 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e,- 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73,- 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1e,- 0xda, 0x41, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x90, 0xea, 0x30, 0x02, 0x82, 0xd3, 0xe4,- 0x93, 0x02, 0x0b, 0x12, 0x09, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, 0x6b,- 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,- 0x2a, 0xda, 0x41, 0x04, 0x75, 0x73, 0x65, 0x72, 0x80, 0xea, 0x30, 0x01, 0x90, 0xea, 0x30, 0x02,- 0x98, 0xea, 0x30, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x3a, 0x04, 0x75, 0x73, 0x65, 0x72,- 0x22, 0x09, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, 0x81, 0x01, 0x0a, 0x0a,- 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x62, 0x79, 0x74,- 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 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, 0x40, 0xda,- 0x41, 0x10, 0x75, 0x73, 0x65, 0x72, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61,- 0x73, 0x6b, 0x90, 0xea, 0x30, 0x02, 0x98, 0xea, 0x30, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f,- 0x3a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x32, 0x17, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x75, 0x73, 0x65,- 0x72, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x12,- 0x6f, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1e, 0x2e,- 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65,- 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 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, 0x29, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x90, 0xea,- 0x30, 0x02, 0x98, 0xea, 0x30, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x2a, 0x12, 0x2f, 0x76,- 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d,- 0x12, 0x73, 0x0a, 0x0c, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72,- 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55,- 0x6e, 0x64, 0x65, 0x6c, 0x65, 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, 0x2e, 0x90, 0xea, 0x30, 0x02, 0x98, 0xea, 0x30, 0x01, 0x82,- 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x3a, 0x01, 0x2a, 0x22, 0x1b, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e,- 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x75, 0x6e, 0x64,- 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x61, 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, 0x21, 0x80, 0xea, 0x30, 0x01, 0x98, 0xea, 0x30, 0x01, 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, 0x60, 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, 0x22, 0x80, 0xea, 0x30, 0x01, 0x98, 0xea, 0x30, 0x01,- 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,+ 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, 0x0a, 0x69, 0x64, 0x70, 0x43, 0x6f, 0x6e, 0x74, 0x65,+ 0x78, 0x74, 0x12, 0x1e, 0x0a, 0x08, 0x6f, 0x74, 0x70, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x06,+ 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x6f, 0x74, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x88,+ 0x01, 0x01, 0x12, 0x28, 0x0a, 0x0d, 0x72, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x5f, 0x63,+ 0x6f, 0x64, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x0c, 0x72, 0x65, 0x63,+ 0x6f, 0x76, 0x65, 0x72, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x88, 0x01, 0x01, 0x12, 0x29, 0x0a, 0x0e,+ 0x6d, 0x66, 0x61, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x08,+ 0x20, 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x0c, 0x6d, 0x66, 0x61, 0x54, 0x65, 0x6d, 0x70, 0x54,+ 0x6f, 0x6b, 0x65, 0x6e, 0x88, 0x01, 0x01, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x6f, 0x74, 0x70, 0x5f,+ 0x63, 0x6f, 0x64, 0x65, 0x42, 0x10, 0x0a, 0x0e, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72,+ 0x79, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x42, 0x11, 0x0a, 0x0f, 0x5f, 0x6d, 0x66, 0x61, 0x5f, 0x74,+ 0x65, 0x6d, 0x70, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xc8, 0x01, 0x0a, 0x17, 0x49, 0x64,+ 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f,+ 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x53, 0x0a, 0x0e, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x5f,+ 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e,+ 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x41, 0x75, 0x74,+ 0x68, 0x32, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64,+ 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x0d, 0x6f, 0x61, 0x75,+ 0x74, 0x68, 0x32, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x4d, 0x0a, 0x0c, 0x6f, 0x69,+ 0x64, 0x63, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,+ 0x32, 0x28, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4f,+ 0x49, 0x44, 0x43, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69,+ 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x0b, 0x6f, 0x69,+ 0x64, 0x63, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x63, 0x6f, 0x6e,+ 0x74, 0x65, 0x78, 0x74, 0x22, 0x33, 0x0a, 0x1d, 0x4f, 0x41, 0x75, 0x74, 0x68, 0x32, 0x49, 0x64,+ 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f,+ 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20,+ 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x1d, 0x0a, 0x1b, 0x4f, 0x49, 0x44,+ 0x43, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65,+ 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0xc0, 0x01, 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,+ 0x12, 0x29, 0x0a, 0x0e, 0x6d, 0x66, 0x61, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x74, 0x6f, 0x6b,+ 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0c, 0x6d, 0x66, 0x61, 0x54,+ 0x65, 0x6d, 0x70, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x34, 0x0a, 0x16, 0x72,+ 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x5f, 0x72, 0x65, 0x73, 0x65, 0x74, 0x5f, 0x70, 0x61, 0x73,+ 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x72, 0x65, 0x71,+ 0x75, 0x69, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72,+ 0x64, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32,+ 0x11, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73,+ 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x42, 0x11, 0x0a, 0x0f, 0x5f, 0x6d, 0x66, 0x61,+ 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x0f, 0x0a, 0x0d, 0x4c,+ 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x32, 0xd2, 0x01, 0x0a,+ 0x0b, 0x41, 0x75, 0x74, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x61, 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, 0x21, 0x80, 0xea,+ 0x30, 0x01, 0x98, 0xea, 0x30, 0x01, 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,+ 0x60, 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, 0x22, 0x80,+ 0xea, 0x30, 0x01, 0x98, 0xea, 0x30, 0x01, 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 (@@ -1287,65 +491,31 @@ func file_v1_auth_service_proto_rawDescGZIP() []byte {return file_v1_auth_service_proto_rawDescData}-var file_v1_auth_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)-var file_v1_auth_service_proto_msgTypes = make([]protoimpl.MessageInfo, 15)+var file_v1_auth_service_proto_msgTypes = make([]protoimpl.MessageInfo, 6)var file_v1_auth_service_proto_goTypes = []any{- (UserType)(0), // 0: bytebase.v1.UserType- (*GetUserRequest)(nil), // 1: bytebase.v1.GetUserRequest- (*ListUsersRequest)(nil), // 2: bytebase.v1.ListUsersRequest- (*ListUsersResponse)(nil), // 3: bytebase.v1.ListUsersResponse- (*CreateUserRequest)(nil), // 4: bytebase.v1.CreateUserRequest- (*UpdateUserRequest)(nil), // 5: bytebase.v1.UpdateUserRequest- (*DeleteUserRequest)(nil), // 6: bytebase.v1.DeleteUserRequest- (*UndeleteUserRequest)(nil), // 7: bytebase.v1.UndeleteUserRequest- (*LoginRequest)(nil), // 8: bytebase.v1.LoginRequest- (*IdentityProviderContext)(nil), // 9: bytebase.v1.IdentityProviderContext- (*OAuth2IdentityProviderContext)(nil), // 10: bytebase.v1.OAuth2IdentityProviderContext- (*OIDCIdentityProviderContext)(nil), // 11: bytebase.v1.OIDCIdentityProviderContext- (*LoginResponse)(nil), // 12: bytebase.v1.LoginResponse- (*LogoutRequest)(nil), // 13: bytebase.v1.LogoutRequest- (*User)(nil), // 14: bytebase.v1.User- (*User_Profile)(nil), // 15: bytebase.v1.User.Profile- (*fieldmaskpb.FieldMask)(nil), // 16: google.protobuf.FieldMask- (State)(0), // 17: bytebase.v1.State- (*timestamppb.Timestamp)(nil), // 18: google.protobuf.Timestamp- (*emptypb.Empty)(nil), // 19: google.protobuf.Empty+ (*LoginRequest)(nil), // 0: bytebase.v1.LoginRequest+ (*IdentityProviderContext)(nil), // 1: bytebase.v1.IdentityProviderContext+ (*OAuth2IdentityProviderContext)(nil), // 2: bytebase.v1.OAuth2IdentityProviderContext+ (*OIDCIdentityProviderContext)(nil), // 3: bytebase.v1.OIDCIdentityProviderContext+ (*LoginResponse)(nil), // 4: bytebase.v1.LoginResponse+ (*LogoutRequest)(nil), // 5: bytebase.v1.LogoutRequest+ (*User)(nil), // 6: bytebase.v1.User+ (*emptypb.Empty)(nil), // 7: google.protobuf.Empty}var file_v1_auth_service_proto_depIdxs = []int32{- 14, // 0: bytebase.v1.ListUsersResponse.users:type_name -> bytebase.v1.User- 14, // 1: bytebase.v1.CreateUserRequest.user:type_name -> bytebase.v1.User- 14, // 2: bytebase.v1.UpdateUserRequest.user:type_name -> bytebase.v1.User- 16, // 3: bytebase.v1.UpdateUserRequest.update_mask:type_name -> google.protobuf.FieldMask- 9, // 4: bytebase.v1.LoginRequest.idp_context:type_name -> bytebase.v1.IdentityProviderContext- 10, // 5: bytebase.v1.IdentityProviderContext.oauth2_context:type_name -> bytebase.v1.OAuth2IdentityProviderContext- 11, // 6: bytebase.v1.IdentityProviderContext.oidc_context:type_name -> bytebase.v1.OIDCIdentityProviderContext- 14, // 7: bytebase.v1.LoginResponse.user:type_name -> bytebase.v1.User- 17, // 8: bytebase.v1.User.state:type_name -> bytebase.v1.State- 0, // 9: bytebase.v1.User.user_type:type_name -> bytebase.v1.UserType- 15, // 10: bytebase.v1.User.profile:type_name -> bytebase.v1.User.Profile- 18, // 11: bytebase.v1.User.Profile.last_login_time:type_name -> google.protobuf.Timestamp- 18, // 12: bytebase.v1.User.Profile.last_change_password_time:type_name -> google.protobuf.Timestamp- 1, // 13: bytebase.v1.AuthService.GetUser:input_type -> bytebase.v1.GetUserRequest- 2, // 14: bytebase.v1.AuthService.ListUsers:input_type -> bytebase.v1.ListUsersRequest- 4, // 15: bytebase.v1.AuthService.CreateUser:input_type -> bytebase.v1.CreateUserRequest- 5, // 16: bytebase.v1.AuthService.UpdateUser:input_type -> bytebase.v1.UpdateUserRequest- 6, // 17: bytebase.v1.AuthService.DeleteUser:input_type -> bytebase.v1.DeleteUserRequest- 7, // 18: bytebase.v1.AuthService.UndeleteUser:input_type -> bytebase.v1.UndeleteUserRequest- 8, // 19: bytebase.v1.AuthService.Login:input_type -> bytebase.v1.LoginRequest- 13, // 20: bytebase.v1.AuthService.Logout:input_type -> bytebase.v1.LogoutRequest- 14, // 21: bytebase.v1.AuthService.GetUser:output_type -> bytebase.v1.User- 3, // 22: bytebase.v1.AuthService.ListUsers:output_type -> bytebase.v1.ListUsersResponse- 14, // 23: bytebase.v1.AuthService.CreateUser:output_type -> bytebase.v1.User- 14, // 24: bytebase.v1.AuthService.UpdateUser:output_type -> bytebase.v1.User- 19, // 25: bytebase.v1.AuthService.DeleteUser:output_type -> google.protobuf.Empty- 14, // 26: bytebase.v1.AuthService.UndeleteUser:output_type -> bytebase.v1.User- 12, // 27: bytebase.v1.AuthService.Login:output_type -> bytebase.v1.LoginResponse- 19, // 28: bytebase.v1.AuthService.Logout:output_type -> google.protobuf.Empty- 21, // [21:29] is the sub-list for method output_type- 13, // [13:21] is the sub-list for method input_type- 13, // [13:13] is the sub-list for extension type_name- 13, // [13:13] is the sub-list for extension extendee- 0, // [0:13] is the sub-list for field type_name+ 1, // 0: bytebase.v1.LoginRequest.idp_context:type_name -> bytebase.v1.IdentityProviderContext+ 2, // 1: bytebase.v1.IdentityProviderContext.oauth2_context:type_name -> bytebase.v1.OAuth2IdentityProviderContext+ 3, // 2: bytebase.v1.IdentityProviderContext.oidc_context:type_name -> bytebase.v1.OIDCIdentityProviderContext+ 6, // 3: bytebase.v1.LoginResponse.user:type_name -> bytebase.v1.User+ 0, // 4: bytebase.v1.AuthService.Login:input_type -> bytebase.v1.LoginRequest+ 5, // 5: bytebase.v1.AuthService.Logout:input_type -> bytebase.v1.LogoutRequest+ 4, // 6: bytebase.v1.AuthService.Login:output_type -> bytebase.v1.LoginResponse+ 7, // 7: bytebase.v1.AuthService.Logout:output_type -> google.protobuf.Empty+ 6, // [6:8] is the sub-list for method output_type+ 4, // [4:6] is the sub-list for method input_type+ 4, // [4:4] is the sub-list for extension type_name+ 4, // [4:4] is the sub-list for extension extendee+ 0, // [0:4] is the sub-list for field type_name}func init() { file_v1_auth_service_proto_init() }@@ -1354,27 +524,25 @@ func file_v1_auth_service_proto_init() {return}file_v1_annotation_proto_init()- file_v1_common_proto_init()- file_v1_auth_service_proto_msgTypes[4].OneofWrappers = []any{}- file_v1_auth_service_proto_msgTypes[7].OneofWrappers = []any{}- file_v1_auth_service_proto_msgTypes[8].OneofWrappers = []any{+ file_v1_user_service_proto_init()+ file_v1_auth_service_proto_msgTypes[0].OneofWrappers = []any{}+ file_v1_auth_service_proto_msgTypes[1].OneofWrappers = []any{(*IdentityProviderContext_Oauth2Context)(nil),(*IdentityProviderContext_OidcContext)(nil),}- file_v1_auth_service_proto_msgTypes[11].OneofWrappers = []any{}+ file_v1_auth_service_proto_msgTypes[4].OneofWrappers = []any{}type x struct{}out := protoimpl.TypeBuilder{File: protoimpl.DescBuilder{GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_auth_service_proto_rawDesc), len(file_v1_auth_service_proto_rawDesc)),- NumEnums: 1,- NumMessages: 15,+ NumEnums: 0,+ NumMessages: 6,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 264550ce6c..a91000ca83 100644--- a/proto/generated-go/v1/auth_service.pb.gw.go+++ b/proto/generated-go/v1/auth_service.pb.gw.go@@ -35,254 +35,6 @@ var (_ = metadata.Join)-func request_AuthService_GetUser_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {- var (- protoReq GetUserRequest- metadata runtime.ServerMetadata- err error- )- val, ok := pathParams["name"]- if !ok {- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")- }- protoReq.Name, err = runtime.String(val)- if err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)- }- msg, err := client.GetUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))- return msg, metadata, err-}--func local_request_AuthService_GetUser_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {- var (- protoReq GetUserRequest- metadata runtime.ServerMetadata- err error- )- val, ok := pathParams["name"]- if !ok {- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")- }- protoReq.Name, err = runtime.String(val)- if err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)- }- msg, err := server.GetUser(ctx, &protoReq)- return msg, metadata, err-}--var filter_AuthService_ListUsers_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}--func request_AuthService_ListUsers_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {- var (- protoReq ListUsersRequest- metadata runtime.ServerMetadata- )- if err := req.ParseForm(); err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)- }- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_AuthService_ListUsers_0); err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)- }- msg, err := client.ListUsers(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))- return msg, metadata, err-}--func local_request_AuthService_ListUsers_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {- var (- protoReq ListUsersRequest- metadata runtime.ServerMetadata- )- if err := req.ParseForm(); err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)- }- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_AuthService_ListUsers_0); err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)- }- msg, err := server.ListUsers(ctx, &protoReq)- return msg, metadata, err-}--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- metadata runtime.ServerMetadata- )- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.User); err != nil && !errors.Is(err, io.EOF) {- 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- metadata runtime.ServerMetadata- )- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.User); err != nil && !errors.Is(err, io.EOF) {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)- }- msg, err := server.CreateUser(ctx, &protoReq)- return msg, metadata, err-}--var filter_AuthService_UpdateUser_0 = &utilities.DoubleArray{Encoding: map[string]int{"user": 0, "name": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}}--func request_AuthService_UpdateUser_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {- var (- protoReq UpdateUserRequest- metadata runtime.ServerMetadata- err error- )- 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 && !errors.Is(err, io.EOF) {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)- }- if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {- if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.User); err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)- } else {- protoReq.UpdateMask = fieldMask- }- }- val, ok := pathParams["user.name"]- if !ok {- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "user.name")- }- err = runtime.PopulateFieldFromPath(&protoReq, "user.name", val)- if err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "user.name", 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_UpdateUser_0); err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)- }- msg, err := client.UpdateUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))- return msg, metadata, err-}--func local_request_AuthService_UpdateUser_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {- var (- protoReq UpdateUserRequest- metadata runtime.ServerMetadata- err error- )- 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 && !errors.Is(err, io.EOF) {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)- }- if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {- if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.User); err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)- } else {- protoReq.UpdateMask = fieldMask- }- }- val, ok := pathParams["user.name"]- if !ok {- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "user.name")- }- err = runtime.PopulateFieldFromPath(&protoReq, "user.name", val)- if err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "user.name", 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_UpdateUser_0); err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)- }- msg, err := server.UpdateUser(ctx, &protoReq)- return msg, metadata, err-}--func request_AuthService_DeleteUser_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {- var (- protoReq DeleteUserRequest- metadata runtime.ServerMetadata- err error- )- val, ok := pathParams["name"]- if !ok {- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")- }- protoReq.Name, err = runtime.String(val)- if err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)- }- msg, err := client.DeleteUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))- return msg, metadata, err-}--func local_request_AuthService_DeleteUser_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {- var (- protoReq DeleteUserRequest- metadata runtime.ServerMetadata- err error- )- val, ok := pathParams["name"]- if !ok {- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")- }- protoReq.Name, err = runtime.String(val)- if err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)- }- msg, err := server.DeleteUser(ctx, &protoReq)- return msg, metadata, err-}--func request_AuthService_UndeleteUser_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {- var (- protoReq UndeleteUserRequest- metadata runtime.ServerMetadata- err error- )- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)- }- val, ok := pathParams["name"]- if !ok {- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")- }- protoReq.Name, err = runtime.String(val)- if err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)- }- msg, err := client.UndeleteUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))- return msg, metadata, err-}--func local_request_AuthService_UndeleteUser_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {- var (- protoReq UndeleteUserRequest- metadata runtime.ServerMetadata- err error- )- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)- }- val, ok := pathParams["name"]- if !ok {- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")- }- protoReq.Name, err = runtime.String(val)- if err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)- }- msg, err := server.UndeleteUser(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 LoginRequest@@ -337,126 +89,6 @@ 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.// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.func RegisterAuthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AuthServiceServer) error {- mux.Handle(http.MethodGet, pattern_AuthService_GetUser_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)- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.AuthService/GetUser", runtime.WithHTTPPathPattern("/v1/{name=users/*}"))- if err != nil {- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)- return- }- resp, md, err := local_request_AuthService_GetUser_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_GetUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)- })- mux.Handle(http.MethodGet, pattern_AuthService_ListUsers_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)- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.AuthService/ListUsers", runtime.WithHTTPPathPattern("/v1/users"))- if err != nil {- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)- return- }- resp, md, err := local_request_AuthService_ListUsers_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_ListUsers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)- })- mux.Handle(http.MethodPost, 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)- 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(http.MethodPatch, pattern_AuthService_UpdateUser_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)- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.AuthService/UpdateUser", runtime.WithHTTPPathPattern("/v1/{user.name=users/*}"))- if err != nil {- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)- return- }- resp, md, err := local_request_AuthService_UpdateUser_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_UpdateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)- })- mux.Handle(http.MethodDelete, pattern_AuthService_DeleteUser_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)- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.AuthService/DeleteUser", runtime.WithHTTPPathPattern("/v1/{name=users/*}"))- if err != nil {- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)- return- }- resp, md, err := local_request_AuthService_DeleteUser_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_DeleteUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)- })- mux.Handle(http.MethodPost, pattern_AuthService_UndeleteUser_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)- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.AuthService/UndeleteUser", runtime.WithHTTPPathPattern("/v1/{name=users/*}:undelete"))- if err != nil {- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)- return- }- resp, md, err := local_request_AuthService_UndeleteUser_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_UndeleteUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)- })mux.Handle(http.MethodPost, pattern_AuthService_Login_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {ctx, cancel := context.WithCancel(req.Context())defer cancel()@@ -537,108 +169,6 @@ func RegisterAuthServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in// "AuthServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares.func RegisterAuthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AuthServiceClient) error {- mux.Handle(http.MethodGet, pattern_AuthService_GetUser_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)- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.AuthService/GetUser", runtime.WithHTTPPathPattern("/v1/{name=users/*}"))- if err != nil {- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)- return- }- resp, md, err := request_AuthService_GetUser_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_GetUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)- })- mux.Handle(http.MethodGet, pattern_AuthService_ListUsers_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)- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.AuthService/ListUsers", runtime.WithHTTPPathPattern("/v1/users"))- if err != nil {- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)- return- }- resp, md, err := request_AuthService_ListUsers_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_ListUsers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)- })- mux.Handle(http.MethodPost, 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)- 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(http.MethodPatch, pattern_AuthService_UpdateUser_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)- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.AuthService/UpdateUser", runtime.WithHTTPPathPattern("/v1/{user.name=users/*}"))- if err != nil {- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)- return- }- resp, md, err := request_AuthService_UpdateUser_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_UpdateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)- })- mux.Handle(http.MethodDelete, pattern_AuthService_DeleteUser_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)- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.AuthService/DeleteUser", runtime.WithHTTPPathPattern("/v1/{name=users/*}"))- if err != nil {- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)- return- }- resp, md, err := request_AuthService_DeleteUser_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_DeleteUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)- })- mux.Handle(http.MethodPost, pattern_AuthService_UndeleteUser_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)- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.AuthService/UndeleteUser", runtime.WithHTTPPathPattern("/v1/{name=users/*}:undelete"))- if err != nil {- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)- return- }- resp, md, err := request_AuthService_UndeleteUser_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_UndeleteUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)- })mux.Handle(http.MethodPost, pattern_AuthService_Login_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {ctx, cancel := context.WithCancel(req.Context())defer cancel()@@ -677,23 +207,11 @@ func RegisterAuthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux}var (- pattern_AuthService_GetUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "users", "name"}, ""))- pattern_AuthService_ListUsers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "users"}, ""))- pattern_AuthService_CreateUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "users"}, ""))- pattern_AuthService_UpdateUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "users", "user.name"}, ""))- pattern_AuthService_DeleteUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "users", "name"}, ""))- pattern_AuthService_UndeleteUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "users", "name"}, "undelete"))- 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"}, ""))+ 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_GetUser_0 = runtime.ForwardResponseMessage- forward_AuthService_ListUsers_0 = runtime.ForwardResponseMessage- forward_AuthService_CreateUser_0 = runtime.ForwardResponseMessage- forward_AuthService_UpdateUser_0 = runtime.ForwardResponseMessage- forward_AuthService_DeleteUser_0 = runtime.ForwardResponseMessage- forward_AuthService_UndeleteUser_0 = runtime.ForwardResponseMessage- forward_AuthService_Login_0 = runtime.ForwardResponseMessage- forward_AuthService_Logout_0 = runtime.ForwardResponseMessage+ forward_AuthService_Login_0 = runtime.ForwardResponseMessage+ forward_AuthService_Logout_0 = runtime.ForwardResponseMessage)diff --git a/proto/generated-go/v1/auth_service_grpc.pb.go b/proto/generated-go/v1/auth_service_grpc.pb.goindex 820ad7b5b0..283344b766 100644--- a/proto/generated-go/v1/auth_service_grpc.pb.go+++ b/proto/generated-go/v1/auth_service_grpc.pb.go@@ -20,37 +20,14 @@ import (const _ = grpc.SupportPackageIsVersion9const (- AuthService_GetUser_FullMethodName = "/bytebase.v1.AuthService/GetUser"- AuthService_ListUsers_FullMethodName = "/bytebase.v1.AuthService/ListUsers"- AuthService_CreateUser_FullMethodName = "/bytebase.v1.AuthService/CreateUser"- AuthService_UpdateUser_FullMethodName = "/bytebase.v1.AuthService/UpdateUser"- AuthService_DeleteUser_FullMethodName = "/bytebase.v1.AuthService/DeleteUser"- AuthService_UndeleteUser_FullMethodName = "/bytebase.v1.AuthService/UndeleteUser"- AuthService_Login_FullMethodName = "/bytebase.v1.AuthService/Login"- AuthService_Logout_FullMethodName = "/bytebase.v1.AuthService/Logout"+ AuthService_Login_FullMethodName = "/bytebase.v1.AuthService/Login"+ AuthService_Logout_FullMethodName = "/bytebase.v1.AuthService/Logout")// AuthServiceClient is the client API for AuthService 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.type AuthServiceClient interface {- // Get the user.- // Any authenticated user can get the user.- GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*User, error)- // List all users.- // Any authenticated user can list users.- ListUsers(ctx context.Context, in *ListUsersRequest, opts ...grpc.CallOption) (*ListUsersResponse, error)- // Create a user.- // When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user.- // Otherwise, any unauthenticated user can create a user.- CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*User, error)- // Only the user itself and the user with bb.users.update permission on the workspace can update the user.- UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*User, error)- // Only the user with bb.users.delete permission on the workspace can delete the user.- // The last remaining workspace admin cannot be deleted.- DeleteUser(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)- // Only the user with bb.users.undelete permission on the workspace can undelete the user.- UndeleteUser(ctx context.Context, in *UndeleteUserRequest, 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)}@@ -63,66 +40,6 @@ func NewAuthServiceClient(cc grpc.ClientConnInterface) AuthServiceClient {return &authServiceClient{cc}}-func (c *authServiceClient) GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*User, error) {- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)- out := new(User)- err := c.cc.Invoke(ctx, AuthService_GetUser_FullMethodName, in, out, cOpts...)- if err != nil {- return nil, err- }- return out, nil-}--func (c *authServiceClient) ListUsers(ctx context.Context, in *ListUsersRequest, opts ...grpc.CallOption) (*ListUsersResponse, error) {- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)- out := new(ListUsersResponse)- err := c.cc.Invoke(ctx, AuthService_ListUsers_FullMethodName, in, out, cOpts...)- if err != nil {- return nil, err- }- return out, nil-}--func (c *authServiceClient) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*User, error) {- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)- out := new(User)- err := c.cc.Invoke(ctx, AuthService_CreateUser_FullMethodName, in, out, cOpts...)- if err != nil {- return nil, err- }- return out, nil-}--func (c *authServiceClient) UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*User, error) {- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)- out := new(User)- err := c.cc.Invoke(ctx, AuthService_UpdateUser_FullMethodName, in, out, cOpts...)- if err != nil {- return nil, err- }- return out, nil-}--func (c *authServiceClient) DeleteUser(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)- out := new(emptypb.Empty)- err := c.cc.Invoke(ctx, AuthService_DeleteUser_FullMethodName, in, out, cOpts...)- if err != nil {- return nil, err- }- return out, nil-}--func (c *authServiceClient) UndeleteUser(ctx context.Context, in *UndeleteUserRequest, opts ...grpc.CallOption) (*User, error) {- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)- out := new(User)- err := c.cc.Invoke(ctx, AuthService_UndeleteUser_FullMethodName, in, out, cOpts...)- if err != nil {- return nil, err- }- return out, nil-}-func (c *authServiceClient) Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error) {cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)out := new(LoginResponse)@@ -147,23 +64,6 @@ func (c *authServiceClient) Logout(ctx context.Context, in *LogoutRequest, opts// All implementations must embed UnimplementedAuthServiceServer// for forward compatibility.type AuthServiceServer interface {- // Get the user.- // Any authenticated user can get the user.- GetUser(context.Context, *GetUserRequest) (*User, error)- // List all users.- // Any authenticated user can list users.- ListUsers(context.Context, *ListUsersRequest) (*ListUsersResponse, error)- // Create a user.- // When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user.- // Otherwise, any unauthenticated user can create a user.- CreateUser(context.Context, *CreateUserRequest) (*User, error)- // Only the user itself and the user with bb.users.update permission on the workspace can update the user.- UpdateUser(context.Context, *UpdateUserRequest) (*User, error)- // Only the user with bb.users.delete permission on the workspace can delete the user.- // The last remaining workspace admin cannot be deleted.- DeleteUser(context.Context, *DeleteUserRequest) (*emptypb.Empty, error)- // Only the user with bb.users.undelete permission on the workspace can undelete the user.- UndeleteUser(context.Context, *UndeleteUserRequest) (*User, error)Login(context.Context, *LoginRequest) (*LoginResponse, error)Logout(context.Context, *LogoutRequest) (*emptypb.Empty, error)mustEmbedUnimplementedAuthServiceServer()@@ -176,24 +76,6 @@ type AuthServiceServer interface {// pointer dereference when methods are called.type UnimplementedAuthServiceServer struct{}-func (UnimplementedAuthServiceServer) GetUser(context.Context, *GetUserRequest) (*User, error) {- return nil, status.Errorf(codes.Unimplemented, "method GetUser not implemented")-}-func (UnimplementedAuthServiceServer) ListUsers(context.Context, *ListUsersRequest) (*ListUsersResponse, error) {- return nil, status.Errorf(codes.Unimplemented, "method ListUsers not implemented")-}-func (UnimplementedAuthServiceServer) CreateUser(context.Context, *CreateUserRequest) (*User, error) {- return nil, status.Errorf(codes.Unimplemented, "method CreateUser not implemented")-}-func (UnimplementedAuthServiceServer) UpdateUser(context.Context, *UpdateUserRequest) (*User, error) {- return nil, status.Errorf(codes.Unimplemented, "method UpdateUser not implemented")-}-func (UnimplementedAuthServiceServer) DeleteUser(context.Context, *DeleteUserRequest) (*emptypb.Empty, error) {- return nil, status.Errorf(codes.Unimplemented, "method DeleteUser not implemented")-}-func (UnimplementedAuthServiceServer) UndeleteUser(context.Context, *UndeleteUserRequest) (*User, error) {- return nil, status.Errorf(codes.Unimplemented, "method UndeleteUser not implemented")-}func (UnimplementedAuthServiceServer) Login(context.Context, *LoginRequest) (*LoginResponse, error) {return nil, status.Errorf(codes.Unimplemented, "method Login not implemented")}@@ -221,114 +103,6 @@ func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer) {s.RegisterService(&AuthService_ServiceDesc, srv)}-func _AuthService_GetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {- in := new(GetUserRequest)- if err := dec(in); err != nil {- return nil, err- }- if interceptor == nil {- return srv.(AuthServiceServer).GetUser(ctx, in)- }- info := &grpc.UnaryServerInfo{- Server: srv,- FullMethod: AuthService_GetUser_FullMethodName,- }- handler := func(ctx context.Context, req interface{}) (interface{}, error) {- return srv.(AuthServiceServer).GetUser(ctx, req.(*GetUserRequest))- }- return interceptor(ctx, in, info, handler)-}--func _AuthService_ListUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {- in := new(ListUsersRequest)- if err := dec(in); err != nil {- return nil, err- }- if interceptor == nil {- return srv.(AuthServiceServer).ListUsers(ctx, in)- }- info := &grpc.UnaryServerInfo{- Server: srv,- FullMethod: AuthService_ListUsers_FullMethodName,- }- handler := func(ctx context.Context, req interface{}) (interface{}, error) {- return srv.(AuthServiceServer).ListUsers(ctx, req.(*ListUsersRequest))- }- return interceptor(ctx, in, info, handler)-}--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: AuthService_CreateUser_FullMethodName,- }- handler := func(ctx context.Context, req interface{}) (interface{}, error) {- return srv.(AuthServiceServer).CreateUser(ctx, req.(*CreateUserRequest))- }- return interceptor(ctx, in, info, handler)-}--func _AuthService_UpdateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {- in := new(UpdateUserRequest)- if err := dec(in); err != nil {- return nil, err- }- if interceptor == nil {- return srv.(AuthServiceServer).UpdateUser(ctx, in)- }- info := &grpc.UnaryServerInfo{- Server: srv,- FullMethod: AuthService_UpdateUser_FullMethodName,- }- handler := func(ctx context.Context, req interface{}) (interface{}, error) {- return srv.(AuthServiceServer).UpdateUser(ctx, req.(*UpdateUserRequest))- }- return interceptor(ctx, in, info, handler)-}--func _AuthService_DeleteUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {- in := new(DeleteUserRequest)- if err := dec(in); err != nil {- return nil, err- }- if interceptor == nil {- return srv.(AuthServiceServer).DeleteUser(ctx, in)- }- info := &grpc.UnaryServerInfo{- Server: srv,- FullMethod: AuthService_DeleteUser_FullMethodName,- }- handler := func(ctx context.Context, req interface{}) (interface{}, error) {- return srv.(AuthServiceServer).DeleteUser(ctx, req.(*DeleteUserRequest))- }- return interceptor(ctx, in, info, handler)-}--func _AuthService_UndeleteUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {- in := new(UndeleteUserRequest)- if err := dec(in); err != nil {- return nil, err- }- if interceptor == nil {- return srv.(AuthServiceServer).UndeleteUser(ctx, in)- }- info := &grpc.UnaryServerInfo{- Server: srv,- FullMethod: AuthService_UndeleteUser_FullMethodName,- }- handler := func(ctx context.Context, req interface{}) (interface{}, error) {- return srv.(AuthServiceServer).UndeleteUser(ctx, req.(*UndeleteUserRequest))- }- 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 {@@ -372,30 +146,6 @@ var AuthService_ServiceDesc = grpc.ServiceDesc{ServiceName: "bytebase.v1.AuthService",HandlerType: (*AuthServiceServer)(nil),Methods: []grpc.MethodDesc{- {- MethodName: "GetUser",- Handler: _AuthService_GetUser_Handler,- },- {- MethodName: "ListUsers",- Handler: _AuthService_ListUsers_Handler,- },- {- MethodName: "CreateUser",- Handler: _AuthService_CreateUser_Handler,- },- {- MethodName: "UpdateUser",- Handler: _AuthService_UpdateUser_Handler,- },- {- MethodName: "DeleteUser",- Handler: _AuthService_DeleteUser_Handler,- },- {- MethodName: "UndeleteUser",- Handler: _AuthService_UndeleteUser_Handler,- },{MethodName: "Login",Handler: _AuthService_Login_Handler,diff --git a/proto/generated-go/v1/user_service.pb.go b/proto/generated-go/v1/user_service.pb.gonew file mode 100644index 0000000000..245f1f595c--- /dev/null+++ b/proto/generated-go/v1/user_service.pb.go@@ -0,0 +1,923 @@+// Code generated by protoc-gen-go. DO NOT EDIT.+// versions:+// protoc-gen-go v1.36.5+// protoc (unknown)+// source: v1/user_service.proto++package v1++import (+ _ "google.golang.org/genproto/googleapis/api/annotations"+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"+ emptypb "google.golang.org/protobuf/types/known/emptypb"+ fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"+ timestamppb "google.golang.org/protobuf/types/known/timestamppb"+ reflect "reflect"+ sync "sync"+ unsafe "unsafe"+)++const (+ // Verify that this generated code is sufficiently up-to-date.+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)+ // Verify that runtime/protoimpl is sufficiently up-to-date.+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)+)++type UserType int32++const (+ UserType_USER_TYPE_UNSPECIFIED UserType = 0+ UserType_USER UserType = 1+ UserType_SYSTEM_BOT UserType = 2+ UserType_SERVICE_ACCOUNT UserType = 3+)++// Enum value maps for UserType.+var (+ UserType_name = map[int32]string{+ 0: "USER_TYPE_UNSPECIFIED",+ 1: "USER",+ 2: "SYSTEM_BOT",+ 3: "SERVICE_ACCOUNT",+ }+ UserType_value = map[string]int32{+ "USER_TYPE_UNSPECIFIED": 0,+ "USER": 1,+ "SYSTEM_BOT": 2,+ "SERVICE_ACCOUNT": 3,+ }+)++func (x UserType) Enum() *UserType {+ p := new(UserType)+ *p = x+ return p+}++func (x UserType) String() string {+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))+}++func (UserType) Descriptor() protoreflect.EnumDescriptor {+ return file_v1_user_service_proto_enumTypes[0].Descriptor()+}++func (UserType) Type() protoreflect.EnumType {+ return &file_v1_user_service_proto_enumTypes[0]+}++func (x UserType) Number() protoreflect.EnumNumber {+ return protoreflect.EnumNumber(x)+}++// Deprecated: Use UserType.Descriptor instead.+func (UserType) EnumDescriptor() ([]byte, []int) {+ return file_v1_user_service_proto_rawDescGZIP(), []int{0}+}++type GetUserRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // The name of the user to retrieve.+ // Format: users/{user uid or user email}+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *GetUserRequest) Reset() {+ *x = GetUserRequest{}+ mi := &file_v1_user_service_proto_msgTypes[0]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *GetUserRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*GetUserRequest) ProtoMessage() {}++func (x *GetUserRequest) ProtoReflect() protoreflect.Message {+ mi := &file_v1_user_service_proto_msgTypes[0]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use GetUserRequest.ProtoReflect.Descriptor instead.+func (*GetUserRequest) Descriptor() ([]byte, []int) {+ return file_v1_user_service_proto_rawDescGZIP(), []int{0}+}++func (x *GetUserRequest) GetName() string {+ if x != nil {+ return x.Name+ }+ return ""+}++type ListUsersRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // Not used.+ // The maximum number of users to return. The service may return fewer than+ // this value.+ // If unspecified, at most 50 users will be returned.+ // The maximum value is 1000; values above 1000 will be coerced to 1000.+ PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`+ // Not used.+ // A page token, received from a previous `ListUsers` call.+ // Provide this to retrieve the subsequent page.+ //+ // When paginating, all other parameters provided to `ListUsers` must match+ // the call that provided the page token.+ PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`+ // Show deleted users if specified.+ ShowDeleted bool `protobuf:"varint,3,opt,name=show_deleted,json=showDeleted,proto3" json:"show_deleted,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *ListUsersRequest) Reset() {+ *x = ListUsersRequest{}+ mi := &file_v1_user_service_proto_msgTypes[1]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *ListUsersRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*ListUsersRequest) ProtoMessage() {}++func (x *ListUsersRequest) ProtoReflect() protoreflect.Message {+ mi := &file_v1_user_service_proto_msgTypes[1]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use ListUsersRequest.ProtoReflect.Descriptor instead.+func (*ListUsersRequest) Descriptor() ([]byte, []int) {+ return file_v1_user_service_proto_rawDescGZIP(), []int{1}+}++func (x *ListUsersRequest) GetPageSize() int32 {+ if x != nil {+ return x.PageSize+ }+ return 0+}++func (x *ListUsersRequest) GetPageToken() string {+ if x != nil {+ return x.PageToken+ }+ return ""+}++func (x *ListUsersRequest) GetShowDeleted() bool {+ if x != nil {+ return x.ShowDeleted+ }+ return false+}++type ListUsersResponse struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // The users from the specified request.+ Users []*User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"`+ // A token, which can be sent as `page_token` to retrieve the next page.+ // If this field is omitted, there are no subsequent pages.+ NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *ListUsersResponse) Reset() {+ *x = ListUsersResponse{}+ mi := &file_v1_user_service_proto_msgTypes[2]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *ListUsersResponse) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*ListUsersResponse) ProtoMessage() {}++func (x *ListUsersResponse) ProtoReflect() protoreflect.Message {+ mi := &file_v1_user_service_proto_msgTypes[2]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use ListUsersResponse.ProtoReflect.Descriptor instead.+func (*ListUsersResponse) Descriptor() ([]byte, []int) {+ return file_v1_user_service_proto_rawDescGZIP(), []int{2}+}++func (x *ListUsersResponse) GetUsers() []*User {+ if x != nil {+ return x.Users+ }+ return nil+}++func (x *ListUsersResponse) GetNextPageToken() string {+ if x != nil {+ return x.NextPageToken+ }+ return ""+}++type CreateUserRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // The user to create.+ User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *CreateUserRequest) Reset() {+ *x = CreateUserRequest{}+ mi := &file_v1_user_service_proto_msgTypes[3]+ 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_user_service_proto_msgTypes[3]+ if 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_user_service_proto_rawDescGZIP(), []int{3}+}++func (x *CreateUserRequest) GetUser() *User {+ if x != nil {+ return x.User+ }+ return nil+}++type UpdateUserRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // The user to update.+ //+ // The user's `name` field is used to identify the user to update.+ // Format: users/{user}+ User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`+ // The list of fields to update.+ UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`+ // The otp_code is used to verify the user's identity by MFA.+ OtpCode *string `protobuf:"bytes,3,opt,name=otp_code,json=otpCode,proto3,oneof" json:"otp_code,omitempty"`+ // The regenerate_temp_mfa_secret flag means to regenerate temporary MFA secret for user.+ // This is used for MFA setup. The temporary MFA secret and recovery codes will be returned in the response.+ RegenerateTempMfaSecret bool `protobuf:"varint,4,opt,name=regenerate_temp_mfa_secret,json=regenerateTempMfaSecret,proto3" json:"regenerate_temp_mfa_secret,omitempty"`+ // The regenerate_recovery_codes flag means to regenerate recovery codes for user.+ RegenerateRecoveryCodes bool `protobuf:"varint,5,opt,name=regenerate_recovery_codes,json=regenerateRecoveryCodes,proto3" json:"regenerate_recovery_codes,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *UpdateUserRequest) Reset() {+ *x = UpdateUserRequest{}+ mi := &file_v1_user_service_proto_msgTypes[4]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *UpdateUserRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*UpdateUserRequest) ProtoMessage() {}++func (x *UpdateUserRequest) ProtoReflect() protoreflect.Message {+ mi := &file_v1_user_service_proto_msgTypes[4]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use UpdateUserRequest.ProtoReflect.Descriptor instead.+func (*UpdateUserRequest) Descriptor() ([]byte, []int) {+ return file_v1_user_service_proto_rawDescGZIP(), []int{4}+}++func (x *UpdateUserRequest) GetUser() *User {+ if x != nil {+ return x.User+ }+ return nil+}++func (x *UpdateUserRequest) GetUpdateMask() *fieldmaskpb.FieldMask {+ if x != nil {+ return x.UpdateMask+ }+ return nil+}++func (x *UpdateUserRequest) GetOtpCode() string {+ if x != nil && x.OtpCode != nil {+ return *x.OtpCode+ }+ return ""+}++func (x *UpdateUserRequest) GetRegenerateTempMfaSecret() bool {+ if x != nil {+ return x.RegenerateTempMfaSecret+ }+ return false+}++func (x *UpdateUserRequest) GetRegenerateRecoveryCodes() bool {+ if x != nil {+ return x.RegenerateRecoveryCodes+ }+ return false+}++type DeleteUserRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // The name of the user to delete.+ // Format: users/{user}+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *DeleteUserRequest) Reset() {+ *x = DeleteUserRequest{}+ mi := &file_v1_user_service_proto_msgTypes[5]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *DeleteUserRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*DeleteUserRequest) ProtoMessage() {}++func (x *DeleteUserRequest) ProtoReflect() protoreflect.Message {+ mi := &file_v1_user_service_proto_msgTypes[5]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use DeleteUserRequest.ProtoReflect.Descriptor instead.+func (*DeleteUserRequest) Descriptor() ([]byte, []int) {+ return file_v1_user_service_proto_rawDescGZIP(), []int{5}+}++func (x *DeleteUserRequest) GetName() string {+ if x != nil {+ return x.Name+ }+ return ""+}++type UndeleteUserRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // The name of the deleted user.+ // Format: users/{user}+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *UndeleteUserRequest) Reset() {+ *x = UndeleteUserRequest{}+ mi := &file_v1_user_service_proto_msgTypes[6]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *UndeleteUserRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*UndeleteUserRequest) ProtoMessage() {}++func (x *UndeleteUserRequest) ProtoReflect() protoreflect.Message {+ mi := &file_v1_user_service_proto_msgTypes[6]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use UndeleteUserRequest.ProtoReflect.Descriptor instead.+func (*UndeleteUserRequest) Descriptor() ([]byte, []int) {+ return file_v1_user_service_proto_rawDescGZIP(), []int{6}+}++func (x *UndeleteUserRequest) GetName() string {+ if x != nil {+ return x.Name+ }+ return ""+}++type User struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // 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"`+ UserType UserType `protobuf:"varint,5,opt,name=user_type,json=userType,proto3,enum=bytebase.v1.UserType" json:"user_type,omitempty"`+ Password string `protobuf:"bytes,7,opt,name=password,proto3" json:"password,omitempty"`+ ServiceKey string `protobuf:"bytes,8,opt,name=service_key,json=serviceKey,proto3" json:"service_key,omitempty"`+ // The mfa_enabled flag means if the user has enabled MFA.+ MfaEnabled bool `protobuf:"varint,9,opt,name=mfa_enabled,json=mfaEnabled,proto3" json:"mfa_enabled,omitempty"`+ // The mfa_secret is the temporary secret using in two phase verification.+ MfaSecret string `protobuf:"bytes,10,opt,name=mfa_secret,json=mfaSecret,proto3" json:"mfa_secret,omitempty"`+ // The recovery_codes is the temporary recovery codes using in two phase verification.+ RecoveryCodes []string `protobuf:"bytes,11,rep,name=recovery_codes,json=recoveryCodes,proto3" json:"recovery_codes,omitempty"`+ // Should be a valid E.164 compliant phone number.+ // Could be empty.+ Phone string `protobuf:"bytes,12,opt,name=phone,proto3" json:"phone,omitempty"`+ Profile *User_Profile `protobuf:"bytes,13,opt,name=profile,proto3" json:"profile,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *User) Reset() {+ *x = User{}+ mi := &file_v1_user_service_proto_msgTypes[7]+ 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_user_service_proto_msgTypes[7]+ if 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_user_service_proto_rawDescGZIP(), []int{7}+}++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) GetUserType() UserType {+ if x != nil {+ return x.UserType+ }+ return UserType_USER_TYPE_UNSPECIFIED+}++func (x *User) GetPassword() string {+ if x != nil {+ return x.Password+ }+ return ""+}++func (x *User) GetServiceKey() string {+ if x != nil {+ return x.ServiceKey+ }+ return ""+}++func (x *User) GetMfaEnabled() bool {+ if x != nil {+ return x.MfaEnabled+ }+ return false+}++func (x *User) GetMfaSecret() string {+ if x != nil {+ return x.MfaSecret+ }+ return ""+}++func (x *User) GetRecoveryCodes() []string {+ if x != nil {+ return x.RecoveryCodes+ }+ return nil+}++func (x *User) GetPhone() string {+ if x != nil {+ return x.Phone+ }+ return ""+}++func (x *User) GetProfile() *User_Profile {+ if x != nil {+ return x.Profile+ }+ return nil+}++type User_Profile struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ 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"`+ // source means where the user comes from. For now we support Entra ID SCIM sync, so the source could be Entra ID.+ Source string `protobuf:"bytes,3,opt,name=source,proto3" json:"source,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *User_Profile) Reset() {+ *x = User_Profile{}+ mi := &file_v1_user_service_proto_msgTypes[8]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *User_Profile) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*User_Profile) ProtoMessage() {}++func (x *User_Profile) ProtoReflect() protoreflect.Message {+ mi := &file_v1_user_service_proto_msgTypes[8]+ if 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_Profile.ProtoReflect.Descriptor instead.+func (*User_Profile) Descriptor() ([]byte, []int) {+ return file_v1_user_service_proto_rawDescGZIP(), []int{7, 0}+}++func (x *User_Profile) GetLastLoginTime() *timestamppb.Timestamp {+ if x != nil {+ return x.LastLoginTime+ }+ return nil+}++func (x *User_Profile) GetLastChangePasswordTime() *timestamppb.Timestamp {+ if x != nil {+ return x.LastChangePasswordTime+ }+ return nil+}++func (x *User_Profile) GetSource() string {+ if x != nil {+ return x.Source+ }+ return ""+}++var File_v1_user_service_proto protoreflect.FileDescriptor++var file_v1_user_service_proto_rawDesc = string([]byte{+ 0x0a, 0x15, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,+ 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, 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, 0x19, 0x67, 0x6f,+ 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,+ 0x65, 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, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f,+ 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b,+ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 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, 0x1a, 0x13, 0x76, 0x31, 0x2f, 0x61, 0x6e, 0x6e, 0x6f,+ 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x76, 0x31,+ 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x40, 0x0a,+ 0x0e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,+ 0x2e, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1a, 0xe2,+ 0x41, 0x01, 0x02, 0xfa, 0x41, 0x13, 0x0a, 0x11, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,+ 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22,+ 0x71, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75,+ 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65,+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65,+ 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02,+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12,+ 0x21, 0x0a, 0x0c, 0x73, 0x68, 0x6f, 0x77, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18,+ 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x73, 0x68, 0x6f, 0x77, 0x44, 0x65, 0x6c, 0x65, 0x74,+ 0x65, 0x64, 0x22, 0x64, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52,+ 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73,+ 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,+ 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73,+ 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f,+ 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50,+ 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x40, 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, 0x22, 0xa3, 0x02, 0x0a, 0x11, 0x55,+ 0x70, 0x64, 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, 0x3b, 0x0a,+ 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 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, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a,+ 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x12, 0x1e, 0x0a, 0x08, 0x6f, 0x74,+ 0x70, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07,+ 0x6f, 0x74, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x88, 0x01, 0x01, 0x12, 0x3b, 0x0a, 0x1a, 0x72, 0x65,+ 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x6d, 0x66,+ 0x61, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x17,+ 0x72, 0x65, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x4d, 0x66,+ 0x61, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x3a, 0x0a, 0x19, 0x72, 0x65, 0x67, 0x65, 0x6e,+ 0x65, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x5f, 0x63,+ 0x6f, 0x64, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x17, 0x72, 0x65, 0x67, 0x65,+ 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x43, 0x6f,+ 0x64, 0x65, 0x73, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x6f, 0x74, 0x70, 0x5f, 0x63, 0x6f, 0x64, 0x65,+ 0x22, 0x43, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65,+ 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2e, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20,+ 0x01, 0x28, 0x09, 0x42, 0x1a, 0xe2, 0x41, 0x01, 0x02, 0xfa, 0x41, 0x13, 0x0a, 0x11, 0x62, 0x79,+ 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x55, 0x73, 0x65, 0x72, 0x52,+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x45, 0x0a, 0x13, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x74,+ 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2e, 0x0a, 0x04,+ 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1a, 0xe2, 0x41, 0x01, 0x02,+ 0xfa, 0x41, 0x13, 0x0a, 0x11, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x63, 0x6f,+ 0x6d, 0x2f, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x8a, 0x05, 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, 0x32, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x74, 0x79,+ 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52,+ 0x08, 0x75, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x08, 0x70, 0x61, 0x73,+ 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01,+ 0x04, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x25, 0x0a, 0x0b, 0x73,+ 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09,+ 0x42, 0x04, 0xe2, 0x41, 0x01, 0x04, 0x52, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4b,+ 0x65, 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x66, 0x61, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65,+ 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x6d, 0x66, 0x61, 0x45, 0x6e, 0x61, 0x62,+ 0x6c, 0x65, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x66, 0x61, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65,+ 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x66, 0x61, 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, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x72, 0x65, 0x63, 0x6f,+ 0x76, 0x65, 0x72, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68, 0x6f,+ 0x6e, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12,+ 0x33, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b,+ 0x32, 0x19, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55,+ 0x73, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x07, 0x70, 0x72, 0x6f,+ 0x66, 0x69, 0x6c, 0x65, 0x1a, 0xbc, 0x01, 0x0a, 0x07, 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, 0x12, 0x16, 0x0a, 0x06, 0x73,+ 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x6f, 0x75,+ 0x72, 0x63, 0x65, 0x3a, 0x24, 0xea, 0x41, 0x21, 0x0a, 0x11, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,+ 0x73, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0c, 0x75, 0x73, 0x65,+ 0x72, 0x73, 0x2f, 0x7b, 0x75, 0x73, 0x65, 0x72, 0x7d, 0x2a, 0x54, 0x0a, 0x08, 0x55, 0x73, 0x65,+ 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x15, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x54, 0x59,+ 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00,+ 0x12, 0x08, 0x0a, 0x04, 0x55, 0x53, 0x45, 0x52, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x59,+ 0x53, 0x54, 0x45, 0x4d, 0x5f, 0x42, 0x4f, 0x54, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x45,+ 0x52, 0x56, 0x49, 0x43, 0x45, 0x5f, 0x41, 0x43, 0x43, 0x4f, 0x55, 0x4e, 0x54, 0x10, 0x03, 0x32,+ 0xb2, 0x05, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,+ 0x60, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1b, 0x2e, 0x62, 0x79, 0x74,+ 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 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, 0x25, 0xda, 0x41, 0x04, 0x6e,+ 0x61, 0x6d, 0x65, 0x90, 0xea, 0x30, 0x02, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x12, 0x12, 0x2f,+ 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a,+ 0x7d, 0x12, 0x6a, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x1d,+ 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73,+ 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e,+ 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74,+ 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1e, 0xda,+ 0x41, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x90, 0xea, 0x30, 0x02, 0x82, 0xd3, 0xe4, 0x93,+ 0x02, 0x0b, 0x12, 0x09, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, 0x6b, 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, 0x2a,+ 0xda, 0x41, 0x04, 0x75, 0x73, 0x65, 0x72, 0x80, 0xea, 0x30, 0x01, 0x90, 0xea, 0x30, 0x02, 0x98,+ 0xea, 0x30, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x3a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22,+ 0x09, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, 0x81, 0x01, 0x0a, 0x0a, 0x55,+ 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65,+ 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 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, 0x40, 0xda, 0x41,+ 0x10, 0x75, 0x73, 0x65, 0x72, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73,+ 0x6b, 0x90, 0xea, 0x30, 0x02, 0x98, 0xea, 0x30, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x3a,+ 0x04, 0x75, 0x73, 0x65, 0x72, 0x32, 0x17, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x75, 0x73, 0x65, 0x72,+ 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x6f,+ 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x62,+ 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74,+ 0x65, 0x55, 0x73, 0x65, 0x72, 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, 0x29, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x90, 0xea, 0x30,+ 0x02, 0x98, 0xea, 0x30, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x2a, 0x12, 0x2f, 0x76, 0x31,+ 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x12,+ 0x73, 0x0a, 0x0c, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12,+ 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x6e,+ 0x64, 0x65, 0x6c, 0x65, 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, 0x2e, 0x90, 0xea, 0x30, 0x02, 0x98, 0xea, 0x30, 0x01, 0x82, 0xd3,+ 0xe4, 0x93, 0x02, 0x20, 0x3a, 0x01, 0x2a, 0x22, 0x1b, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61,+ 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x75, 0x6e, 0x64, 0x65,+ 0x6c, 0x65, 0x74, 0x65, 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 (+ file_v1_user_service_proto_rawDescOnce sync.Once+ file_v1_user_service_proto_rawDescData []byte+)++func file_v1_user_service_proto_rawDescGZIP() []byte {+ file_v1_user_service_proto_rawDescOnce.Do(func() {+ file_v1_user_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_v1_user_service_proto_rawDesc), len(file_v1_user_service_proto_rawDesc)))+ })+ return file_v1_user_service_proto_rawDescData+}++var file_v1_user_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)+var file_v1_user_service_proto_msgTypes = make([]protoimpl.MessageInfo, 9)+var file_v1_user_service_proto_goTypes = []any{+ (UserType)(0), // 0: bytebase.v1.UserType+ (*GetUserRequest)(nil), // 1: bytebase.v1.GetUserRequest+ (*ListUsersRequest)(nil), // 2: bytebase.v1.ListUsersRequest+ (*ListUsersResponse)(nil), // 3: bytebase.v1.ListUsersResponse+ (*CreateUserRequest)(nil), // 4: bytebase.v1.CreateUserRequest+ (*UpdateUserRequest)(nil), // 5: bytebase.v1.UpdateUserRequest+ (*DeleteUserRequest)(nil), // 6: bytebase.v1.DeleteUserRequest+ (*UndeleteUserRequest)(nil), // 7: bytebase.v1.UndeleteUserRequest+ (*User)(nil), // 8: bytebase.v1.User+ (*User_Profile)(nil), // 9: bytebase.v1.User.Profile+ (*fieldmaskpb.FieldMask)(nil), // 10: google.protobuf.FieldMask+ (State)(0), // 11: bytebase.v1.State+ (*timestamppb.Timestamp)(nil), // 12: google.protobuf.Timestamp+ (*emptypb.Empty)(nil), // 13: google.protobuf.Empty+}+var file_v1_user_service_proto_depIdxs = []int32{+ 8, // 0: bytebase.v1.ListUsersResponse.users:type_name -> bytebase.v1.User+ 8, // 1: bytebase.v1.CreateUserRequest.user:type_name -> bytebase.v1.User+ 8, // 2: bytebase.v1.UpdateUserRequest.user:type_name -> bytebase.v1.User+ 10, // 3: bytebase.v1.UpdateUserRequest.update_mask:type_name -> google.protobuf.FieldMask+ 11, // 4: bytebase.v1.User.state:type_name -> bytebase.v1.State+ 0, // 5: bytebase.v1.User.user_type:type_name -> bytebase.v1.UserType+ 9, // 6: bytebase.v1.User.profile:type_name -> bytebase.v1.User.Profile+ 12, // 7: bytebase.v1.User.Profile.last_login_time:type_name -> google.protobuf.Timestamp+ 12, // 8: bytebase.v1.User.Profile.last_change_password_time:type_name -> google.protobuf.Timestamp+ 1, // 9: bytebase.v1.UserService.GetUser:input_type -> bytebase.v1.GetUserRequest+ 2, // 10: bytebase.v1.UserService.ListUsers:input_type -> bytebase.v1.ListUsersRequest+ 4, // 11: bytebase.v1.UserService.CreateUser:input_type -> bytebase.v1.CreateUserRequest+ 5, // 12: bytebase.v1.UserService.UpdateUser:input_type -> bytebase.v1.UpdateUserRequest+ 6, // 13: bytebase.v1.UserService.DeleteUser:input_type -> bytebase.v1.DeleteUserRequest+ 7, // 14: bytebase.v1.UserService.UndeleteUser:input_type -> bytebase.v1.UndeleteUserRequest+ 8, // 15: bytebase.v1.UserService.GetUser:output_type -> bytebase.v1.User+ 3, // 16: bytebase.v1.UserService.ListUsers:output_type -> bytebase.v1.ListUsersResponse+ 8, // 17: bytebase.v1.UserService.CreateUser:output_type -> bytebase.v1.User+ 8, // 18: bytebase.v1.UserService.UpdateUser:output_type -> bytebase.v1.User+ 13, // 19: bytebase.v1.UserService.DeleteUser:output_type -> google.protobuf.Empty+ 8, // 20: bytebase.v1.UserService.UndeleteUser:output_type -> bytebase.v1.User+ 15, // [15:21] is the sub-list for method output_type+ 9, // [9:15] is the sub-list for method input_type+ 9, // [9:9] is the sub-list for extension type_name+ 9, // [9:9] is the sub-list for extension extendee+ 0, // [0:9] is the sub-list for field type_name+}++func init() { file_v1_user_service_proto_init() }+func file_v1_user_service_proto_init() {+ if File_v1_user_service_proto != nil {+ return+ }+ file_v1_annotation_proto_init()+ file_v1_common_proto_init()+ file_v1_user_service_proto_msgTypes[4].OneofWrappers = []any{}+ type x struct{}+ out := protoimpl.TypeBuilder{+ File: protoimpl.DescBuilder{+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),+ RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_user_service_proto_rawDesc), len(file_v1_user_service_proto_rawDesc)),+ NumEnums: 1,+ NumMessages: 9,+ NumExtensions: 0,+ NumServices: 1,+ },+ GoTypes: file_v1_user_service_proto_goTypes,+ DependencyIndexes: file_v1_user_service_proto_depIdxs,+ EnumInfos: file_v1_user_service_proto_enumTypes,+ MessageInfos: file_v1_user_service_proto_msgTypes,+ }.Build()+ File_v1_user_service_proto = out.File+ file_v1_user_service_proto_goTypes = nil+ file_v1_user_service_proto_depIdxs = nil+}diff --git a/proto/generated-go/v1/user_service.pb.gw.go b/proto/generated-go/v1/user_service.pb.gw.gonew file mode 100644index 0000000000..b1c7dcfbe4--- /dev/null+++ b/proto/generated-go/v1/user_service.pb.gw.go@@ -0,0 +1,573 @@+// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.+// source: v1/user_service.proto++/*+Package v1 is a reverse proxy.++It translates gRPC into RESTful JSON APIs.+*/+package v1++import (+ "context"+ "errors"+ "io"+ "net/http"++ "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"+ "github.com/grpc-ecosystem/grpc-gateway/v2/utilities"+ "google.golang.org/grpc"+ "google.golang.org/grpc/codes"+ "google.golang.org/grpc/grpclog"+ "google.golang.org/grpc/metadata"+ "google.golang.org/grpc/status"+ "google.golang.org/protobuf/proto"+)++// Suppress "imported and not used" errors+var (+ _ codes.Code+ _ io.Reader+ _ status.Status+ _ = errors.New+ _ = runtime.String+ _ = utilities.NewDoubleArray+ _ = metadata.Join+)++func request_UserService_GetUser_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var (+ protoReq GetUserRequest+ metadata runtime.ServerMetadata+ err error+ )+ val, ok := pathParams["name"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")+ }+ protoReq.Name, err = runtime.String(val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)+ }+ msg, err := client.GetUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))+ return msg, metadata, err+}++func local_request_UserService_GetUser_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var (+ protoReq GetUserRequest+ metadata runtime.ServerMetadata+ err error+ )+ val, ok := pathParams["name"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")+ }+ protoReq.Name, err = runtime.String(val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)+ }+ msg, err := server.GetUser(ctx, &protoReq)+ return msg, metadata, err+}++var filter_UserService_ListUsers_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}++func request_UserService_ListUsers_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var (+ protoReq ListUsersRequest+ metadata runtime.ServerMetadata+ )+ if err := req.ParseForm(); err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_ListUsers_0); err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }+ msg, err := client.ListUsers(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))+ return msg, metadata, err+}++func local_request_UserService_ListUsers_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var (+ protoReq ListUsersRequest+ metadata runtime.ServerMetadata+ )+ if err := req.ParseForm(); err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_ListUsers_0); err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }+ msg, err := server.ListUsers(ctx, &protoReq)+ return msg, metadata, err+}++func request_UserService_CreateUser_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var (+ protoReq CreateUserRequest+ metadata runtime.ServerMetadata+ )+ if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.User); err != nil && !errors.Is(err, io.EOF) {+ 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_UserService_CreateUser_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var (+ protoReq CreateUserRequest+ metadata runtime.ServerMetadata+ )+ if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.User); err != nil && !errors.Is(err, io.EOF) {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }+ msg, err := server.CreateUser(ctx, &protoReq)+ return msg, metadata, err+}++var filter_UserService_UpdateUser_0 = &utilities.DoubleArray{Encoding: map[string]int{"user": 0, "name": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}}++func request_UserService_UpdateUser_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var (+ protoReq UpdateUserRequest+ metadata runtime.ServerMetadata+ err error+ )+ 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 && !errors.Is(err, io.EOF) {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }+ if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {+ if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.User); err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ } else {+ protoReq.UpdateMask = fieldMask+ }+ }+ val, ok := pathParams["user.name"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "user.name")+ }+ err = runtime.PopulateFieldFromPath(&protoReq, "user.name", val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "user.name", err)+ }+ if err := req.ParseForm(); err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_UpdateUser_0); err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }+ msg, err := client.UpdateUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))+ return msg, metadata, err+}++func local_request_UserService_UpdateUser_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var (+ protoReq UpdateUserRequest+ metadata runtime.ServerMetadata+ err error+ )+ 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 && !errors.Is(err, io.EOF) {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }+ if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {+ if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.User); err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ } else {+ protoReq.UpdateMask = fieldMask+ }+ }+ val, ok := pathParams["user.name"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "user.name")+ }+ err = runtime.PopulateFieldFromPath(&protoReq, "user.name", val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "user.name", err)+ }+ if err := req.ParseForm(); err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_UpdateUser_0); err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }+ msg, err := server.UpdateUser(ctx, &protoReq)+ return msg, metadata, err+}++func request_UserService_DeleteUser_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var (+ protoReq DeleteUserRequest+ metadata runtime.ServerMetadata+ err error+ )+ val, ok := pathParams["name"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")+ }+ protoReq.Name, err = runtime.String(val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)+ }+ msg, err := client.DeleteUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))+ return msg, metadata, err+}++func local_request_UserService_DeleteUser_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var (+ protoReq DeleteUserRequest+ metadata runtime.ServerMetadata+ err error+ )+ val, ok := pathParams["name"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")+ }+ protoReq.Name, err = runtime.String(val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)+ }+ msg, err := server.DeleteUser(ctx, &protoReq)+ return msg, metadata, err+}++func request_UserService_UndeleteUser_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var (+ protoReq UndeleteUserRequest+ metadata runtime.ServerMetadata+ err error+ )+ if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }+ val, ok := pathParams["name"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")+ }+ protoReq.Name, err = runtime.String(val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)+ }+ msg, err := client.UndeleteUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))+ return msg, metadata, err+}++func local_request_UserService_UndeleteUser_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var (+ protoReq UndeleteUserRequest+ metadata runtime.ServerMetadata+ err error+ )+ if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }+ val, ok := pathParams["name"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")+ }+ protoReq.Name, err = runtime.String(val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)+ }+ msg, err := server.UndeleteUser(ctx, &protoReq)+ return msg, metadata, err+}++// RegisterUserServiceHandlerServer registers the http handlers for service UserService to "mux".+// UnaryRPC :call UserServiceServer directly.+// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.+// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterUserServiceHandlerFromEndpoint instead.+// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.+func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserServiceServer) error {+ mux.Handle(http.MethodGet, pattern_UserService_GetUser_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)+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.UserService/GetUser", runtime.WithHTTPPathPattern("/v1/{name=users/*}"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := local_request_UserService_GetUser_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_UserService_GetUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)+ })+ mux.Handle(http.MethodGet, pattern_UserService_ListUsers_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)+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.UserService/ListUsers", runtime.WithHTTPPathPattern("/v1/users"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := local_request_UserService_ListUsers_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_UserService_ListUsers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)+ })+ mux.Handle(http.MethodPost, pattern_UserService_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)+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.UserService/CreateUser", runtime.WithHTTPPathPattern("/v1/users"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := local_request_UserService_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_UserService_CreateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)+ })+ mux.Handle(http.MethodPatch, pattern_UserService_UpdateUser_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)+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.UserService/UpdateUser", runtime.WithHTTPPathPattern("/v1/{user.name=users/*}"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := local_request_UserService_UpdateUser_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_UserService_UpdateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)+ })+ mux.Handle(http.MethodDelete, pattern_UserService_DeleteUser_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)+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.UserService/DeleteUser", runtime.WithHTTPPathPattern("/v1/{name=users/*}"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := local_request_UserService_DeleteUser_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_UserService_DeleteUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)+ })+ mux.Handle(http.MethodPost, pattern_UserService_UndeleteUser_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)+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.UserService/UndeleteUser", runtime.WithHTTPPathPattern("/v1/{name=users/*}:undelete"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := local_request_UserService_UndeleteUser_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_UserService_UndeleteUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)+ })++ return nil+}++// RegisterUserServiceHandlerFromEndpoint is same as RegisterUserServiceHandler but+// automatically dials to "endpoint" and closes the connection when "ctx" gets done.+func RegisterUserServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {+ conn, err := grpc.NewClient(endpoint, opts...)+ if err != nil {+ return err+ }+ defer func() {+ if err != nil {+ if cerr := conn.Close(); cerr != nil {+ grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)+ }+ return+ }+ go func() {+ <-ctx.Done()+ if cerr := conn.Close(); cerr != nil {+ grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)+ }+ }()+ }()+ return RegisterUserServiceHandler(ctx, mux, conn)+}++// RegisterUserServiceHandler registers the http handlers for service UserService to "mux".+// The handlers forward requests to the grpc endpoint over "conn".+func RegisterUserServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {+ return RegisterUserServiceHandlerClient(ctx, mux, NewUserServiceClient(conn))+}++// RegisterUserServiceHandlerClient registers the http handlers for service UserService+// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UserServiceClient".+// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UserServiceClient"+// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in+// "UserServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares.+func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserServiceClient) error {+ mux.Handle(http.MethodGet, pattern_UserService_GetUser_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)+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.UserService/GetUser", runtime.WithHTTPPathPattern("/v1/{name=users/*}"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := request_UserService_GetUser_0(annotatedContext, inboundMarshaler, client, req, pathParams)+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)+ if err != nil {+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)+ return+ }+ forward_UserService_GetUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)+ })+ mux.Handle(http.MethodGet, pattern_UserService_ListUsers_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)+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.UserService/ListUsers", runtime.WithHTTPPathPattern("/v1/users"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := request_UserService_ListUsers_0(annotatedContext, inboundMarshaler, client, req, pathParams)+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)+ if err != nil {+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)+ return+ }+ forward_UserService_ListUsers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)+ })+ mux.Handle(http.MethodPost, pattern_UserService_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)+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.UserService/CreateUser", runtime.WithHTTPPathPattern("/v1/users"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := request_UserService_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_UserService_CreateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)+ })+ mux.Handle(http.MethodPatch, pattern_UserService_UpdateUser_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)+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.UserService/UpdateUser", runtime.WithHTTPPathPattern("/v1/{user.name=users/*}"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := request_UserService_UpdateUser_0(annotatedContext, inboundMarshaler, client, req, pathParams)+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)+ if err != nil {+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)+ return+ }+ forward_UserService_UpdateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)+ })+ mux.Handle(http.MethodDelete, pattern_UserService_DeleteUser_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)+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.UserService/DeleteUser", runtime.WithHTTPPathPattern("/v1/{name=users/*}"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := request_UserService_DeleteUser_0(annotatedContext, inboundMarshaler, client, req, pathParams)+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)+ if err != nil {+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)+ return+ }+ forward_UserService_DeleteUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)+ })+ mux.Handle(http.MethodPost, pattern_UserService_UndeleteUser_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)+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.UserService/UndeleteUser", runtime.WithHTTPPathPattern("/v1/{name=users/*}:undelete"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := request_UserService_UndeleteUser_0(annotatedContext, inboundMarshaler, client, req, pathParams)+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)+ if err != nil {+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)+ return+ }+ forward_UserService_UndeleteUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)+ })+ return nil+}++var (+ pattern_UserService_GetUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "users", "name"}, ""))+ pattern_UserService_ListUsers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "users"}, ""))+ pattern_UserService_CreateUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "users"}, ""))+ pattern_UserService_UpdateUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "users", "user.name"}, ""))+ pattern_UserService_DeleteUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "users", "name"}, ""))+ pattern_UserService_UndeleteUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "users", "name"}, "undelete"))+)++var (+ forward_UserService_GetUser_0 = runtime.ForwardResponseMessage+ forward_UserService_ListUsers_0 = runtime.ForwardResponseMessage+ forward_UserService_CreateUser_0 = runtime.ForwardResponseMessage+ forward_UserService_UpdateUser_0 = runtime.ForwardResponseMessage+ forward_UserService_DeleteUser_0 = runtime.ForwardResponseMessage+ forward_UserService_UndeleteUser_0 = runtime.ForwardResponseMessage+)diff --git a/proto/generated-go/v1/user_service_grpc.pb.go b/proto/generated-go/v1/user_service_grpc.pb.gonew file mode 100644index 0000000000..8bf7378714--- /dev/null+++ b/proto/generated-go/v1/user_service_grpc.pb.go@@ -0,0 +1,334 @@+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.+// versions:+// - protoc-gen-go-grpc v1.5.1+// - protoc (unknown)+// source: v1/user_service.proto++package v1++import (+ context "context"+ grpc "google.golang.org/grpc"+ codes "google.golang.org/grpc/codes"+ status "google.golang.org/grpc/status"+ emptypb "google.golang.org/protobuf/types/known/emptypb"+)++// This is a compile-time assertion to ensure that this generated file+// is compatible with the grpc package it is being compiled against.+// Requires gRPC-Go v1.64.0 or later.+const _ = grpc.SupportPackageIsVersion9++const (+ UserService_GetUser_FullMethodName = "/bytebase.v1.UserService/GetUser"+ UserService_ListUsers_FullMethodName = "/bytebase.v1.UserService/ListUsers"+ UserService_CreateUser_FullMethodName = "/bytebase.v1.UserService/CreateUser"+ UserService_UpdateUser_FullMethodName = "/bytebase.v1.UserService/UpdateUser"+ UserService_DeleteUser_FullMethodName = "/bytebase.v1.UserService/DeleteUser"+ UserService_UndeleteUser_FullMethodName = "/bytebase.v1.UserService/UndeleteUser"+)++// 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.+type UserServiceClient interface {+ // Get the user.+ // Any authenticated user can get the user.+ GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*User, error)+ // List all users.+ // Any authenticated user can list users.+ ListUsers(ctx context.Context, in *ListUsersRequest, opts ...grpc.CallOption) (*ListUsersResponse, error)+ // Create a user.+ // When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user.+ // Otherwise, any unauthenticated user can create a user.+ CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*User, error)+ // Only the user itself and the user with bb.users.update permission on the workspace can update the user.+ UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*User, error)+ // Only the user with bb.users.delete permission on the workspace can delete the user.+ // The last remaining workspace admin cannot be deleted.+ DeleteUser(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)+ // Only the user with bb.users.undelete permission on the workspace can undelete the user.+ UndeleteUser(ctx context.Context, in *UndeleteUserRequest, opts ...grpc.CallOption) (*User, error)+}++type userServiceClient struct {+ cc grpc.ClientConnInterface+}++func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient {+ return &userServiceClient{cc}+}++func (c *userServiceClient) GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*User, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(User)+ err := c.cc.Invoke(ctx, UserService_GetUser_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *userServiceClient) ListUsers(ctx context.Context, in *ListUsersRequest, opts ...grpc.CallOption) (*ListUsersResponse, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(ListUsersResponse)+ err := c.cc.Invoke(ctx, UserService_ListUsers_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *userServiceClient) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*User, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(User)+ err := c.cc.Invoke(ctx, UserService_CreateUser_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *userServiceClient) UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*User, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(User)+ err := c.cc.Invoke(ctx, UserService_UpdateUser_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *userServiceClient) DeleteUser(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(emptypb.Empty)+ err := c.cc.Invoke(ctx, UserService_DeleteUser_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++func (c *userServiceClient) UndeleteUser(ctx context.Context, in *UndeleteUserRequest, opts ...grpc.CallOption) (*User, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(User)+ err := c.cc.Invoke(ctx, UserService_UndeleteUser_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}++// UserServiceServer is the server API for UserService service.+// All implementations must embed UnimplementedUserServiceServer+// for forward compatibility.+type UserServiceServer interface {+ // Get the user.+ // Any authenticated user can get the user.+ GetUser(context.Context, *GetUserRequest) (*User, error)+ // List all users.+ // Any authenticated user can list users.+ ListUsers(context.Context, *ListUsersRequest) (*ListUsersResponse, error)+ // Create a user.+ // When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user.+ // Otherwise, any unauthenticated user can create a user.+ CreateUser(context.Context, *CreateUserRequest) (*User, error)+ // Only the user itself and the user with bb.users.update permission on the workspace can update the user.+ UpdateUser(context.Context, *UpdateUserRequest) (*User, error)+ // Only the user with bb.users.delete permission on the workspace can delete the user.+ // The last remaining workspace admin cannot be deleted.+ DeleteUser(context.Context, *DeleteUserRequest) (*emptypb.Empty, error)+ // Only the user with bb.users.undelete permission on the workspace can undelete the user.+ UndeleteUser(context.Context, *UndeleteUserRequest) (*User, error)+ mustEmbedUnimplementedUserServiceServer()+}++// UnimplementedUserServiceServer must be embedded to have+// forward compatible implementations.+//+// NOTE: this should be embedded by value instead of pointer to avoid a nil+// pointer dereference when methods are called.+type UnimplementedUserServiceServer struct{}++func (UnimplementedUserServiceServer) GetUser(context.Context, *GetUserRequest) (*User, error) {+ return nil, status.Errorf(codes.Unimplemented, "method GetUser not implemented")+}+func (UnimplementedUserServiceServer) ListUsers(context.Context, *ListUsersRequest) (*ListUsersResponse, error) {+ return nil, status.Errorf(codes.Unimplemented, "method ListUsers not implemented")+}+func (UnimplementedUserServiceServer) CreateUser(context.Context, *CreateUserRequest) (*User, error) {+ return nil, status.Errorf(codes.Unimplemented, "method CreateUser not implemented")+}+func (UnimplementedUserServiceServer) UpdateUser(context.Context, *UpdateUserRequest) (*User, error) {+ return nil, status.Errorf(codes.Unimplemented, "method UpdateUser not implemented")+}+func (UnimplementedUserServiceServer) DeleteUser(context.Context, *DeleteUserRequest) (*emptypb.Empty, error) {+ return nil, status.Errorf(codes.Unimplemented, "method DeleteUser not implemented")+}+func (UnimplementedUserServiceServer) UndeleteUser(context.Context, *UndeleteUserRequest) (*User, error) {+ return nil, status.Errorf(codes.Unimplemented, "method UndeleteUser not implemented")+}+func (UnimplementedUserServiceServer) mustEmbedUnimplementedUserServiceServer() {}+func (UnimplementedUserServiceServer) testEmbeddedByValue() {}++// 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 UnsafeUserServiceServer interface {+ mustEmbedUnimplementedUserServiceServer()+}++func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer) {+ // If the following call pancis, it indicates UnimplementedUserServiceServer was+ // embedded by pointer and is nil. This will cause panics if an+ // unimplemented method is ever invoked, so we test this at initialization+ // time to prevent it from happening at runtime later due to I/O.+ if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {+ t.testEmbeddedByValue()+ }+ s.RegisterService(&UserService_ServiceDesc, srv)+}++func _UserService_GetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(GetUserRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(UserServiceServer).GetUser(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: UserService_GetUser_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(UserServiceServer).GetUser(ctx, req.(*GetUserRequest))+ }+ return interceptor(ctx, in, info, handler)+}++func _UserService_ListUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(ListUsersRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(UserServiceServer).ListUsers(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: UserService_ListUsers_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(UserServiceServer).ListUsers(ctx, req.(*ListUsersRequest))+ }+ return interceptor(ctx, in, info, handler)+}++func _UserService_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.(UserServiceServer).CreateUser(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: UserService_CreateUser_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(UserServiceServer).CreateUser(ctx, req.(*CreateUserRequest))+ }+ return interceptor(ctx, in, info, handler)+}++func _UserService_UpdateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(UpdateUserRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(UserServiceServer).UpdateUser(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: UserService_UpdateUser_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(UserServiceServer).UpdateUser(ctx, req.(*UpdateUserRequest))+ }+ return interceptor(ctx, in, info, handler)+}++func _UserService_DeleteUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(DeleteUserRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(UserServiceServer).DeleteUser(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: UserService_DeleteUser_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(UserServiceServer).DeleteUser(ctx, req.(*DeleteUserRequest))+ }+ return interceptor(ctx, in, info, handler)+}++func _UserService_UndeleteUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(UndeleteUserRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(UserServiceServer).UndeleteUser(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: UserService_UndeleteUser_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(UserServiceServer).UndeleteUser(ctx, req.(*UndeleteUserRequest))+ }+ return interceptor(ctx, in, info, handler)+}++// UserService_ServiceDesc is the grpc.ServiceDesc for UserService service.+// It's only intended for direct use with grpc.RegisterService,+// and not to be introspected or modified (even as a copy)+var UserService_ServiceDesc = grpc.ServiceDesc{+ ServiceName: "bytebase.v1.UserService",+ HandlerType: (*UserServiceServer)(nil),+ Methods: []grpc.MethodDesc{+ {+ MethodName: "GetUser",+ Handler: _UserService_GetUser_Handler,+ },+ {+ MethodName: "ListUsers",+ Handler: _UserService_ListUsers_Handler,+ },+ {+ MethodName: "CreateUser",+ Handler: _UserService_CreateUser_Handler,+ },+ {+ MethodName: "UpdateUser",+ Handler: _UserService_UpdateUser_Handler,+ },+ {+ MethodName: "DeleteUser",+ Handler: _UserService_DeleteUser_Handler,+ },+ {+ MethodName: "UndeleteUser",+ Handler: _UserService_UndeleteUser_Handler,+ },+ },+ Streams: []grpc.StreamDesc{},+ Metadata: "v1/user_service.proto",+}diff --git a/proto/v1/auth_service.proto b/proto/v1/auth_service.protoindex bc5d453b2a..5a8debd286 100644--- a/proto/v1/auth_service.proto+++ b/proto/v1/auth_service.proto@@ -3,78 +3,13 @@ syntax = "proto3";package bytebase.v1;import "google/api/annotations.proto";-import "google/api/client.proto";-import "google/api/field_behavior.proto";-import "google/api/resource.proto";import "google/protobuf/empty.proto";-import "google/protobuf/field_mask.proto";-import "google/protobuf/timestamp.proto";import "v1/annotation.proto";-import "v1/common.proto";+import "v1/user_service.proto";option go_package = "generated-go/v1";service AuthService {- // Get the user.- // Any authenticated user can get the user.- rpc GetUser(GetUserRequest) returns (User) {- option (google.api.http) = {get: "/v1/{name=users/*}"};- option (google.api.method_signature) = "name";- option (bytebase.v1.auth_method) = CUSTOM;- }-- // List all users.- // Any authenticated user can list users.- rpc ListUsers(ListUsersRequest) returns (ListUsersResponse) {- option (google.api.http) = {get: "/v1/users"};- option (google.api.method_signature) = "parent";- option (bytebase.v1.auth_method) = CUSTOM;- }-- // Create a user.- // When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user.- // Otherwise, any unauthenticated user can create a user.- rpc CreateUser(CreateUserRequest) returns (User) {- option (google.api.http) = {- post: "/v1/users"- body: "user"- };- option (google.api.method_signature) = "user";- option (bytebase.v1.allow_without_credential) = true;- option (bytebase.v1.auth_method) = CUSTOM;- option (bytebase.v1.audit) = true;- }-- // Only the user itself and the user with bb.users.update permission on the workspace can update the user.- rpc UpdateUser(UpdateUserRequest) returns (User) {- option (google.api.http) = {- patch: "/v1/{user.name=users/*}"- body: "user"- };- option (google.api.method_signature) = "user,update_mask";- option (bytebase.v1.auth_method) = CUSTOM;- option (bytebase.v1.audit) = true;- }-- // Only the user with bb.users.delete permission on the workspace can delete the user.- // The last remaining workspace admin cannot be deleted.- rpc DeleteUser(DeleteUserRequest) returns (google.protobuf.Empty) {- option (google.api.http) = {delete: "/v1/{name=users/*}"};- option (google.api.method_signature) = "name";- option (bytebase.v1.auth_method) = CUSTOM;- option (bytebase.v1.audit) = true;- }-- // Only the user with bb.users.undelete permission on the workspace can undelete the user.- rpc UndeleteUser(UndeleteUserRequest) returns (User) {- option (google.api.http) = {- post: "/v1/{name=users/*}:undelete"- body: "*"- };- option (bytebase.v1.auth_method) = CUSTOM;- option (bytebase.v1.audit) = true;- }-rpc Login(LoginRequest) returns (LoginResponse) {option (google.api.http) = {post: "/v1/auth/login"@@ -94,88 +29,6 @@ service AuthService {}}-message GetUserRequest {- // The name of the user to retrieve.- // Format: users/{user uid or user email}- string name = 1 [- (google.api.field_behavior) = REQUIRED,- (google.api.resource_reference) = {type: "bytebase.com/User"}- ];-}--message ListUsersRequest {- // Not used.- // The maximum number of users to return. The service may return fewer than- // this value.- // If unspecified, at most 50 users will be returned.- // The maximum value is 1000; values above 1000 will be coerced to 1000.- int32 page_size = 1;-- // Not used.- // A page token, received from a previous `ListUsers` call.- // Provide this to retrieve the subsequent page.- //- // When paginating, all other parameters provided to `ListUsers` must match- // the call that provided the page token.- string page_token = 2;-- // Show deleted users if specified.- bool show_deleted = 3;-}--message ListUsersResponse {- // The users from the specified request.- repeated User users = 1;-- // A token, which can be sent as `page_token` to retrieve the next page.- // If this field is omitted, there are no subsequent pages.- string next_page_token = 2;-}--message CreateUserRequest {- // The user to create.- User user = 1 [(google.api.field_behavior) = REQUIRED];-}--message UpdateUserRequest {- // The user to update.- //- // The user's `name` field is used to identify the user to update.- // Format: users/{user}- User user = 1 [(google.api.field_behavior) = REQUIRED];-- // The list of fields to update.- google.protobuf.FieldMask update_mask = 2;-- // The otp_code is used to verify the user's identity by MFA.- optional string otp_code = 3;-- // The regenerate_temp_mfa_secret flag means to regenerate temporary MFA secret for user.- // This is used for MFA setup. The temporary MFA secret and recovery codes will be returned in the response.- bool regenerate_temp_mfa_secret = 4;-- // The regenerate_recovery_codes flag means to regenerate recovery codes for user.- bool regenerate_recovery_codes = 5;-}--message DeleteUserRequest {- // The name of the user to delete.- // Format: users/{user}- string name = 1 [- (google.api.field_behavior) = REQUIRED,- (google.api.resource_reference) = {type: "bytebase.com/User"}- ];-}--message UndeleteUserRequest {- // The name of the deleted user.- // Format: users/{user}- string name = 1 [- (google.api.field_behavior) = REQUIRED,- (google.api.resource_reference) = {type: "bytebase.com/User"}- ];-}-message LoginRequest {string email = 1;@@ -226,55 +79,3 @@ message LoginResponse {}message LogoutRequest {}--message User {- option (google.api.resource) = {- type: "bytebase.com/User"- pattern: "users/{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;-- UserType user_type = 5;-- string password = 7 [(google.api.field_behavior) = INPUT_ONLY];-- string service_key = 8 [(google.api.field_behavior) = INPUT_ONLY];-- // The mfa_enabled flag means if the user has enabled MFA.- bool mfa_enabled = 9;-- // The mfa_secret is the temporary secret using in two phase verification.- string mfa_secret = 10;-- // The recovery_codes is the temporary recovery codes using in two phase verification.- repeated string recovery_codes = 11;-- // Should be a valid E.164 compliant phone number.- // Could be empty.- string phone = 12;-- message Profile {- google.protobuf.Timestamp last_login_time = 1;- google.protobuf.Timestamp last_change_password_time = 2;- // source means where the user comes from. For now we support Entra ID SCIM sync, so the source could be Entra ID.- string source = 3;- }-- Profile profile = 13;-}--enum UserType {- USER_TYPE_UNSPECIFIED = 0;- USER = 1;- SYSTEM_BOT = 2;- SERVICE_ACCOUNT = 3;-}diff --git a/proto/v1/user_service.proto b/proto/v1/user_service.protonew file mode 100644index 0000000000..82e5de549b--- /dev/null+++ b/proto/v1/user_service.proto@@ -0,0 +1,211 @@+syntax = "proto3";++package bytebase.v1;++import "google/api/annotations.proto";+import "google/api/client.proto";+import "google/api/field_behavior.proto";+import "google/api/resource.proto";+import "google/protobuf/empty.proto";+import "google/protobuf/field_mask.proto";+import "google/protobuf/timestamp.proto";+import "v1/annotation.proto";+import "v1/common.proto";++option go_package = "generated-go/v1";++service UserService {+ // Get the user.+ // Any authenticated user can get the user.+ rpc GetUser(GetUserRequest) returns (User) {+ option (google.api.http) = {get: "/v1/{name=users/*}"};+ option (google.api.method_signature) = "name";+ option (bytebase.v1.auth_method) = CUSTOM;+ }++ // List all users.+ // Any authenticated user can list users.+ rpc ListUsers(ListUsersRequest) returns (ListUsersResponse) {+ option (google.api.http) = {get: "/v1/users"};+ option (google.api.method_signature) = "parent";+ option (bytebase.v1.auth_method) = CUSTOM;+ }++ // Create a user.+ // When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user.+ // Otherwise, any unauthenticated user can create a user.+ rpc CreateUser(CreateUserRequest) returns (User) {+ option (google.api.http) = {+ post: "/v1/users"+ body: "user"+ };+ option (google.api.method_signature) = "user";+ option (bytebase.v1.allow_without_credential) = true;+ option (bytebase.v1.auth_method) = CUSTOM;+ option (bytebase.v1.audit) = true;+ }++ // Only the user itself and the user with bb.users.update permission on the workspace can update the user.+ rpc UpdateUser(UpdateUserRequest) returns (User) {+ option (google.api.http) = {+ patch: "/v1/{user.name=users/*}"+ body: "user"+ };+ option (google.api.method_signature) = "user,update_mask";+ option (bytebase.v1.auth_method) = CUSTOM;+ option (bytebase.v1.audit) = true;+ }++ // Only the user with bb.users.delete permission on the workspace can delete the user.+ // The last remaining workspace admin cannot be deleted.+ rpc DeleteUser(DeleteUserRequest) returns (google.protobuf.Empty) {+ option (google.api.http) = {delete: "/v1/{name=users/*}"};+ option (google.api.method_signature) = "name";+ option (bytebase.v1.auth_method) = CUSTOM;+ option (bytebase.v1.audit) = true;+ }++ // Only the user with bb.users.undelete permission on the workspace can undelete the user.+ rpc UndeleteUser(UndeleteUserRequest) returns (User) {+ option (google.api.http) = {+ post: "/v1/{name=users/*}:undelete"+ body: "*"+ };+ option (bytebase.v1.auth_method) = CUSTOM;+ option (bytebase.v1.audit) = true;+ }+}++message GetUserRequest {+ // The name of the user to retrieve.+ // Format: users/{user uid or user email}+ string name = 1 [+ (google.api.field_behavior) = REQUIRED,+ (google.api.resource_reference) = {type: "bytebase.com/User"}+ ];+}++message ListUsersRequest {+ // Not used.+ // The maximum number of users to return. The service may return fewer than+ // this value.+ // If unspecified, at most 50 users will be returned.+ // The maximum value is 1000; values above 1000 will be coerced to 1000.+ int32 page_size = 1;++ // Not used.+ // A page token, received from a previous `ListUsers` call.+ // Provide this to retrieve the subsequent page.+ //+ // When paginating, all other parameters provided to `ListUsers` must match+ // the call that provided the page token.+ string page_token = 2;++ // Show deleted users if specified.+ bool show_deleted = 3;+}++message ListUsersResponse {+ // The users from the specified request.+ repeated User users = 1;++ // A token, which can be sent as `page_token` to retrieve the next page.+ // If this field is omitted, there are no subsequent pages.+ string next_page_token = 2;+}++message CreateUserRequest {+ // The user to create.+ User user = 1 [(google.api.field_behavior) = REQUIRED];+}++message UpdateUserRequest {+ // The user to update.+ //+ // The user's `name` field is used to identify the user to update.+ // Format: users/{user}+ User user = 1 [(google.api.field_behavior) = REQUIRED];++ // The list of fields to update.+ google.protobuf.FieldMask update_mask = 2;++ // The otp_code is used to verify the user's identity by MFA.+ optional string otp_code = 3;++ // The regenerate_temp_mfa_secret flag means to regenerate temporary MFA secret for user.+ // This is used for MFA setup. The temporary MFA secret and recovery codes will be returned in the response.+ bool regenerate_temp_mfa_secret = 4;++ // The regenerate_recovery_codes flag means to regenerate recovery codes for user.+ bool regenerate_recovery_codes = 5;+}++message DeleteUserRequest {+ // The name of the user to delete.+ // Format: users/{user}+ string name = 1 [+ (google.api.field_behavior) = REQUIRED,+ (google.api.resource_reference) = {type: "bytebase.com/User"}+ ];+}++message UndeleteUserRequest {+ // The name of the deleted user.+ // Format: users/{user}+ string name = 1 [+ (google.api.field_behavior) = REQUIRED,+ (google.api.resource_reference) = {type: "bytebase.com/User"}+ ];+}++message User {+ option (google.api.resource) = {+ type: "bytebase.com/User"+ pattern: "users/{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;++ UserType user_type = 5;++ string password = 7 [(google.api.field_behavior) = INPUT_ONLY];++ string service_key = 8 [(google.api.field_behavior) = INPUT_ONLY];++ // The mfa_enabled flag means if the user has enabled MFA.+ bool mfa_enabled = 9;++ // The mfa_secret is the temporary secret using in two phase verification.+ string mfa_secret = 10;++ // The recovery_codes is the temporary recovery codes using in two phase verification.+ repeated string recovery_codes = 11;++ // Should be a valid E.164 compliant phone number.+ // Could be empty.+ string phone = 12;++ message Profile {+ google.protobuf.Timestamp last_login_time = 1;+ google.protobuf.Timestamp last_change_password_time = 2;+ // source means where the user comes from. For now we support Entra ID SCIM sync, so the source could be Entra ID.+ string source = 3;+ }++ Profile profile = 13;+}++enum UserType {+ USER_TYPE_UNSPECIFIED = 0;+ USER = 1;+ SYSTEM_BOT = 2;+ SERVICE_ACCOUNT = 3;+}