Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
refactor: separate principal table (#19512)
ecmadao2f72458f401a
diff --git a/backend/api/auth/auth.go b/backend/api/auth/auth.goindex a2aceea478..6b63bd3405 100644--- a/backend/api/auth/auth.go+++ b/backend/api/auth/auth.go@@ -203,7 +203,7 @@ func (in *APIAuthInterceptor) authenticate(ctx context.Context, accessTokenStr sreturn nil, nil, errs.Errorf("principal %q not exists in the access token", claims.Subject)}if user.MemberDeleted {- return nil, nil, errs.Errorf("principal ID %d has been deactivated by administrators", user.ID)+ return nil, nil, errs.Errorf("principal %q has been deactivated by administrators", user.Email)}return user, claims, nildiff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yamlindex bbf6dd49e9..1baff32a28 100644--- a/backend/api/mcp/gen/openapi.yaml+++ b/backend/api/mcp/gen/openapi.yaml@@ -7017,7 +7017,8 @@ components:type: stringtitle: reason- oneOf:- - properties:+ - type: object+ properties:expireTime:title: expire_timedescription: The expiration time of the access grant.@@ -7025,7 +7026,8 @@ components:title: expire_timerequired:- expireTime- - properties:+ - type: object+ properties:ttl:title: ttldescription: |-@@ -7130,12 +7132,11 @@ components:type: booleantitle: dockerdescription: Whether the Bytebase instance is running in Docker.- userStats:- type: array- items:- $ref: '#/components/schemas/bytebase.v1.ActuatorInfo.StatUser'- title: user_stats- description: Statistics about users in the system.+ activatedUserCount:+ type: integer+ title: activated_user_count+ format: int32+ description: The number of activated users.activatedInstanceCount:type: integertitle: activated_instance_count@@ -7167,25 +7168,6 @@ components:description: |-System information and configuration for the Bytebase instance.Actuator concept is similar to the Spring Boot Actuator.- bytebase.v1.ActuatorInfo.StatUser:- type: object- properties:- userType:- title: user_type- description: The type of user.- $ref: '#/components/schemas/bytebase.v1.UserType'- state:- title: state- description: The state of the user.- $ref: '#/components/schemas/bytebase.v1.State'- count:- type: integer- title: count- format: int32- description: The count of users matching this type and state.- title: StatUser- additionalProperties: false- description: User statistics by type and state.bytebase.v1.AddDataSourceRequest:type: objectproperties:@@ -7324,28 +7306,32 @@ components:bytebase.v1.Algorithm:type: objectoneOf:- - properties:+ - type: object+ properties:fullMask:title: full_mask$ref: '#/components/schemas/bytebase.v1.Algorithm.FullMask'title: full_maskrequired:- fullMask- - properties:+ - type: object+ properties:innerOuterMask:title: inner_outer_mask$ref: '#/components/schemas/bytebase.v1.Algorithm.InnerOuterMask'title: inner_outer_maskrequired:- innerOuterMask- - properties:+ - type: object+ properties:md5Mask:title: md5_mask$ref: '#/components/schemas/bytebase.v1.Algorithm.MD5Mask'title: md5_maskrequired:- md5Mask- - properties:+ - type: object+ properties:rangeMask:title: range_mask$ref: '#/components/schemas/bytebase.v1.Algorithm.RangeMask'@@ -7506,42 +7492,48 @@ components:title: type$ref: '#/components/schemas/bytebase.v1.WebhookType'- oneOf:- - properties:+ - type: object+ properties:dingtalk:title: dingtalk$ref: '#/components/schemas/bytebase.v1.AppIMSetting.DingTalk'title: dingtalkrequired:- dingtalk- - properties:+ - type: object+ properties:feishu:title: feishu$ref: '#/components/schemas/bytebase.v1.AppIMSetting.Feishu'title: feishurequired:- feishu- - properties:+ - type: object+ properties:lark:title: lark$ref: '#/components/schemas/bytebase.v1.AppIMSetting.Lark'title: larkrequired:- lark- - properties:+ - type: object+ properties:slack:title: slack$ref: '#/components/schemas/bytebase.v1.AppIMSetting.Slack'title: slackrequired:- slack- - properties:+ - type: object+ properties:teams:title: teams$ref: '#/components/schemas/bytebase.v1.AppIMSetting.Teams'title: teamsrequired:- teams- - properties:+ - type: object+ properties:wecom:title: wecom$ref: '#/components/schemas/bytebase.v1.AppIMSetting.Wecom'@@ -9235,21 +9227,24 @@ components:Extra connection parameters for the database connection.For PostgreSQL HA, this can be used to set target_session_attrs=read-write- oneOf:- - properties:+ - type: object+ properties:awsCredential:title: aws_credential$ref: '#/components/schemas/bytebase.v1.DataSource.AWSCredential'title: aws_credentialrequired:- awsCredential- - properties:+ - type: object+ properties:azureCredential:title: azure_credential$ref: '#/components/schemas/bytebase.v1.DataSource.AzureCredential'title: azure_credentialrequired:- azureCredential- - properties:+ - type: object+ properties:gcpCredential:title: gcp_credential$ref: '#/components/schemas/bytebase.v1.DataSource.GCPCredential'@@ -9395,7 +9390,8 @@ components:title: vault_ssl_keydescription: Client private key for mutual TLS authentication with Vault.- oneOf:- - properties:+ - type: object+ properties:appRole:title: app_roledescription: AppRole authentication configuration.@@ -9403,7 +9399,8 @@ components:title: app_rolerequired:- appRole- - properties:+ - type: object+ properties:token:type: stringtitle: token@@ -9966,7 +9963,8 @@ components:database: instances/{instance}/databases/{database}changelog: instances/{instance}/databases/{database}/changelogs/{changelog}- oneOf:- - properties:+ - type: object+ properties:changelog:type: stringtitle: changelog@@ -9977,7 +9975,8 @@ components:title: changelogrequired:- changelog- - properties:+ - type: object+ properties:schema:type: stringtitle: schema@@ -11149,7 +11148,8 @@ components:bytebase.v1.IdentityProviderConfig:type: objectoneOf:- - properties:+ - type: object+ properties:ldapConfig:title: ldap_configdescription: LDAP protocol configuration.@@ -11157,7 +11157,8 @@ components:title: ldap_configrequired:- ldapConfig- - properties:+ - type: object+ properties:oauth2Config:title: oauth2_configdescription: OAuth2 protocol configuration.@@ -11165,7 +11166,8 @@ components:title: oauth2_configrequired:- oauth2Config- - properties:+ - type: object+ properties:oidcConfig:title: oidc_configdescription: OIDC protocol configuration.@@ -11178,7 +11180,8 @@ components:bytebase.v1.IdentityProviderContext:type: objectoneOf:- - properties:+ - type: object+ properties:oauth2Context:title: oauth2_contextdescription: OAuth2 authentication context.@@ -11186,7 +11189,8 @@ components:title: oauth2_contextrequired:- oauth2Context- - properties:+ - type: object+ properties:oidcContext:title: oidc_contextdescription: OpenID Connect authentication context.@@ -11630,7 +11634,8 @@ components:title: creatordescription: 'Format: users/{email}'- oneOf:- - properties:+ - type: object+ properties:approval:title: approvaldescription: Approval event.@@ -11638,7 +11643,8 @@ components:title: approvalrequired:- approval- - properties:+ - type: object+ properties:issueUpdate:title: issue_updatedescription: Issue update event.@@ -11646,7 +11652,8 @@ components:title: issue_updaterequired:- issueUpdate- - properties:+ - type: object+ properties:planSpecUpdate:title: plan_spec_updatedescription: Plan spec update event.@@ -13532,7 +13539,8 @@ components:title: semantic_typedescription: The semantic type of this object.- oneOf:- - properties:+ - type: object+ properties:arrayKind:title: array_kinddescription: Array schema.@@ -13540,7 +13548,8 @@ components:title: array_kindrequired:- arrayKind- - properties:+ - type: object+ properties:structKind:title: struct_kinddescription: Struct schema.@@ -13827,21 +13836,24 @@ components:title: iddescription: A UUID4 string that uniquely identifies the Spec.- oneOf:- - properties:+ - type: object+ properties:changeDatabaseConfig:title: change_database_config$ref: '#/components/schemas/bytebase.v1.Plan.ChangeDatabaseConfig'title: change_database_configrequired:- changeDatabaseConfig- - properties:+ - type: object+ properties:createDatabaseConfig:title: create_database_config$ref: '#/components/schemas/bytebase.v1.Plan.CreateDatabaseConfig'title: create_database_configrequired:- createDatabaseConfig- - properties:+ - type: object+ properties:exportDataConfig:title: export_data_config$ref: '#/components/schemas/bytebase.v1.Plan.ExportDataConfig'@@ -13901,14 +13913,16 @@ components:title: type$ref: '#/components/schemas/bytebase.v1.PlanCheckRun.Result.Type'- oneOf:- - properties:+ - type: object+ properties:sqlReviewReport:title: sql_review_report$ref: '#/components/schemas/bytebase.v1.PlanCheckRun.Result.SqlReviewReport'title: sql_review_reportrequired:- sqlReviewReport- - properties:+ - type: object+ properties:sqlSummaryReport:title: sql_summary_report$ref: '#/components/schemas/bytebase.v1.PlanCheckRun.Result.SqlSummaryReport'@@ -14117,35 +14131,40 @@ components:description: The resource type for the policy.$ref: '#/components/schemas/bytebase.v1.PolicyResourceType'- oneOf:- - properties:+ - type: object+ properties:maskingExemptionPolicy:title: masking_exemption_policy$ref: '#/components/schemas/bytebase.v1.MaskingExemptionPolicy'title: masking_exemption_policyrequired:- maskingExemptionPolicy- - properties:+ - type: object+ properties:maskingRulePolicy:title: masking_rule_policy$ref: '#/components/schemas/bytebase.v1.MaskingRulePolicy'title: masking_rule_policyrequired:- maskingRulePolicy- - properties:+ - type: object+ properties:queryDataPolicy:title: query_data_policy$ref: '#/components/schemas/bytebase.v1.QueryDataPolicy'title: query_data_policyrequired:- queryDataPolicy- - properties:+ - type: object+ properties:rolloutPolicy:title: rollout_policy$ref: '#/components/schemas/bytebase.v1.RolloutPolicy'title: rollout_policyrequired:- rolloutPolicy- - properties:+ - type: object+ properties:tagPolicy:title: tag_policy$ref: '#/components/schemas/bytebase.v1.TagPolicy'@@ -14622,28 +14641,32 @@ components:title: maskeddescription: Masking reasons for each column (empty for non-masked columns).- oneOf:- - properties:+ - type: object+ properties:commandError:title: command_error$ref: '#/components/schemas/bytebase.v1.QueryResult.CommandError'title: command_errorrequired:- commandError- - properties:+ - type: object+ properties:permissionDenied:title: permission_denied$ref: '#/components/schemas/bytebase.v1.PermissionDeniedDetail'title: permission_deniedrequired:- permissionDenied- - properties:+ - type: object+ properties:postgresError:title: postgres_error$ref: '#/components/schemas/bytebase.v1.QueryResult.PostgresError'title: postgres_errorrequired:- postgresError- - properties:+ - type: object+ properties:syntaxError:title: syntax_error$ref: '#/components/schemas/bytebase.v1.QueryResult.SyntaxError'@@ -15206,14 +15229,16 @@ components:bytebase.v1.RowValue:type: objectoneOf:- - properties:+ - type: object+ properties:boolValue:type: booleantitle: bool_valuetitle: bool_valuerequired:- boolValue- - properties:+ - type: object+ properties:bytesValue:type: stringtitle: bytes_value@@ -15221,7 +15246,8 @@ components:title: bytes_valuerequired:- bytesValue- - properties:+ - type: object+ properties:doubleValue:type: numbertitle: double_value@@ -15229,7 +15255,8 @@ components:title: double_valuerequired:- doubleValue- - properties:+ - type: object+ properties:floatValue:type: numbertitle: float_value@@ -15237,7 +15264,8 @@ components:title: float_valuerequired:- floatValue- - properties:+ - type: object+ properties:int32Value:type: integertitle: int32_value@@ -15245,7 +15273,8 @@ components:title: int32_valuerequired:- int32Value- - properties:+ - type: object+ properties:int64Value:type:- integer@@ -15255,21 +15284,24 @@ components:title: int64_valuerequired:- int64Value- - properties:+ - type: object+ properties:nullValue:title: null_value$ref: '#/components/schemas/google.protobuf.NullValue'title: null_valuerequired:- nullValue- - properties:+ - type: object+ properties:stringValue:type: stringtitle: string_valuetitle: string_valuerequired:- stringValue- - properties:+ - type: object+ properties:timestampTzValue:title: timestamp_tz_valuedescription: |-@@ -15279,7 +15311,8 @@ components:title: timestamp_tz_valuerequired:- timestampTzValue- - properties:+ - type: object+ properties:timestampValue:title: timestamp_valuedescription: |-@@ -15291,14 +15324,16 @@ components:title: timestamp_valuerequired:- timestampValue- - properties:+ - type: object+ properties:uint32Value:type: integertitle: uint32_valuetitle: uint32_valuerequired:- uint32Value- - properties:+ - type: object+ properties:uint64Value:type:- integer@@ -15308,7 +15343,8 @@ components:title: uint64_valuerequired:- uint64Value- - properties:+ - type: object+ properties:valueValue:title: value_valuedescription: value_value is used for Spanner and TUPLE ARRAY MAP in Clickhouse only.@@ -15385,7 +15421,8 @@ components:bytebase.v1.SASLConfig:type: objectoneOf:- - properties:+ - type: object+ properties:krbConfig:title: krb_configdescription: Kerberos authentication configuration.@@ -15412,42 +15449,48 @@ components:description: The database engine this rule applies to.$ref: '#/components/schemas/bytebase.v1.Engine'- oneOf:- - properties:+ - type: object+ properties:commentConventionPayload:title: comment_convention_payload$ref: '#/components/schemas/bytebase.v1.SQLReviewRule.CommentConventionRulePayload'title: comment_convention_payloadrequired:- commentConventionPayload- - properties:+ - type: object+ properties:namingCasePayload:title: naming_case_payload$ref: '#/components/schemas/bytebase.v1.SQLReviewRule.NamingCaseRulePayload'title: naming_case_payloadrequired:- namingCasePayload- - properties:+ - type: object+ properties:namingPayload:title: naming_payload$ref: '#/components/schemas/bytebase.v1.SQLReviewRule.NamingRulePayload'title: naming_payloadrequired:- namingPayload- - properties:+ - type: object+ properties:numberPayload:title: number_payload$ref: '#/components/schemas/bytebase.v1.SQLReviewRule.NumberRulePayload'title: number_payloadrequired:- numberPayload- - properties:+ - type: object+ properties:stringArrayPayload:title: string_array_payload$ref: '#/components/schemas/bytebase.v1.SQLReviewRule.StringArrayRulePayload'title: string_array_payloadrequired:- stringArrayPayload- - properties:+ - type: object+ properties:stringPayload:title: string_payload$ref: '#/components/schemas/bytebase.v1.SQLReviewRule.StringRulePayload'@@ -16299,49 +16342,56 @@ components:bytebase.v1.SettingValue:type: objectoneOf:- - properties:+ - type: object+ properties:ai:title: ai$ref: '#/components/schemas/bytebase.v1.AISetting'title: airequired:- ai- - properties:+ - type: object+ properties:appIm:title: app_im$ref: '#/components/schemas/bytebase.v1.AppIMSetting'title: app_imrequired:- appIm- - properties:+ - type: object+ properties:dataClassification:title: data_classification$ref: '#/components/schemas/bytebase.v1.DataClassificationSetting'title: data_classificationrequired:- dataClassification- - properties:+ - type: object+ properties:environment:title: environment$ref: '#/components/schemas/bytebase.v1.EnvironmentSetting'title: environmentrequired:- environment- - properties:+ - type: object+ properties:semanticType:title: semantic_type$ref: '#/components/schemas/bytebase.v1.SemanticTypeSetting'title: semantic_typerequired:- semanticType- - properties:+ - type: object+ properties:workspaceApproval:title: workspace_approval$ref: '#/components/schemas/bytebase.v1.WorkspaceApprovalSetting'title: workspace_approvalrequired:- workspaceApproval- - properties:+ - type: object+ properties:workspaceProfile:title: workspace_profile$ref: '#/components/schemas/bytebase.v1.WorkspaceProfileSetting'@@ -16695,7 +16745,8 @@ components:title: classificationdescription: The data classification level for this table.- oneOf:- - properties:+ - type: object+ properties:columns:title: columnsdescription: Regular table columns.@@ -16703,7 +16754,8 @@ components:title: columnsrequired:- columns- - properties:+ - type: object+ properties:objectSchema:title: object_schemadescription: Object schema for JSON/XML columns.@@ -17003,21 +17055,24 @@ components:The run_time is the scheduled run time of latest task run.If there are no task runs or the task run is not scheduled, it will be empty.- oneOf:- - properties:+ - type: object+ properties:databaseCreate:title: database_create$ref: '#/components/schemas/bytebase.v1.Task.DatabaseCreate'title: database_createrequired:- databaseCreate- - properties:+ - type: object+ properties:databaseDataExport:title: database_data_export$ref: '#/components/schemas/bytebase.v1.Task.DatabaseDataExport'title: database_data_exportrequired:- databaseDataExport- - properties:+ - type: object+ properties:databaseUpdate:title: database_update$ref: '#/components/schemas/bytebase.v1.Task.DatabaseUpdate'@@ -17051,7 +17106,8 @@ components:bytebase.v1.Task.DatabaseUpdate:type: objectoneOf:- - properties:+ - type: object+ properties:release:type: stringtitle: release@@ -17059,7 +17115,8 @@ components:title: releaserequired:- release- - properties:+ - type: object+ properties:sheet:type: stringtitle: sheet@@ -17227,7 +17284,8 @@ components:bytebase.v1.TaskRun.SchedulerInfo.WaitingCause:type: objectoneOf:- - properties:+ - type: object+ properties:parallelTasksLimit:type: booleantitle: parallel_tasks_limit@@ -17580,7 +17638,8 @@ components:title: namedescription: 'Format: projects/{project}/plans/{plan}/rollout/stages/{stage}/tasks/{task}/taskRuns/{taskRun}/session'- oneOf:- - properties:+ - type: object+ properties:postgres:title: postgresdescription: PostgreSQL session information.@@ -17728,14 +17787,16 @@ components:description: The identity provider to test connection including uncreated.$ref: '#/components/schemas/bytebase.v1.IdentityProvider'- oneOf:- - properties:+ - type: object+ properties:oauth2Context:title: oauth2_context$ref: '#/components/schemas/bytebase.v1.OAuth2IdentityProviderTestRequestContext'title: oauth2_contextrequired:- oauth2Context- - properties:+ - type: object+ properties:oidcContext:title: oidc_contextdescription: OIDC authentication context for test connection.@@ -18486,10 +18547,6 @@ components:title: titlemaxLength: 200description: The display title or full name of the user.- userType:- title: user_type- description: The type of user account.- $ref: '#/components/schemas/bytebase.v1.UserType'password:type: stringtitle: password@@ -18534,10 +18591,6 @@ components:description: |-The groups for the user.Format: groups/{email}- workloadIdentityConfig:- title: workload_identity_config- description: Workload Identity configuration (only for WORKLOAD_IDENTITY type)- $ref: '#/components/schemas/bytebase.v1.WorkloadIdentityConfig'title: UseradditionalProperties: falsebytebase.v1.User.Profile:@@ -18557,14 +18610,6 @@ components:description: source means where the user comes from. For now we support Entra ID SCIM sync, so the source could be Entra ID.title: ProfileadditionalProperties: false- bytebase.v1.UserType:- type: string- title: UserType- enum:- - USER_TYPE_UNSPECIFIED- - USER- - WORKLOAD_IDENTITY- - SERVICE_ACCOUNTbytebase.v1.VCSType:type: stringtitle: VCSType@@ -19109,7 +19154,8 @@ components:google.api.expr.v1alpha1.Constant:type: objectoneOf:- - properties:+ - type: object+ properties:boolValue:type: booleantitle: bool_value@@ -19117,7 +19163,8 @@ components:title: bool_valuerequired:- boolValue- - properties:+ - type: object+ properties:bytesValue:type: stringtitle: bytes_value@@ -19126,7 +19173,8 @@ components:title: bytes_valuerequired:- bytesValue- - properties:+ - type: object+ properties:doubleValue:type: numbertitle: double_value@@ -19135,7 +19183,8 @@ components:title: double_valuerequired:- doubleValue- - properties:+ - type: object+ properties:durationValue:title: duration_valuedescription: |-@@ -19147,7 +19196,8 @@ components:title: duration_valuerequired:- durationValue- - properties:+ - type: object+ properties:int64Value:type:- integer@@ -19158,7 +19208,8 @@ components:title: int64_valuerequired:- int64Value- - properties:+ - type: object+ properties:nullValue:title: null_valuedescription: null value.@@ -19166,7 +19217,8 @@ components:title: null_valuerequired:- nullValue- - properties:+ - type: object+ properties:stringValue:type: stringtitle: string_value@@ -19174,7 +19226,8 @@ components:title: string_valuerequired:- stringValue- - properties:+ - type: object+ properties:timestampValue:title: timestamp_valuedescription: |-@@ -19186,7 +19239,8 @@ components:title: timestamp_valuerequired:- timestampValue- - properties:+ - type: object+ properties:uint64Value:type:- integer@@ -19229,7 +19283,8 @@ components:given expression tree. This is used to associate type information and otherattributes to a node in the parse tree.- oneOf:- - properties:+ - type: object+ properties:callExpr:title: call_exprdescription: A call expression, including calls to predefined functions and operators.@@ -19237,7 +19292,8 @@ components:title: call_exprrequired:- callExpr- - properties:+ - type: object+ properties:comprehensionExpr:title: comprehension_exprdescription: A comprehension expression.@@ -19245,7 +19301,8 @@ components:title: comprehension_exprrequired:- comprehensionExpr- - properties:+ - type: object+ properties:constExpr:title: const_exprdescription: A literal expression.@@ -19253,7 +19310,8 @@ components:title: const_exprrequired:- constExpr- - properties:+ - type: object+ properties:identExpr:title: ident_exprdescription: An identifier expression.@@ -19261,7 +19319,8 @@ components:title: ident_exprrequired:- identExpr- - properties:+ - type: object+ properties:listExpr:title: list_exprdescription: A list creation expression.@@ -19269,7 +19328,8 @@ components:title: list_exprrequired:- listExpr- - properties:+ - type: object+ properties:selectExpr:title: select_exprdescription: A field selection expression, e.g. `request.auth`.@@ -19277,7 +19337,8 @@ components:title: select_exprrequired:- selectExpr- - properties:+ - type: object+ properties:structExpr:title: struct_exprdescription: A map or message creation expression.@@ -19521,7 +19582,8 @@ components:title: optional_entrydescription: Whether the key-value pair is optional.- oneOf:- - properties:+ - type: object+ properties:fieldKey:type: stringtitle: field_key@@ -19529,7 +19591,8 @@ components:title: field_keyrequired:- fieldKey- - properties:+ - type: object+ properties:mapKey:title: map_keydescription: The key expression for a map creation statement.@@ -20135,12 +20198,12 @@ tags:description: IssueService manages issues for tracking database changes and tasks.- name: bytebase.v1.SettingServicedescription: SettingService manages workspace-level settings and configurations.- - name: bytebase.v1.UserService- description: UserService manages user accounts and authentication.- name: bytebase.v1.ActuatorServicedescription: ActuatorService manages system health and operational information.- name: bytebase.v1.AuditLogServicedescription: AuditLogService manages audit logs for system activities and API calls.+ - name: bytebase.v1.UserService+ description: UserService manages user accounts and authentication.- name: bytebase.v1.AuthServicedescription: AuthService handles user authentication operations.- name: bytebase.v1.CelServicediff --git a/backend/api/oauth2/token.go b/backend/api/oauth2/token.goindex 5e42967616..c5d87fa85d 100644--- a/backend/api/oauth2/token.go+++ b/backend/api/oauth2/token.go@@ -2,6 +2,7 @@ package oauth2import ("encoding/base64"+ "fmt""log/slog""net/http""slices"@@ -211,7 +212,7 @@ func (s *Service) issueTokens(c *echo.Context, client *store.OAuth2ClientMessage// Generate access token (JWT)accessToken, err := auth.GenerateOAuth2AccessToken(userEmail, client.ClientID, s.secret, accessTokenExpiry)if err != nil {- return oauth2Error(c, http.StatusInternalServerError, "server_error", "failed to generate access token")+ return oauth2Error(c, http.StatusInternalServerError, "server_error", fmt.Sprintf("failed to generate access token with error: %v", err))}now := time.Now()diff --git a/backend/api/v1/actuator_service.go b/backend/api/v1/actuator_service.goindex e80d439714..dae4e61554 100644--- a/backend/api/v1/actuator_service.go+++ b/backend/api/v1/actuator_service.go@@ -161,17 +161,11 @@ func (s *ActuatorService) getServerInfo(ctx context.Context) (*v1pb.ActuatorInfo},}- stats, err := s.store.StatUsers(ctx)+ count, err := s.store.CountActiveEndUsers(ctx)if err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to stat users"))}- for _, stat := range stats {- serverInfo.UserStats = append(serverInfo.UserStats, &v1pb.ActuatorInfo_StatUser{- State: convertDeletedToState(stat.Deleted),- UserType: convertToV1UserType(stat.Type),- Count: int32(stat.Count),- })- }+ serverInfo.ActivatedUserCount = int32(count)activatedInstanceCount, err := s.store.GetActivatedInstanceCount(ctx)if err != nil {diff --git a/backend/api/v1/audit.go b/backend/api/v1/audit.goindex 8543c12b6b..1f4af50277 100644--- a/backend/api/v1/audit.go+++ b/backend/api/v1/audit.go@@ -492,10 +492,9 @@ func redactUser(r *v1pb.User) *v1pb.User {return nil}return &v1pb.User{- Name: r.Name,- Email: r.Email,- Title: r.Title,- UserType: r.UserType,+ Name: r.Name,+ Email: r.Email,+ Title: r.Title,}}diff --git a/backend/api/v1/auth_service.go b/backend/api/v1/auth_service.goindex 872b8c6f34..84b76f2e4f 100644--- a/backend/api/v1/auth_service.go+++ b/backend/api/v1/auth_service.go@@ -109,7 +109,7 @@ func (s *AuthService) Login(ctx context.Context, req *connect.Request[v1pb.Login// 4. Generate appropriate tokentoken, err := s.generateLoginToken(ctx, loginUser)if err != nil {- return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to generate access token"))+ return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to generate access token"))}// 5. Build response and finalize@@ -201,7 +201,7 @@ func (s *AuthService) Refresh(ctx context.Context, req *connect.Request[v1pb.Ref}// 4. Get user- user, err := s.store.GetEndUserByEmail(ctx, stored.UserEmail)+ user, err := s.store.GetUserByEmail(ctx, stored.UserEmail)if err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Wrap(err, "failed to get user"))}@@ -369,7 +369,7 @@ func (s *AuthService) getOrCreateUserWithIDP(ctx context.Context, request *v1pb.return nil, err}- user, err := s.store.GetEndUserByEmail(ctx, email)+ user, err := s.store.GetUserByEmail(ctx, email)if err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to list users by email %s", email))}@@ -633,7 +633,7 @@ func (s *AuthService) completeMFALogin(ctx context.Context, request *v1pb.LoginRif err != nil {return nil, err}- user, err := s.store.GetEndUserByEmail(ctx, userEmail)+ user, err := s.store.GetUserByEmail(ctx, userEmail)if err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to find user"))}@@ -770,20 +770,23 @@ func (s *AuthService) finalizeLogin(ctx context.Context, req *connect.Request[v1response.Token = token}- if _, err := s.store.UpdateUser(ctx, user, &store.UpdateUserMessage{- Profile: &storepb.UserProfile{- LastLoginTime: timestamppb.Now(),- LastChangePasswordTime: user.Profile.GetLastChangePasswordTime(),- },- }); err != nil {- slog.Error("failed to update user profile", log.BBError(err), slog.String("user", user.Email))- }+ if user.Type == storepb.PrincipalType_END_USER {+ if _, err := s.store.UpdateUser(ctx, user, &store.UpdateUserMessage{+ Profile: &storepb.UserProfile{+ LastLoginTime: timestamppb.Now(),+ LastChangePasswordTime: user.Profile.GetLastChangePasswordTime(),+ },+ }); err != nil {+ slog.Error("failed to update user profile", log.BBError(err), slog.String("user", user.Email))+ }- v1User, err := convertToUser(ctx, s.iamManager, user)- if err != nil {- return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to convert user"))+ v1User, err := convertToUser(ctx, s.iamManager, user)+ if err != nil {+ return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to convert user"))+ }+ response.User = v1User}- response.User = v1User+return resp, nil}@@ -838,13 +841,6 @@ func (s *AuthService) ExchangeToken(ctx context.Context, req *connect.Request[v1errors.Wrap(err, "failed to generate access token"))}- // Update last login time- if _, err := s.store.UpdateWorkloadIdentity(ctx, wi, &store.UpdateWorkloadIdentityMessage{- LastLoginTime: timestamppb.Now(),- }); err != nil {- slog.Error("failed to update workload identity profile", log.BBError(err), slog.String("email", wi.Email))- }-return connect.NewResponse(&v1pb.ExchangeTokenResponse{AccessToken: token,}), nildiff --git a/backend/api/v1/group_service.go b/backend/api/v1/group_service.goindex 5bbf191ea0..6349650b65 100644--- a/backend/api/v1/group_service.go+++ b/backend/api/v1/group_service.go@@ -283,7 +283,7 @@ func (s *GroupService) convertToGroupPayload(ctx context.Context, group *v1pb.Grif err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Wrap(err, "failed to get member email"))}- user, err := s.store.GetEndUserByEmail(ctx, email)+ user, err := s.store.GetUserByEmail(ctx, email)if err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to get member %s", member.Member))}diff --git a/backend/api/v1/issue_service.go b/backend/api/v1/issue_service.goindex 1f0505d129..b550649938 100644--- a/backend/api/v1/issue_service.go+++ b/backend/api/v1/issue_service.go@@ -458,7 +458,7 @@ func (s *IssueService) buildIssueMessage(ctx context.Context, project *store.Proif err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to get user email from %q", request.Issue.GrantRequest.User))}- grantRequestUser, err := s.store.GetEndUserByEmail(ctx, grantRequestUserEmail)+ grantRequestUser, err := s.store.GetUserByEmail(ctx, grantRequestUserEmail)if err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to get user by email %q", grantRequestUserEmail))}diff --git a/backend/api/v1/service_account_service.go b/backend/api/v1/service_account_service.goindex 22e3d9ee01..73f9221ff1 100644--- a/backend/api/v1/service_account_service.go+++ b/backend/api/v1/service_account_service.go@@ -91,12 +91,11 @@ func (s *ServiceAccountService) CreateServiceAccount(ctx context.Context, requesreturn nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to hash service key"))}- // Create the service account with password hashcreatedSA, err := s.store.CreateServiceAccount(ctx, &store.CreateServiceAccountMessage{- Email: email,- Name: sa.Title,- PasswordHash: string(passwordHash),- Project: projectID,+ Email: email,+ Name: sa.Title,+ ServiceKeyHash: string(passwordHash),+ Project: projectID,})if err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to create service account"))@@ -239,7 +238,7 @@ func (s *ServiceAccountService) UpdateServiceAccount(ctx context.Context, requesreturn nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to hash service key"))}passwordHashStr := string(passwordHash)- patch.PasswordHash = &passwordHashStr+ patch.ServiceKeyHash = &passwordHashStrdefault:// Ignore unknown fields}diff --git a/backend/api/v1/user_service.go b/backend/api/v1/user_service.goindex 62e3f5b1f1..5ad300f20b 100644--- a/backend/api/v1/user_service.go+++ b/backend/api/v1/user_service.go@@ -59,7 +59,7 @@ func (s *UserService) GetUser(ctx context.Context, request *connect.Request[v1pbreturn nil, err}- user, err := s.store.GetEndUserByEmail(ctx, email)+ user, err := s.store.GetUserByEmail(ctx, email)if err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to get user"))}@@ -137,7 +137,7 @@ func (s *UserService) ListUsers(ctx context.Context, request *connect.Request[v1Offset: &offset.offset,ShowDeleted: request.Msg.ShowDeleted,}- filterResult, err := store.GetListUserFilter(request.Msg.Filter)+ filterResult, err := store.GetAccountListFilter(request.Msg.Filter)if err != nil {return nil, connect.NewError(connect.CodeInvalidArgument, err)}@@ -158,7 +158,7 @@ func (s *UserService) ListUsers(ctx context.Context, request *connect.Request[v1}}- users, err := s.store.ListEndUsers(ctx, find)+ users, err := s.store.ListUsers(ctx, find)if err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to list user"))}@@ -215,14 +215,6 @@ func (s *UserService) CreateUser(ctx context.Context, request *connect.Request[vreturn nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("user title must be set"))}- principalType, err := convertToPrincipalType(request.Msg.User.UserType)- if err != nil {- return nil, err- }- if principalType != storepb.PrincipalType_END_USER {- return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("support user only"))- }-if err := s.userCountGuard(ctx); err != nil {return nil, err}@@ -243,7 +235,7 @@ func (s *UserService) CreateUser(ctx context.Context, request *connect.Request[vif err := validateEmailWithDomains(ctx, s.licenseService, s.store, request.Msg.User.Email, false); err != nil {return nil, err}- existingUser, err := s.store.GetEndUserByEmail(ctx, request.Msg.User.Email)+ existingUser, err := s.store.GetUserByEmail(ctx, request.Msg.User.Email)if err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to find user by email"))}@@ -273,7 +265,6 @@ func (s *UserService) CreateUser(ctx context.Context, request *connect.Request[vEmail: request.Msg.User.Email,Name: request.Msg.User.Title,Phone: request.Msg.User.Phone,- Type: principalType,PasswordHash: string(passwordHash),Profile: &storepb.UserProfile{},}@@ -346,7 +337,7 @@ func (s *UserService) UpdateUser(ctx context.Context, request *connect.Request[vif err := validateEndUserEmail(email); err != nil {return nil, err}- user, err := s.store.GetEndUserByEmail(ctx, email)+ user, err := s.store.GetUserByEmail(ctx, email)if err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to get user"))}@@ -538,7 +529,7 @@ func (s *UserService) DeleteUser(ctx context.Context, request *connect.Request[vif err := validateEndUserEmail(email); err != nil {return nil, err}- user, err := s.store.GetEndUserByEmail(ctx, email)+ user, err := s.store.GetUserByEmail(ctx, email)if err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to get user"))}@@ -569,18 +560,11 @@ func (s *UserService) DeleteUser(ctx context.Context, request *connect.Request[v}func (s *UserService) getActiveUserCount(ctx context.Context) (int, error) {- userStat, err := s.store.StatUsers(ctx)+ count, err := s.store.CountActiveEndUsers(ctx)if err != nil {return 0, connect.NewError(connect.CodeInternal, errors.Errorf("failed to stat users with error: %v", err.Error()))}- activeEndUserCount := 0- for _, stat := range userStat {- if !stat.Deleted && stat.Type == storepb.PrincipalType_END_USER {- activeEndUserCount = stat.Count- break- }- }- return activeEndUserCount, nil+ return count, nil}func (s *UserService) hasExtraWorkspaceAdmin(ctx context.Context, policy *storepb.IamPolicy, user *store.UserMessage) (bool, error) {@@ -634,7 +618,7 @@ func (s *UserService) UndeleteUser(ctx context.Context, request *connect.Requestif err := validateEndUserEmail(email); err != nil {return nil, err}- user, err := s.store.GetEndUserByEmail(ctx, email)+ user, err := s.store.GetUserByEmail(ctx, email)if err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to get user"))}@@ -680,7 +664,7 @@ func (s *UserService) UpdateEmail(ctx context.Context, request *connect.Request[if err != nil {return nil, connect.NewError(connect.CodeInvalidArgument, err)}- user, err := s.store.GetEndUserByEmail(ctx, email)+ user, err := s.store.GetUserByEmail(ctx, email)if err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to get user"))}@@ -702,7 +686,7 @@ func (s *UserService) UpdateEmail(ctx context.Context, request *connect.Request[}// Check if email already exists- existedUser, err := s.store.GetEndUserByEmail(ctx, request.Msg.Email)+ existedUser, err := s.store.GetUserByEmail(ctx, request.Msg.Email)if err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to find user by email"))}@@ -723,31 +707,17 @@ func (s *UserService) UpdateEmail(ctx context.Context, request *connect.Request[return connect.NewResponse(v1User), nil}-func convertToV1UserType(userType storepb.PrincipalType) v1pb.UserType {- switch userType {- case storepb.PrincipalType_END_USER:- return v1pb.UserType_USER- case storepb.PrincipalType_SERVICE_ACCOUNT:- return v1pb.UserType_SERVICE_ACCOUNT- case storepb.PrincipalType_WORKLOAD_IDENTITY:- return v1pb.UserType_WORKLOAD_IDENTITY- default:- return v1pb.UserType_USER_TYPE_UNSPECIFIED- }-}-func convertToUser(ctx context.Context, iamManager *iam.Manager, user *store.UserMessage) (*v1pb.User, error) {groups, err := iamManager.GetUserGroups(ctx, user.Email)if err != nil {return nil, err}convertedUser := &v1pb.User{- Name: common.FormatUserEmail(user.Email),- State: convertDeletedToState(user.MemberDeleted),- Email: user.Email,- Phone: user.Phone,- Title: user.Name,- UserType: convertToV1UserType(user.Type),+ Name: common.FormatUserEmail(user.Email),+ State: convertDeletedToState(user.MemberDeleted),+ Email: user.Email,+ Phone: user.Phone,+ Title: user.Name,Profile: &v1pb.User_Profile{LastLoginTime: user.Profile.LastLoginTime,LastChangePasswordTime: user.Profile.LastChangePasswordTime,@@ -768,21 +738,6 @@ func convertToUser(ctx context.Context, iamManager *iam.Manager, user *store.Usereturn convertedUser, nil}-func convertToPrincipalType(userType v1pb.UserType) (storepb.PrincipalType, error) {- var t storepb.PrincipalType- switch userType {- case v1pb.UserType_USER:- t = storepb.PrincipalType_END_USER- case v1pb.UserType_SERVICE_ACCOUNT:- t = storepb.PrincipalType_SERVICE_ACCOUNT- case v1pb.UserType_WORKLOAD_IDENTITY:- t = storepb.PrincipalType_WORKLOAD_IDENTITY- default:- return t, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("invalid user type %s", userType))- }- return t, nil-}-func validateEndUserEmail(email string) error {if common.IsServiceAccountEmail(email) {return connect.NewError(connect.CodeInvalidArgument, errors.Errorf("email for end users cannot end with %v", common.ServiceAccountSuffix))diff --git a/backend/component/iam/manager_test.go b/backend/component/iam/manager_test.goindex 4844d968fb..5967a08de4 100644--- a/backend/component/iam/manager_test.go+++ b/backend/component/iam/manager_test.go@@ -15,6 +15,7 @@ func TestCheck(t *testing.T) {testUser := &store.UserMessage{ID: 123,Email: "[email protected]",+ Type: storepb.PrincipalType_END_USER,}rolePermissions := make(map[string]map[permission.Permission]bool)diff --git a/backend/generated-go/store/user.pb.go b/backend/generated-go/store/user.pb.goindex 45646a14f5..1157847d60 100644--- a/backend/generated-go/store/user.pb.go+++ b/backend/generated-go/store/user.pb.go@@ -215,11 +215,9 @@ type UserProfile struct {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"`// The source indicates 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"`- // Workload identity configuration (only for WORKLOAD_IDENTITY type)- WorkloadIdentityConfig *WorkloadIdentityConfig `protobuf:"bytes,4,opt,name=workload_identity_config,json=workloadIdentityConfig,proto3" json:"workload_identity_config,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache+ Source string `protobuf:"bytes,3,opt,name=source,proto3" json:"source,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache}func (x *UserProfile) Reset() {@@ -273,13 +271,6 @@ func (x *UserProfile) GetSource() string {return ""}-func (x *UserProfile) GetWorkloadIdentityConfig() *WorkloadIdentityConfig {- if x != nil {- return x.WorkloadIdentityConfig- }- return nil-}-// WorkloadIdentityConfig stores OIDC configuration for workload identity.type WorkloadIdentityConfig struct {state protoimpl.MessageState `protogen:"open.v1"`@@ -364,12 +355,11 @@ const file_store_user_proto_rawDesc = "" +"\x0ftemp_otp_secret\x18\x02 \x01(\tR\rtempOtpSecret\x12%\n" +"\x0erecovery_codes\x18\x03 \x03(\tR\rrecoveryCodes\x12.\n" +"\x13temp_recovery_codes\x18\x04 \x03(\tR\x11tempRecoveryCodes\x12Z\n" +- "\x1ctemp_otp_secret_created_time\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampR\x18tempOtpSecretCreatedTime\"\xa2\x02\n" ++ "\x1ctemp_otp_secret_created_time\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampR\x18tempOtpSecretCreatedTime\"\xc6\x01\n" +"\vUserProfile\x12B\n" +"\x0flast_login_time\x18\x01 \x01(\v2\x1a.google.protobuf.TimestampR\rlastLoginTime\x12U\n" +"\x19last_change_password_time\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\x16lastChangePasswordTime\x12\x16\n" +- "\x06source\x18\x03 \x01(\tR\x06source\x12`\n" +- "\x18workload_identity_config\x18\x04 \x01(\v2&.bytebase.store.WorkloadIdentityConfigR\x16workloadIdentityConfig\"\xae\x02\n" ++ "\x06source\x18\x03 \x01(\tR\x06sourceJ\x04\b\x04\x10\x05\"\xae\x02\n" +"\x16WorkloadIdentityConfig\x12X\n" +"\rprovider_type\x18\x01 \x01(\x0e23.bytebase.store.WorkloadIdentityConfig.ProviderTypeR\fproviderType\x12\x1d\n" +"\n" +@@ -415,13 +405,12 @@ var file_store_user_proto_depIdxs = []int32{5, // 0: bytebase.store.MFAConfig.temp_otp_secret_created_time:type_name -> google.protobuf.Timestamp5, // 1: bytebase.store.UserProfile.last_login_time:type_name -> google.protobuf.Timestamp5, // 2: bytebase.store.UserProfile.last_change_password_time:type_name -> google.protobuf.Timestamp- 4, // 3: bytebase.store.UserProfile.workload_identity_config:type_name -> bytebase.store.WorkloadIdentityConfig- 1, // 4: bytebase.store.WorkloadIdentityConfig.provider_type:type_name -> bytebase.store.WorkloadIdentityConfig.ProviderType- 5, // [5:5] is the sub-list for method output_type- 5, // [5:5] is the sub-list for method input_type- 5, // [5:5] is the sub-list for extension type_name- 5, // [5:5] is the sub-list for extension extendee- 0, // [0:5] is the sub-list for field type_name+ 1, // 3: bytebase.store.WorkloadIdentityConfig.provider_type:type_name -> bytebase.store.WorkloadIdentityConfig.ProviderType+ 4, // [4:4] is the sub-list for method output_type+ 4, // [4:4] 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_store_user_proto_init() }diff --git a/backend/generated-go/store/user_equal.pb.go b/backend/generated-go/store/user_equal.pb.goindex f5c559b55b..0d01003953 100644--- a/backend/generated-go/store/user_equal.pb.go+++ b/backend/generated-go/store/user_equal.pb.go@@ -54,9 +54,6 @@ func (x *UserProfile) Equal(y *UserProfile) bool {if x.Source != y.Source {return false}- if !x.WorkloadIdentityConfig.Equal(y.WorkloadIdentityConfig) {- return false- }return true}diff --git a/backend/generated-go/v1/actuator_service.pb.go b/backend/generated-go/v1/actuator_service.pb.goindex 608d4ad182..abc5a48277 100644--- a/backend/generated-go/v1/actuator_service.pb.go+++ b/backend/generated-go/v1/actuator_service.pb.go@@ -311,8 +311,8 @@ type ActuatorInfo struct {UnlicensedFeatures []string `protobuf:"bytes,15,rep,name=unlicensed_features,json=unlicensedFeatures,proto3" json:"unlicensed_features,omitempty"`// Whether the Bytebase instance is running in Docker.Docker bool `protobuf:"varint,18,opt,name=docker,proto3" json:"docker,omitempty"`- // Statistics about users in the system.- UserStats []*ActuatorInfo_StatUser `protobuf:"bytes,19,rep,name=user_stats,json=userStats,proto3" json:"user_stats,omitempty"`+ // The number of activated users.+ ActivatedUserCount int32 `protobuf:"varint,19,opt,name=activated_user_count,json=activatedUserCount,proto3" json:"activated_user_count,omitempty"`// The number of activated database instances.ActivatedInstanceCount int32 `protobuf:"varint,20,opt,name=activated_instance_count,json=activatedInstanceCount,proto3" json:"activated_instance_count,omitempty"`// The total number of database instances.@@ -449,11 +449,11 @@ func (x *ActuatorInfo) GetDocker() bool {return false}-func (x *ActuatorInfo) GetUserStats() []*ActuatorInfo_StatUser {+func (x *ActuatorInfo) GetActivatedUserCount() int32 {if x != nil {- return x.UserStats+ return x.ActivatedUserCount}- return nil+ return 0}func (x *ActuatorInfo) GetActivatedInstanceCount() int32 {@@ -498,75 +498,11 @@ func (x *ActuatorInfo) GetRestriction() *Restriction {return nil}-// User statistics by type and state.-type ActuatorInfo_StatUser struct {- state protoimpl.MessageState `protogen:"open.v1"`- // The type of user.- UserType UserType `protobuf:"varint,1,opt,name=user_type,json=userType,proto3,enum=bytebase.v1.UserType" json:"user_type,omitempty"`- // The state of the user.- State State `protobuf:"varint,2,opt,name=state,proto3,enum=bytebase.v1.State" json:"state,omitempty"`- // The count of users matching this type and state.- Count int32 `protobuf:"varint,3,opt,name=count,proto3" json:"count,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache-}--func (x *ActuatorInfo_StatUser) Reset() {- *x = ActuatorInfo_StatUser{}- mi := &file_v1_actuator_service_proto_msgTypes[7]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)-}--func (x *ActuatorInfo_StatUser) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*ActuatorInfo_StatUser) ProtoMessage() {}--func (x *ActuatorInfo_StatUser) ProtoReflect() protoreflect.Message {- mi := &file_v1_actuator_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 ActuatorInfo_StatUser.ProtoReflect.Descriptor instead.-func (*ActuatorInfo_StatUser) Descriptor() ([]byte, []int) {- return file_v1_actuator_service_proto_rawDescGZIP(), []int{6, 0}-}--func (x *ActuatorInfo_StatUser) GetUserType() UserType {- if x != nil {- return x.UserType- }- return UserType_USER_TYPE_UNSPECIFIED-}--func (x *ActuatorInfo_StatUser) GetState() State {- if x != nil {- return x.State- }- return State_STATE_UNSPECIFIED-}--func (x *ActuatorInfo_StatUser) GetCount() int32 {- if x != nil {- return x.Count- }- return 0-}-var File_v1_actuator_service_proto protoreflect.FileDescriptorconst file_v1_actuator_service_proto_rawDesc = "" +"\n" +- "\x19v1/actuator_service.proto\x12\vbytebase.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x13v1/annotation.proto\x1a\x0fv1/common.proto\x1a\x18v1/setting_service.proto\x1a\x15v1/user_service.proto\"\x1b\n" ++ "\x19v1/actuator_service.proto\x12\vbytebase.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x13v1/annotation.proto\x1a\x18v1/setting_service.proto\"\x1b\n" +"\x19GetResourcePackageRequest\"%\n" +"\x0fResourcePackage\x12\x12\n" +"\x04logo\x18\x01 \x01(\fR\x04logo\"\x14\n" +@@ -576,7 +512,7 @@ const file_v1_actuator_service_proto_rawDesc = "" +"\vRestriction\x12,\n" +"\x0fdisallow_signup\x18\x01 \x01(\bB\x03\xe0A\x03R\x0edisallowSignup\x12=\n" +"\x18disallow_password_signin\x18\x02 \x01(\bB\x03\xe0A\x03R\x16disallowPasswordSignin\x12p\n" +- "\x14password_restriction\x18\x03 \x01(\v28.bytebase.v1.WorkspaceProfileSetting.PasswordRestrictionB\x03\xe0A\x03R\x13passwordRestriction\"\x9e\b\n" ++ "\x14password_restriction\x18\x03 \x01(\v28.bytebase.v1.WorkspaceProfileSetting.PasswordRestrictionB\x03\xe0A\x03R\x13passwordRestriction\"\x8d\a\n" +"\fActuatorInfo\x12\x1d\n" +"\aversion\x18\x01 \x01(\tB\x03\xe0A\x03R\aversion\x12\"\n" +"\n" +@@ -591,19 +527,14 @@ const file_v1_actuator_service_proto_rawDesc = "" +"\x10last_active_time\x18\v \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\x0elastActiveTime\x12&\n" +"\fworkspace_id\x18\r \x01(\tB\x03\xe0A\x03R\vworkspaceId\x124\n" +"\x13unlicensed_features\x18\x0f \x03(\tB\x03\xe0A\x03R\x12unlicensedFeatures\x12\x1b\n" +- "\x06docker\x18\x12 \x01(\bB\x03\xe0A\x03R\x06docker\x12F\n" +- "\n" +- "user_stats\x18\x13 \x03(\v2\".bytebase.v1.ActuatorInfo.StatUserB\x03\xe0A\x03R\tuserStats\x12=\n" ++ "\x06docker\x18\x12 \x01(\bB\x03\xe0A\x03R\x06docker\x125\n" ++ "\x14activated_user_count\x18\x13 \x01(\x05B\x03\xe0A\x03R\x12activatedUserCount\x12=\n" +"\x18activated_instance_count\x18\x14 \x01(\x05B\x03\xe0A\x03R\x16activatedInstanceCount\x125\n" +"\x14total_instance_count\x18\x15 \x01(\x05B\x03\xe0A\x03R\x12totalInstanceCount\x12(\n" +"\renable_sample\x18\x16 \x01(\bB\x03\xe0A\x03R\fenableSample\x128\n" +"\x16external_url_from_flag\x18\x17 \x01(\bB\x03\xe0A\x03R\x13externalUrlFromFlag\x12(\n" +"\rreplica_count\x18\x18 \x01(\x05B\x03\xe0A\x03R\freplicaCount\x12?\n" +- "\vrestriction\x18\x19 \x01(\v2\x18.bytebase.v1.RestrictionB\x03\xe0A\x03R\vrestriction\x1a~\n" +- "\bStatUser\x122\n" +- "\tuser_type\x18\x01 \x01(\x0e2\x15.bytebase.v1.UserTypeR\buserType\x12(\n" +- "\x05state\x18\x02 \x01(\x0e2\x12.bytebase.v1.StateR\x05state\x12\x14\n" +- "\x05count\x18\x03 \x01(\x05R\x05countJ\x04\b\n" ++ "\vrestriction\x18\x19 \x01(\v2\x18.bytebase.v1.RestrictionB\x03\xe0A\x03R\vrestrictionJ\x04\b\n" +"\x10\vJ\x04\b\f\x10\rJ\x04\b\x10\x10\x11J\x04\b\x11\x10\x12J\x04\b\x0e\x10\x0f2\xf7\x03\n" +"\x0fActuatorService\x12s\n" +"\x0fGetActuatorInfo\x12#.bytebase.v1.GetActuatorInfoRequest\x1a\x19.bytebase.v1.ActuatorInfo\" \xdaA\x00\x80\xea0\x01\x82\xd3\xe4\x93\x02\x13\x12\x11/v1/actuator/info\x12\x82\x01\n" +@@ -624,7 +555,7 @@ func file_v1_actuator_service_proto_rawDescGZIP() []byte {return file_v1_actuator_service_proto_rawDescData}-var file_v1_actuator_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8)+var file_v1_actuator_service_proto_msgTypes = make([]protoimpl.MessageInfo, 7)var file_v1_actuator_service_proto_goTypes = []any{(*GetResourcePackageRequest)(nil), // 0: bytebase.v1.GetResourcePackageRequest(*ResourcePackage)(nil), // 1: bytebase.v1.ResourcePackage@@ -633,33 +564,27 @@ var file_v1_actuator_service_proto_goTypes = []any{(*DeleteCacheRequest)(nil), // 4: bytebase.v1.DeleteCacheRequest(*Restriction)(nil), // 5: bytebase.v1.Restriction(*ActuatorInfo)(nil), // 6: bytebase.v1.ActuatorInfo- (*ActuatorInfo_StatUser)(nil), // 7: bytebase.v1.ActuatorInfo.StatUser- (*WorkspaceProfileSetting_PasswordRestriction)(nil), // 8: bytebase.v1.WorkspaceProfileSetting.PasswordRestriction- (*timestamppb.Timestamp)(nil), // 9: google.protobuf.Timestamp- (UserType)(0), // 10: bytebase.v1.UserType- (State)(0), // 11: bytebase.v1.State- (*emptypb.Empty)(nil), // 12: google.protobuf.Empty+ (*WorkspaceProfileSetting_PasswordRestriction)(nil), // 7: bytebase.v1.WorkspaceProfileSetting.PasswordRestriction+ (*timestamppb.Timestamp)(nil), // 8: google.protobuf.Timestamp+ (*emptypb.Empty)(nil), // 9: google.protobuf.Empty}var file_v1_actuator_service_proto_depIdxs = []int32{- 8, // 0: bytebase.v1.Restriction.password_restriction:type_name -> bytebase.v1.WorkspaceProfileSetting.PasswordRestriction- 9, // 1: bytebase.v1.ActuatorInfo.last_active_time:type_name -> google.protobuf.Timestamp- 7, // 2: bytebase.v1.ActuatorInfo.user_stats:type_name -> bytebase.v1.ActuatorInfo.StatUser- 5, // 3: bytebase.v1.ActuatorInfo.restriction:type_name -> bytebase.v1.Restriction- 10, // 4: bytebase.v1.ActuatorInfo.StatUser.user_type:type_name -> bytebase.v1.UserType- 11, // 5: bytebase.v1.ActuatorInfo.StatUser.state:type_name -> bytebase.v1.State- 3, // 6: bytebase.v1.ActuatorService.GetActuatorInfo:input_type -> bytebase.v1.GetActuatorInfoRequest- 2, // 7: bytebase.v1.ActuatorService.SetupSample:input_type -> bytebase.v1.SetupSampleRequest- 4, // 8: bytebase.v1.ActuatorService.DeleteCache:input_type -> bytebase.v1.DeleteCacheRequest- 0, // 9: bytebase.v1.ActuatorService.GetResourcePackage:input_type -> bytebase.v1.GetResourcePackageRequest- 6, // 10: bytebase.v1.ActuatorService.GetActuatorInfo:output_type -> bytebase.v1.ActuatorInfo- 12, // 11: bytebase.v1.ActuatorService.SetupSample:output_type -> google.protobuf.Empty- 12, // 12: bytebase.v1.ActuatorService.DeleteCache:output_type -> google.protobuf.Empty- 1, // 13: bytebase.v1.ActuatorService.GetResourcePackage:output_type -> bytebase.v1.ResourcePackage- 10, // [10:14] is the sub-list for method output_type- 6, // [6:10] is the sub-list for method input_type- 6, // [6:6] is the sub-list for extension type_name- 6, // [6:6] is the sub-list for extension extendee- 0, // [0:6] is the sub-list for field type_name+ 7, // 0: bytebase.v1.Restriction.password_restriction:type_name -> bytebase.v1.WorkspaceProfileSetting.PasswordRestriction+ 8, // 1: bytebase.v1.ActuatorInfo.last_active_time:type_name -> google.protobuf.Timestamp+ 5, // 2: bytebase.v1.ActuatorInfo.restriction:type_name -> bytebase.v1.Restriction+ 3, // 3: bytebase.v1.ActuatorService.GetActuatorInfo:input_type -> bytebase.v1.GetActuatorInfoRequest+ 2, // 4: bytebase.v1.ActuatorService.SetupSample:input_type -> bytebase.v1.SetupSampleRequest+ 4, // 5: bytebase.v1.ActuatorService.DeleteCache:input_type -> bytebase.v1.DeleteCacheRequest+ 0, // 6: bytebase.v1.ActuatorService.GetResourcePackage:input_type -> bytebase.v1.GetResourcePackageRequest+ 6, // 7: bytebase.v1.ActuatorService.GetActuatorInfo:output_type -> bytebase.v1.ActuatorInfo+ 9, // 8: bytebase.v1.ActuatorService.SetupSample:output_type -> google.protobuf.Empty+ 9, // 9: bytebase.v1.ActuatorService.DeleteCache:output_type -> google.protobuf.Empty+ 1, // 10: bytebase.v1.ActuatorService.GetResourcePackage:output_type -> bytebase.v1.ResourcePackage+ 7, // [7:11] is the sub-list for method output_type+ 3, // [3:7] is the sub-list for method input_type+ 3, // [3:3] is the sub-list for extension type_name+ 3, // [3:3] is the sub-list for extension extendee+ 0, // [0:3] is the sub-list for field type_name}func init() { file_v1_actuator_service_proto_init() }@@ -668,16 +593,14 @@ func file_v1_actuator_service_proto_init() {return}file_v1_annotation_proto_init()- file_v1_common_proto_init()file_v1_setting_service_proto_init()- file_v1_user_service_proto_init()type x struct{}out := protoimpl.TypeBuilder{File: protoimpl.DescBuilder{GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_actuator_service_proto_rawDesc), len(file_v1_actuator_service_proto_rawDesc)),NumEnums: 0,- NumMessages: 8,+ NumMessages: 7,NumExtensions: 0,NumServices: 1,},diff --git a/backend/generated-go/v1/actuator_service_equal.pb.go b/backend/generated-go/v1/actuator_service_equal.pb.goindex db74aaf109..8370481609 100644--- a/backend/generated-go/v1/actuator_service_equal.pb.go+++ b/backend/generated-go/v1/actuator_service_equal.pb.go@@ -75,25 +75,6 @@ func (x *Restriction) Equal(y *Restriction) bool {return true}-func (x *ActuatorInfo_StatUser) Equal(y *ActuatorInfo_StatUser) bool {- if x == y {- return true- }- if x == nil || y == nil {- return x == nil && y == nil- }- if x.UserType != y.UserType {- return false- }- if x.State != y.State {- return false- }- if x.Count != y.Count {- return false- }- return true-}-func (x *ActuatorInfo) Equal(y *ActuatorInfo) bool {if x == y {return true@@ -145,14 +126,9 @@ func (x *ActuatorInfo) Equal(y *ActuatorInfo) bool {if x.Docker != y.Docker {return false}- if len(x.UserStats) != len(y.UserStats) {+ if x.ActivatedUserCount != y.ActivatedUserCount {return false}- for i := 0; i < len(x.UserStats); i++ {- if !x.UserStats[i].Equal(y.UserStats[i]) {- return false- }- }if x.ActivatedInstanceCount != y.ActivatedInstanceCount {return false}diff --git a/backend/generated-go/v1/user_service.pb.go b/backend/generated-go/v1/user_service.pb.goindex 9d5fec3da6..c5fe45163e 100644--- a/backend/generated-go/v1/user_service.pb.go+++ b/backend/generated-go/v1/user_service.pb.go@@ -26,112 +26,6 @@ const (_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20))-type UserType int32--const (- // Unspecified user type.- UserType_USER_TYPE_UNSPECIFIED UserType = 0- // Regular human user account.- UserType_USER UserType = 1- // External CI/CD workload identity.- UserType_WORKLOAD_IDENTITY UserType = 2- // Service account for API integrations.- UserType_SERVICE_ACCOUNT UserType = 3-)--// Enum value maps for UserType.-var (- UserType_name = map[int32]string{- 0: "USER_TYPE_UNSPECIFIED",- 1: "USER",- 2: "WORKLOAD_IDENTITY",- 3: "SERVICE_ACCOUNT",- }- UserType_value = map[string]int32{- "USER_TYPE_UNSPECIFIED": 0,- "USER": 1,- "WORKLOAD_IDENTITY": 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}-}--// ProviderType identifies the CI/CD platform.-type WorkloadIdentityConfig_ProviderType int32--const (- WorkloadIdentityConfig_PROVIDER_TYPE_UNSPECIFIED WorkloadIdentityConfig_ProviderType = 0- WorkloadIdentityConfig_GITHUB WorkloadIdentityConfig_ProviderType = 1- WorkloadIdentityConfig_GITLAB WorkloadIdentityConfig_ProviderType = 2-)--// Enum value maps for WorkloadIdentityConfig_ProviderType.-var (- WorkloadIdentityConfig_ProviderType_name = map[int32]string{- 0: "PROVIDER_TYPE_UNSPECIFIED",- 1: "GITHUB",- 2: "GITLAB",- }- WorkloadIdentityConfig_ProviderType_value = map[string]int32{- "PROVIDER_TYPE_UNSPECIFIED": 0,- "GITHUB": 1,- "GITLAB": 2,- }-)--func (x WorkloadIdentityConfig_ProviderType) Enum() *WorkloadIdentityConfig_ProviderType {- p := new(WorkloadIdentityConfig_ProviderType)- *p = x- return p-}--func (x WorkloadIdentityConfig_ProviderType) String() string {- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))-}--func (WorkloadIdentityConfig_ProviderType) Descriptor() protoreflect.EnumDescriptor {- return file_v1_user_service_proto_enumTypes[1].Descriptor()-}--func (WorkloadIdentityConfig_ProviderType) Type() protoreflect.EnumType {- return &file_v1_user_service_proto_enumTypes[1]-}--func (x WorkloadIdentityConfig_ProviderType) Number() protoreflect.EnumNumber {- return protoreflect.EnumNumber(x)-}--// Deprecated: Use WorkloadIdentityConfig_ProviderType.Descriptor instead.-func (WorkloadIdentityConfig_ProviderType) EnumDescriptor() ([]byte, []int) {- return file_v1_user_service_proto_rawDescGZIP(), []int{11, 0}-}-type GetUserRequest struct {state protoimpl.MessageState `protogen:"open.v1"`// The name of the user to retrieve.@@ -720,8 +614,6 @@ type User struct {Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`// The display title or full name of the user.Title string `protobuf:"bytes,4,opt,name=title,proto3" json:"title,omitempty"`- // The type of user account.- UserType UserType `protobuf:"varint,5,opt,name=user_type,json=userType,proto3,enum=bytebase.v1.UserType" json:"user_type,omitempty"`// The password for authentication. Only used during user creation or password updates.Password string `protobuf:"bytes,6,opt,name=password,proto3" json:"password,omitempty"`// The service key for service account authentication. Only used for service accounts.@@ -741,11 +633,9 @@ type User struct {Profile *User_Profile `protobuf:"bytes,13,opt,name=profile,proto3" json:"profile,omitempty"`// The groups for the user.// Format: groups/{email}- Groups []string `protobuf:"bytes,14,rep,name=groups,proto3" json:"groups,omitempty"`- // Workload Identity configuration (only for WORKLOAD_IDENTITY type)- WorkloadIdentityConfig *WorkloadIdentityConfig `protobuf:"bytes,15,opt,name=workload_identity_config,json=workloadIdentityConfig,proto3" json:"workload_identity_config,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache+ Groups []string `protobuf:"bytes,14,rep,name=groups,proto3" json:"groups,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache}func (x *User) Reset() {@@ -806,13 +696,6 @@ func (x *User) GetTitle() string {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@@ -876,86 +759,6 @@ func (x *User) GetGroups() []string {return nil}-func (x *User) GetWorkloadIdentityConfig() *WorkloadIdentityConfig {- if x != nil {- return x.WorkloadIdentityConfig- }- return nil-}--// WorkloadIdentityConfig for API layer-type WorkloadIdentityConfig struct {- state protoimpl.MessageState `protogen:"open.v1"`- // Platform type (currently only GITHUB is supported)- ProviderType WorkloadIdentityConfig_ProviderType `protobuf:"varint,1,opt,name=provider_type,json=providerType,proto3,enum=bytebase.v1.WorkloadIdentityConfig_ProviderType" json:"provider_type,omitempty"`- // OIDC Issuer URL (auto-filled based on provider_type, can be overridden)- IssuerUrl string `protobuf:"bytes,2,opt,name=issuer_url,json=issuerUrl,proto3" json:"issuer_url,omitempty"`- // Allowed audiences for token validation- AllowedAudiences []string `protobuf:"bytes,3,rep,name=allowed_audiences,json=allowedAudiences,proto3" json:"allowed_audiences,omitempty"`- // Subject pattern to match (e.g., "repo:owner/repo:ref:refs/heads/main")- SubjectPattern string `protobuf:"bytes,4,opt,name=subject_pattern,json=subjectPattern,proto3" json:"subject_pattern,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache-}--func (x *WorkloadIdentityConfig) Reset() {- *x = WorkloadIdentityConfig{}- mi := &file_v1_user_service_proto_msgTypes[11]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)-}--func (x *WorkloadIdentityConfig) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*WorkloadIdentityConfig) ProtoMessage() {}--func (x *WorkloadIdentityConfig) ProtoReflect() protoreflect.Message {- mi := &file_v1_user_service_proto_msgTypes[11]- 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 WorkloadIdentityConfig.ProtoReflect.Descriptor instead.-func (*WorkloadIdentityConfig) Descriptor() ([]byte, []int) {- return file_v1_user_service_proto_rawDescGZIP(), []int{11}-}--func (x *WorkloadIdentityConfig) GetProviderType() WorkloadIdentityConfig_ProviderType {- if x != nil {- return x.ProviderType- }- return WorkloadIdentityConfig_PROVIDER_TYPE_UNSPECIFIED-}--func (x *WorkloadIdentityConfig) GetIssuerUrl() string {- if x != nil {- return x.IssuerUrl- }- return ""-}--func (x *WorkloadIdentityConfig) GetAllowedAudiences() []string {- if x != nil {- return x.AllowedAudiences- }- return nil-}--func (x *WorkloadIdentityConfig) GetSubjectPattern() string {- if x != nil {- return x.SubjectPattern- }- return ""-}-type User_Profile struct {state protoimpl.MessageState `protogen:"open.v1"`// The last time the user successfully logged in.@@ -970,7 +773,7 @@ type User_Profile struct {func (x *User_Profile) Reset() {*x = User_Profile{}- mi := &file_v1_user_service_proto_msgTypes[12]+ mi := &file_v1_user_service_proto_msgTypes[11]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -982,7 +785,7 @@ func (x *User_Profile) String() string {func (*User_Profile) ProtoMessage() {}func (x *User_Profile) ProtoReflect() protoreflect.Message {- mi := &file_v1_user_service_proto_msgTypes[12]+ mi := &file_v1_user_service_proto_msgTypes[11]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1061,13 +864,12 @@ const file_v1_user_service_proto_rawDesc = "" +"\x12UpdateEmailRequest\x12-\n" +"\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" +"\x11bytebase.com/UserR\x04name\x12\x19\n" +- "\x05email\x18\x02 \x01(\tB\x03\xe0A\x02R\x05email\"\xfc\x06\n" ++ "\x05email\x18\x02 \x01(\tB\x03\xe0A\x02R\x05email\"\xf5\x05\n" +"\x04User\x12\x17\n" +"\x04name\x18\x01 \x01(\tB\x03\xe0A\x03R\x04name\x12(\n" +"\x05state\x18\x02 \x01(\x0e2\x12.bytebase.v1.StateR\x05state\x12\x14\n" +"\x05email\x18\x03 \x01(\tR\x05email\x12\x1e\n" +- "\x05title\x18\x04 \x01(\tB\b\xbaH\x05r\x03\x18\xc8\x01R\x05title\x122\n" +- "\tuser_type\x18\x05 \x01(\x0e2\x15.bytebase.v1.UserTypeR\buserType\x12\x1f\n" ++ "\x05title\x18\x04 \x01(\tB\b\xbaH\x05r\x03\x18\xc8\x01R\x05title\x12\x1f\n" +"\bpassword\x18\x06 \x01(\tB\x03\xe0A\x04R\bpassword\x12$\n" +"\vservice_key\x18\a \x01(\tB\x03\xe0A\x04R\n" +"serviceKey\x12\x1f\n" +@@ -1079,30 +881,12 @@ const file_v1_user_service_proto_rawDesc = "" +"\x1ctemp_otp_secret_created_time\x18\v \x01(\v2\x1a.google.protobuf.TimestampR\x18tempOtpSecretCreatedTime\x12\x14\n" +"\x05phone\x18\f \x01(\tR\x05phone\x123\n" +"\aprofile\x18\r \x01(\v2\x19.bytebase.v1.User.ProfileR\aprofile\x12\x1b\n" +- "\x06groups\x18\x0e \x03(\tB\x03\xe0A\x03R\x06groups\x12]\n" +- "\x18workload_identity_config\x18\x0f \x01(\v2#.bytebase.v1.WorkloadIdentityConfigR\x16workloadIdentityConfig\x1a\xbc\x01\n" ++ "\x06groups\x18\x0e \x03(\tB\x03\xe0A\x03R\x06groups\x1a\xbc\x01\n" +"\aProfile\x12B\n" +"\x0flast_login_time\x18\x01 \x01(\v2\x1a.google.protobuf.TimestampR\rlastLoginTime\x12U\n" +"\x19last_change_password_time\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\x16lastChangePasswordTime\x12\x16\n" +"\x06source\x18\x03 \x01(\tR\x06source:%\xeaA\"\n" +- "\x11bytebase.com/User\x12\rusers/{email}\"\xab\x02\n" +- "\x16WorkloadIdentityConfig\x12U\n" +- "\rprovider_type\x18\x01 \x01(\x0e20.bytebase.v1.WorkloadIdentityConfig.ProviderTypeR\fproviderType\x12\x1d\n" +- "\n" +- "issuer_url\x18\x02 \x01(\tR\tissuerUrl\x12+\n" +- "\x11allowed_audiences\x18\x03 \x03(\tR\x10allowedAudiences\x12'\n" +- "\x0fsubject_pattern\x18\x04 \x01(\tR\x0esubjectPattern\"E\n" +- "\fProviderType\x12\x1d\n" +- "\x19PROVIDER_TYPE_UNSPECIFIED\x10\x00\x12\n" +- "\n" +- "\x06GITHUB\x10\x01\x12\n" +- "\n" +- "\x06GITLAB\x10\x02*[\n" +- "\bUserType\x12\x19\n" +- "\x15USER_TYPE_UNSPECIFIED\x10\x00\x12\b\n" +- "\x04USER\x10\x01\x12\x15\n" +- "\x11WORKLOAD_IDENTITY\x10\x02\x12\x13\n" +- "\x0fSERVICE_ACCOUNT\x10\x032\xd3\b\n" ++ "\x11bytebase.com/User\x12\rusers/{email}J\x04\b\x05\x10\x06J\x04\b\x0f\x10\x102\xd3\b\n" +"\vUserService\x12p\n" +"\aGetUser\x12\x1b.bytebase.v1.GetUserRequest\x1a\x11.bytebase.v1.User\"5\xdaA\x04name\x8a\xea0\fbb.users.get\x90\xea0\x01\x82\xd3\xe4\x93\x02\x14\x12\x12/v1/{name=users/*}\x12\x86\x01\n" +"\rBatchGetUsers\x12!.bytebase.v1.BatchGetUsersRequest\x1a\".bytebase.v1.BatchGetUsersResponse\".\x8a\xea0\fbb.users.get\x90\xea0\x01\x82\xd3\xe4\x93\x02\x14\x12\x12/v1/users:batchGet\x12Y\n" +@@ -1131,66 +915,59 @@ func file_v1_user_service_proto_rawDescGZIP() []byte {return file_v1_user_service_proto_rawDescData}-var file_v1_user_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2)-var file_v1_user_service_proto_msgTypes = make([]protoimpl.MessageInfo, 13)+var file_v1_user_service_proto_msgTypes = make([]protoimpl.MessageInfo, 12)var file_v1_user_service_proto_goTypes = []any{- (UserType)(0), // 0: bytebase.v1.UserType- (WorkloadIdentityConfig_ProviderType)(0), // 1: bytebase.v1.WorkloadIdentityConfig.ProviderType- (*GetUserRequest)(nil), // 2: bytebase.v1.GetUserRequest- (*BatchGetUsersRequest)(nil), // 3: bytebase.v1.BatchGetUsersRequest- (*BatchGetUsersResponse)(nil), // 4: bytebase.v1.BatchGetUsersResponse- (*ListUsersRequest)(nil), // 5: bytebase.v1.ListUsersRequest- (*ListUsersResponse)(nil), // 6: bytebase.v1.ListUsersResponse- (*CreateUserRequest)(nil), // 7: bytebase.v1.CreateUserRequest- (*UpdateUserRequest)(nil), // 8: bytebase.v1.UpdateUserRequest- (*DeleteUserRequest)(nil), // 9: bytebase.v1.DeleteUserRequest- (*UndeleteUserRequest)(nil), // 10: bytebase.v1.UndeleteUserRequest- (*UpdateEmailRequest)(nil), // 11: bytebase.v1.UpdateEmailRequest- (*User)(nil), // 12: bytebase.v1.User- (*WorkloadIdentityConfig)(nil), // 13: bytebase.v1.WorkloadIdentityConfig- (*User_Profile)(nil), // 14: bytebase.v1.User.Profile- (*fieldmaskpb.FieldMask)(nil), // 15: google.protobuf.FieldMask- (State)(0), // 16: bytebase.v1.State- (*timestamppb.Timestamp)(nil), // 17: google.protobuf.Timestamp- (*emptypb.Empty)(nil), // 18: google.protobuf.Empty+ (*GetUserRequest)(nil), // 0: bytebase.v1.GetUserRequest+ (*BatchGetUsersRequest)(nil), // 1: bytebase.v1.BatchGetUsersRequest+ (*BatchGetUsersResponse)(nil), // 2: bytebase.v1.BatchGetUsersResponse+ (*ListUsersRequest)(nil), // 3: bytebase.v1.ListUsersRequest+ (*ListUsersResponse)(nil), // 4: bytebase.v1.ListUsersResponse+ (*CreateUserRequest)(nil), // 5: bytebase.v1.CreateUserRequest+ (*UpdateUserRequest)(nil), // 6: bytebase.v1.UpdateUserRequest+ (*DeleteUserRequest)(nil), // 7: bytebase.v1.DeleteUserRequest+ (*UndeleteUserRequest)(nil), // 8: bytebase.v1.UndeleteUserRequest+ (*UpdateEmailRequest)(nil), // 9: bytebase.v1.UpdateEmailRequest+ (*User)(nil), // 10: bytebase.v1.User+ (*User_Profile)(nil), // 11: bytebase.v1.User.Profile+ (*fieldmaskpb.FieldMask)(nil), // 12: google.protobuf.FieldMask+ (State)(0), // 13: bytebase.v1.State+ (*timestamppb.Timestamp)(nil), // 14: google.protobuf.Timestamp+ (*emptypb.Empty)(nil), // 15: google.protobuf.Empty}var file_v1_user_service_proto_depIdxs = []int32{- 12, // 0: bytebase.v1.BatchGetUsersResponse.users:type_name -> bytebase.v1.User- 12, // 1: bytebase.v1.ListUsersResponse.users:type_name -> bytebase.v1.User- 12, // 2: bytebase.v1.CreateUserRequest.user:type_name -> bytebase.v1.User- 12, // 3: bytebase.v1.UpdateUserRequest.user:type_name -> bytebase.v1.User- 15, // 4: bytebase.v1.UpdateUserRequest.update_mask:type_name -> google.protobuf.FieldMask- 16, // 5: bytebase.v1.User.state:type_name -> bytebase.v1.State- 0, // 6: bytebase.v1.User.user_type:type_name -> bytebase.v1.UserType- 17, // 7: bytebase.v1.User.temp_otp_secret_created_time:type_name -> google.protobuf.Timestamp- 14, // 8: bytebase.v1.User.profile:type_name -> bytebase.v1.User.Profile- 13, // 9: bytebase.v1.User.workload_identity_config:type_name -> bytebase.v1.WorkloadIdentityConfig- 1, // 10: bytebase.v1.WorkloadIdentityConfig.provider_type:type_name -> bytebase.v1.WorkloadIdentityConfig.ProviderType- 17, // 11: bytebase.v1.User.Profile.last_login_time:type_name -> google.protobuf.Timestamp- 17, // 12: bytebase.v1.User.Profile.last_change_password_time:type_name -> google.protobuf.Timestamp- 2, // 13: bytebase.v1.UserService.GetUser:input_type -> bytebase.v1.GetUserRequest- 3, // 14: bytebase.v1.UserService.BatchGetUsers:input_type -> bytebase.v1.BatchGetUsersRequest- 18, // 15: bytebase.v1.UserService.GetCurrentUser:input_type -> google.protobuf.Empty- 5, // 16: bytebase.v1.UserService.ListUsers:input_type -> bytebase.v1.ListUsersRequest- 7, // 17: bytebase.v1.UserService.CreateUser:input_type -> bytebase.v1.CreateUserRequest- 8, // 18: bytebase.v1.UserService.UpdateUser:input_type -> bytebase.v1.UpdateUserRequest- 9, // 19: bytebase.v1.UserService.DeleteUser:input_type -> bytebase.v1.DeleteUserRequest- 10, // 20: bytebase.v1.UserService.UndeleteUser:input_type -> bytebase.v1.UndeleteUserRequest- 11, // 21: bytebase.v1.UserService.UpdateEmail:input_type -> bytebase.v1.UpdateEmailRequest- 12, // 22: bytebase.v1.UserService.GetUser:output_type -> bytebase.v1.User- 4, // 23: bytebase.v1.UserService.BatchGetUsers:output_type -> bytebase.v1.BatchGetUsersResponse- 12, // 24: bytebase.v1.UserService.GetCurrentUser:output_type -> bytebase.v1.User- 6, // 25: bytebase.v1.UserService.ListUsers:output_type -> bytebase.v1.ListUsersResponse- 12, // 26: bytebase.v1.UserService.CreateUser:output_type -> bytebase.v1.User- 12, // 27: bytebase.v1.UserService.UpdateUser:output_type -> bytebase.v1.User- 18, // 28: bytebase.v1.UserService.DeleteUser:output_type -> google.protobuf.Empty- 12, // 29: bytebase.v1.UserService.UndeleteUser:output_type -> bytebase.v1.User- 12, // 30: bytebase.v1.UserService.UpdateEmail:output_type -> bytebase.v1.User- 22, // [22:31] is the sub-list for method output_type- 13, // [13:22] 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+ 10, // 0: bytebase.v1.BatchGetUsersResponse.users:type_name -> bytebase.v1.User+ 10, // 1: bytebase.v1.ListUsersResponse.users:type_name -> bytebase.v1.User+ 10, // 2: bytebase.v1.CreateUserRequest.user:type_name -> bytebase.v1.User+ 10, // 3: bytebase.v1.UpdateUserRequest.user:type_name -> bytebase.v1.User+ 12, // 4: bytebase.v1.UpdateUserRequest.update_mask:type_name -> google.protobuf.FieldMask+ 13, // 5: bytebase.v1.User.state:type_name -> bytebase.v1.State+ 14, // 6: bytebase.v1.User.temp_otp_secret_created_time:type_name -> google.protobuf.Timestamp+ 11, // 7: bytebase.v1.User.profile:type_name -> bytebase.v1.User.Profile+ 14, // 8: bytebase.v1.User.Profile.last_login_time:type_name -> google.protobuf.Timestamp+ 14, // 9: bytebase.v1.User.Profile.last_change_password_time:type_name -> google.protobuf.Timestamp+ 0, // 10: bytebase.v1.UserService.GetUser:input_type -> bytebase.v1.GetUserRequest+ 1, // 11: bytebase.v1.UserService.BatchGetUsers:input_type -> bytebase.v1.BatchGetUsersRequest+ 15, // 12: bytebase.v1.UserService.GetCurrentUser:input_type -> google.protobuf.Empty+ 3, // 13: bytebase.v1.UserService.ListUsers:input_type -> bytebase.v1.ListUsersRequest+ 5, // 14: bytebase.v1.UserService.CreateUser:input_type -> bytebase.v1.CreateUserRequest+ 6, // 15: bytebase.v1.UserService.UpdateUser:input_type -> bytebase.v1.UpdateUserRequest+ 7, // 16: bytebase.v1.UserService.DeleteUser:input_type -> bytebase.v1.DeleteUserRequest+ 8, // 17: bytebase.v1.UserService.UndeleteUser:input_type -> bytebase.v1.UndeleteUserRequest+ 9, // 18: bytebase.v1.UserService.UpdateEmail:input_type -> bytebase.v1.UpdateEmailRequest+ 10, // 19: bytebase.v1.UserService.GetUser:output_type -> bytebase.v1.User+ 2, // 20: bytebase.v1.UserService.BatchGetUsers:output_type -> bytebase.v1.BatchGetUsersResponse+ 10, // 21: bytebase.v1.UserService.GetCurrentUser:output_type -> bytebase.v1.User+ 4, // 22: bytebase.v1.UserService.ListUsers:output_type -> bytebase.v1.ListUsersResponse+ 10, // 23: bytebase.v1.UserService.CreateUser:output_type -> bytebase.v1.User+ 10, // 24: bytebase.v1.UserService.UpdateUser:output_type -> bytebase.v1.User+ 15, // 25: bytebase.v1.UserService.DeleteUser:output_type -> google.protobuf.Empty+ 10, // 26: bytebase.v1.UserService.UndeleteUser:output_type -> bytebase.v1.User+ 10, // 27: bytebase.v1.UserService.UpdateEmail:output_type -> bytebase.v1.User+ 19, // [19:28] is the sub-list for method output_type+ 10, // [10:19] is the sub-list for method input_type+ 10, // [10:10] is the sub-list for extension type_name+ 10, // [10:10] is the sub-list for extension extendee+ 0, // [0:10] is the sub-list for field type_name}func init() { file_v1_user_service_proto_init() }@@ -1206,14 +983,13 @@ func file_v1_user_service_proto_init() {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: 2,- NumMessages: 13,+ NumEnums: 0,+ NumMessages: 12,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.Filediff --git a/backend/generated-go/v1/user_service_equal.pb.go b/backend/generated-go/v1/user_service_equal.pb.goindex 707eff65be..2756ada926 100644--- a/backend/generated-go/v1/user_service_equal.pb.go+++ b/backend/generated-go/v1/user_service_equal.pb.go@@ -225,9 +225,6 @@ func (x *User) Equal(y *User) bool {if x.Title != y.Title {return false}- if x.UserType != y.UserType {- return false- }if x.Password != y.Password {return false}@@ -265,35 +262,5 @@ func (x *User) Equal(y *User) bool {return false}}- if !x.WorkloadIdentityConfig.Equal(y.WorkloadIdentityConfig) {- return false- }- return true-}--func (x *WorkloadIdentityConfig) Equal(y *WorkloadIdentityConfig) bool {- if x == y {- return true- }- if x == nil || y == nil {- return x == nil && y == nil- }- if x.ProviderType != y.ProviderType {- return false- }- if x.IssuerUrl != y.IssuerUrl {- return false- }- if len(x.AllowedAudiences) != len(y.AllowedAudiences) {- return false- }- for i := 0; i < len(x.AllowedAudiences); i++ {- if x.AllowedAudiences[i] != y.AllowedAudiences[i] {- return false- }- }- if x.SubjectPattern != y.SubjectPattern {- return false- }return true}diff --git a/backend/generated-go/v1/workload_identity_service.pb.go b/backend/generated-go/v1/workload_identity_service.pb.goindex 1f51a2deb5..c26da7db4a 100644--- a/backend/generated-go/v1/workload_identity_service.pb.go+++ b/backend/generated-go/v1/workload_identity_service.pb.go@@ -26,6 +26,56 @@ const (_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20))+// ProviderType identifies the CI/CD platform.+type WorkloadIdentityConfig_ProviderType int32++const (+ WorkloadIdentityConfig_PROVIDER_TYPE_UNSPECIFIED WorkloadIdentityConfig_ProviderType = 0+ WorkloadIdentityConfig_GITHUB WorkloadIdentityConfig_ProviderType = 1+ WorkloadIdentityConfig_GITLAB WorkloadIdentityConfig_ProviderType = 2+)++// Enum value maps for WorkloadIdentityConfig_ProviderType.+var (+ WorkloadIdentityConfig_ProviderType_name = map[int32]string{+ 0: "PROVIDER_TYPE_UNSPECIFIED",+ 1: "GITHUB",+ 2: "GITLAB",+ }+ WorkloadIdentityConfig_ProviderType_value = map[string]int32{+ "PROVIDER_TYPE_UNSPECIFIED": 0,+ "GITHUB": 1,+ "GITLAB": 2,+ }+)++func (x WorkloadIdentityConfig_ProviderType) Enum() *WorkloadIdentityConfig_ProviderType {+ p := new(WorkloadIdentityConfig_ProviderType)+ *p = x+ return p+}++func (x WorkloadIdentityConfig_ProviderType) String() string {+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))+}++func (WorkloadIdentityConfig_ProviderType) Descriptor() protoreflect.EnumDescriptor {+ return file_v1_workload_identity_service_proto_enumTypes[0].Descriptor()+}++func (WorkloadIdentityConfig_ProviderType) Type() protoreflect.EnumType {+ return &file_v1_workload_identity_service_proto_enumTypes[0]+}++func (x WorkloadIdentityConfig_ProviderType) Number() protoreflect.EnumNumber {+ return protoreflect.EnumNumber(x)+}++// Deprecated: Use WorkloadIdentityConfig_ProviderType.Descriptor instead.+func (WorkloadIdentityConfig_ProviderType) EnumDescriptor() ([]byte, []int) {+ return file_v1_workload_identity_service_proto_rawDescGZIP(), []int{1, 0}+}+// WorkloadIdentity represents an external CI/CD workload identity.type WorkloadIdentity struct {state protoimpl.MessageState `protogen:"open.v1"`@@ -120,6 +170,79 @@ func (x *WorkloadIdentity) GetWorkloadIdentityConfig() *WorkloadIdentityConfig {return nil}+// WorkloadIdentityConfig for API layer+type WorkloadIdentityConfig struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ // Platform type (currently only GITHUB is supported)+ ProviderType WorkloadIdentityConfig_ProviderType `protobuf:"varint,1,opt,name=provider_type,json=providerType,proto3,enum=bytebase.v1.WorkloadIdentityConfig_ProviderType" json:"provider_type,omitempty"`+ // OIDC Issuer URL (auto-filled based on provider_type, can be overridden)+ IssuerUrl string `protobuf:"bytes,2,opt,name=issuer_url,json=issuerUrl,proto3" json:"issuer_url,omitempty"`+ // Allowed audiences for token validation+ AllowedAudiences []string `protobuf:"bytes,3,rep,name=allowed_audiences,json=allowedAudiences,proto3" json:"allowed_audiences,omitempty"`+ // Subject pattern to match (e.g., "repo:owner/repo:ref:refs/heads/main")+ SubjectPattern string `protobuf:"bytes,4,opt,name=subject_pattern,json=subjectPattern,proto3" json:"subject_pattern,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *WorkloadIdentityConfig) Reset() {+ *x = WorkloadIdentityConfig{}+ mi := &file_v1_workload_identity_service_proto_msgTypes[1]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *WorkloadIdentityConfig) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*WorkloadIdentityConfig) ProtoMessage() {}++func (x *WorkloadIdentityConfig) ProtoReflect() protoreflect.Message {+ mi := &file_v1_workload_identity_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 WorkloadIdentityConfig.ProtoReflect.Descriptor instead.+func (*WorkloadIdentityConfig) Descriptor() ([]byte, []int) {+ return file_v1_workload_identity_service_proto_rawDescGZIP(), []int{1}+}++func (x *WorkloadIdentityConfig) GetProviderType() WorkloadIdentityConfig_ProviderType {+ if x != nil {+ return x.ProviderType+ }+ return WorkloadIdentityConfig_PROVIDER_TYPE_UNSPECIFIED+}++func (x *WorkloadIdentityConfig) GetIssuerUrl() string {+ if x != nil {+ return x.IssuerUrl+ }+ return ""+}++func (x *WorkloadIdentityConfig) GetAllowedAudiences() []string {+ if x != nil {+ return x.AllowedAudiences+ }+ return nil+}++func (x *WorkloadIdentityConfig) GetSubjectPattern() string {+ if x != nil {+ return x.SubjectPattern+ }+ return ""+}+// Request message for creating a workload identity.type CreateWorkloadIdentityRequest struct {state protoimpl.MessageState `protogen:"open.v1"`@@ -138,7 +261,7 @@ type CreateWorkloadIdentityRequest struct {func (x *CreateWorkloadIdentityRequest) Reset() {*x = CreateWorkloadIdentityRequest{}- mi := &file_v1_workload_identity_service_proto_msgTypes[1]+ mi := &file_v1_workload_identity_service_proto_msgTypes[2]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -150,7 +273,7 @@ func (x *CreateWorkloadIdentityRequest) String() string {func (*CreateWorkloadIdentityRequest) ProtoMessage() {}func (x *CreateWorkloadIdentityRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_workload_identity_service_proto_msgTypes[1]+ mi := &file_v1_workload_identity_service_proto_msgTypes[2]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -163,7 +286,7 @@ func (x *CreateWorkloadIdentityRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use CreateWorkloadIdentityRequest.ProtoReflect.Descriptor instead.func (*CreateWorkloadIdentityRequest) Descriptor() ([]byte, []int) {- return file_v1_workload_identity_service_proto_rawDescGZIP(), []int{1}+ return file_v1_workload_identity_service_proto_rawDescGZIP(), []int{2}}func (x *CreateWorkloadIdentityRequest) GetParent() string {@@ -199,7 +322,7 @@ type GetWorkloadIdentityRequest struct {func (x *GetWorkloadIdentityRequest) Reset() {*x = GetWorkloadIdentityRequest{}- mi := &file_v1_workload_identity_service_proto_msgTypes[2]+ mi := &file_v1_workload_identity_service_proto_msgTypes[3]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -211,7 +334,7 @@ func (x *GetWorkloadIdentityRequest) String() string {func (*GetWorkloadIdentityRequest) ProtoMessage() {}func (x *GetWorkloadIdentityRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_workload_identity_service_proto_msgTypes[2]+ mi := &file_v1_workload_identity_service_proto_msgTypes[3]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -224,7 +347,7 @@ func (x *GetWorkloadIdentityRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use GetWorkloadIdentityRequest.ProtoReflect.Descriptor instead.func (*GetWorkloadIdentityRequest) Descriptor() ([]byte, []int) {- return file_v1_workload_identity_service_proto_rawDescGZIP(), []int{2}+ return file_v1_workload_identity_service_proto_rawDescGZIP(), []int{3}}func (x *GetWorkloadIdentityRequest) GetName() string {@@ -274,7 +397,7 @@ type ListWorkloadIdentitiesRequest struct {func (x *ListWorkloadIdentitiesRequest) Reset() {*x = ListWorkloadIdentitiesRequest{}- mi := &file_v1_workload_identity_service_proto_msgTypes[3]+ mi := &file_v1_workload_identity_service_proto_msgTypes[4]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -286,7 +409,7 @@ func (x *ListWorkloadIdentitiesRequest) String() string {func (*ListWorkloadIdentitiesRequest) ProtoMessage() {}func (x *ListWorkloadIdentitiesRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_workload_identity_service_proto_msgTypes[3]+ mi := &file_v1_workload_identity_service_proto_msgTypes[4]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -299,7 +422,7 @@ func (x *ListWorkloadIdentitiesRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use ListWorkloadIdentitiesRequest.ProtoReflect.Descriptor instead.func (*ListWorkloadIdentitiesRequest) Descriptor() ([]byte, []int) {- return file_v1_workload_identity_service_proto_rawDescGZIP(), []int{3}+ return file_v1_workload_identity_service_proto_rawDescGZIP(), []int{4}}func (x *ListWorkloadIdentitiesRequest) GetParent() string {@@ -351,7 +474,7 @@ type ListWorkloadIdentitiesResponse struct {func (x *ListWorkloadIdentitiesResponse) Reset() {*x = ListWorkloadIdentitiesResponse{}- mi := &file_v1_workload_identity_service_proto_msgTypes[4]+ mi := &file_v1_workload_identity_service_proto_msgTypes[5]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -363,7 +486,7 @@ func (x *ListWorkloadIdentitiesResponse) String() string {func (*ListWorkloadIdentitiesResponse) ProtoMessage() {}func (x *ListWorkloadIdentitiesResponse) ProtoReflect() protoreflect.Message {- mi := &file_v1_workload_identity_service_proto_msgTypes[4]+ mi := &file_v1_workload_identity_service_proto_msgTypes[5]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -376,7 +499,7 @@ func (x *ListWorkloadIdentitiesResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use ListWorkloadIdentitiesResponse.ProtoReflect.Descriptor instead.func (*ListWorkloadIdentitiesResponse) Descriptor() ([]byte, []int) {- return file_v1_workload_identity_service_proto_rawDescGZIP(), []int{4}+ return file_v1_workload_identity_service_proto_rawDescGZIP(), []int{5}}func (x *ListWorkloadIdentitiesResponse) GetWorkloadIdentities() []*WorkloadIdentity {@@ -410,7 +533,7 @@ type UpdateWorkloadIdentityRequest struct {func (x *UpdateWorkloadIdentityRequest) Reset() {*x = UpdateWorkloadIdentityRequest{}- mi := &file_v1_workload_identity_service_proto_msgTypes[5]+ mi := &file_v1_workload_identity_service_proto_msgTypes[6]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -422,7 +545,7 @@ func (x *UpdateWorkloadIdentityRequest) String() string {func (*UpdateWorkloadIdentityRequest) ProtoMessage() {}func (x *UpdateWorkloadIdentityRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_workload_identity_service_proto_msgTypes[5]+ mi := &file_v1_workload_identity_service_proto_msgTypes[6]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -435,7 +558,7 @@ func (x *UpdateWorkloadIdentityRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use UpdateWorkloadIdentityRequest.ProtoReflect.Descriptor instead.func (*UpdateWorkloadIdentityRequest) Descriptor() ([]byte, []int) {- return file_v1_workload_identity_service_proto_rawDescGZIP(), []int{5}+ return file_v1_workload_identity_service_proto_rawDescGZIP(), []int{6}}func (x *UpdateWorkloadIdentityRequest) GetWorkloadIdentity() *WorkloadIdentity {@@ -464,7 +587,7 @@ type DeleteWorkloadIdentityRequest struct {func (x *DeleteWorkloadIdentityRequest) Reset() {*x = DeleteWorkloadIdentityRequest{}- mi := &file_v1_workload_identity_service_proto_msgTypes[6]+ mi := &file_v1_workload_identity_service_proto_msgTypes[7]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -476,7 +599,7 @@ func (x *DeleteWorkloadIdentityRequest) String() string {func (*DeleteWorkloadIdentityRequest) ProtoMessage() {}func (x *DeleteWorkloadIdentityRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_workload_identity_service_proto_msgTypes[6]+ mi := &file_v1_workload_identity_service_proto_msgTypes[7]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -489,7 +612,7 @@ func (x *DeleteWorkloadIdentityRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use DeleteWorkloadIdentityRequest.ProtoReflect.Descriptor instead.func (*DeleteWorkloadIdentityRequest) Descriptor() ([]byte, []int) {- return file_v1_workload_identity_service_proto_rawDescGZIP(), []int{6}+ return file_v1_workload_identity_service_proto_rawDescGZIP(), []int{7}}func (x *DeleteWorkloadIdentityRequest) GetName() string {@@ -511,7 +634,7 @@ type UndeleteWorkloadIdentityRequest struct {func (x *UndeleteWorkloadIdentityRequest) Reset() {*x = UndeleteWorkloadIdentityRequest{}- mi := &file_v1_workload_identity_service_proto_msgTypes[7]+ mi := &file_v1_workload_identity_service_proto_msgTypes[8]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -523,7 +646,7 @@ func (x *UndeleteWorkloadIdentityRequest) String() string {func (*UndeleteWorkloadIdentityRequest) ProtoMessage() {}func (x *UndeleteWorkloadIdentityRequest) ProtoReflect() protoreflect.Message {- mi := &file_v1_workload_identity_service_proto_msgTypes[7]+ mi := &file_v1_workload_identity_service_proto_msgTypes[8]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -536,7 +659,7 @@ func (x *UndeleteWorkloadIdentityRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use UndeleteWorkloadIdentityRequest.ProtoReflect.Descriptor instead.func (*UndeleteWorkloadIdentityRequest) Descriptor() ([]byte, []int) {- return file_v1_workload_identity_service_proto_rawDescGZIP(), []int{7}+ return file_v1_workload_identity_service_proto_rawDescGZIP(), []int{8}}func (x *UndeleteWorkloadIdentityRequest) GetName() string {@@ -550,7 +673,7 @@ var File_v1_workload_identity_service_proto protoreflect.FileDescriptorconst file_v1_workload_identity_service_proto_rawDesc = "" +"\n" +- "\"v1/workload_identity_service.proto\x12\vbytebase.v1\x1a\x1bbuf/validate/validate.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x13v1/annotation.proto\x1a\x0fv1/common.proto\x1a\x15v1/user_service.proto\"\xf1\x02\n" ++ "\"v1/workload_identity_service.proto\x12\vbytebase.v1\x1a\x1bbuf/validate/validate.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x13v1/annotation.proto\x1a\x0fv1/common.proto\"\xf1\x02\n" +"\x10WorkloadIdentity\x12\x17\n" +"\x04name\x18\x01 \x01(\tB\x03\xe0A\x03R\x04name\x12(\n" +"\x05state\x18\x02 \x01(\x0e2\x12.bytebase.v1.StateR\x05state\x12\x19\n" +@@ -559,7 +682,19 @@ const file_v1_workload_identity_service_proto_rawDesc = "" +"\vcreate_time\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" +"createTime\x12]\n" +"\x18workload_identity_config\x18\x06 \x01(\v2#.bytebase.v1.WorkloadIdentityConfigR\x16workloadIdentityConfig:>\xeaA;\n" +- "\x1dbytebase.com/WorkloadIdentity\x12\x1aworkloadIdentities/{email}\"\xda\x01\n" ++ "\x1dbytebase.com/WorkloadIdentity\x12\x1aworkloadIdentities/{email}\"\xab\x02\n" ++ "\x16WorkloadIdentityConfig\x12U\n" ++ "\rprovider_type\x18\x01 \x01(\x0e20.bytebase.v1.WorkloadIdentityConfig.ProviderTypeR\fproviderType\x12\x1d\n" ++ "\n" ++ "issuer_url\x18\x02 \x01(\tR\tissuerUrl\x12+\n" ++ "\x11allowed_audiences\x18\x03 \x03(\tR\x10allowedAudiences\x12'\n" ++ "\x0fsubject_pattern\x18\x04 \x01(\tR\x0esubjectPattern\"E\n" ++ "\fProviderType\x12\x1d\n" ++ "\x19PROVIDER_TYPE_UNSPECIFIED\x10\x00\x12\n" ++ "\n" ++ "\x06GITHUB\x10\x01\x12\n" ++ "\n" ++ "\x06GITLAB\x10\x02\"\xda\x01\n" +"\x1dCreateWorkloadIdentityRequest\x121\n" +"\x06parent\x18\x01 \x01(\tB\x19\xfaA\x16\n" +"\x14bytebase.com/ProjectR\x06parent\x125\n" +@@ -610,47 +745,50 @@ func file_v1_workload_identity_service_proto_rawDescGZIP() []byte {return file_v1_workload_identity_service_proto_rawDescData}-var file_v1_workload_identity_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8)+var file_v1_workload_identity_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)+var file_v1_workload_identity_service_proto_msgTypes = make([]protoimpl.MessageInfo, 9)var file_v1_workload_identity_service_proto_goTypes = []any{- (*WorkloadIdentity)(nil), // 0: bytebase.v1.WorkloadIdentity- (*CreateWorkloadIdentityRequest)(nil), // 1: bytebase.v1.CreateWorkloadIdentityRequest- (*GetWorkloadIdentityRequest)(nil), // 2: bytebase.v1.GetWorkloadIdentityRequest- (*ListWorkloadIdentitiesRequest)(nil), // 3: bytebase.v1.ListWorkloadIdentitiesRequest- (*ListWorkloadIdentitiesResponse)(nil), // 4: bytebase.v1.ListWorkloadIdentitiesResponse- (*UpdateWorkloadIdentityRequest)(nil), // 5: bytebase.v1.UpdateWorkloadIdentityRequest- (*DeleteWorkloadIdentityRequest)(nil), // 6: bytebase.v1.DeleteWorkloadIdentityRequest- (*UndeleteWorkloadIdentityRequest)(nil), // 7: bytebase.v1.UndeleteWorkloadIdentityRequest- (State)(0), // 8: bytebase.v1.State- (*timestamppb.Timestamp)(nil), // 9: google.protobuf.Timestamp- (*WorkloadIdentityConfig)(nil), // 10: bytebase.v1.WorkloadIdentityConfig- (*fieldmaskpb.FieldMask)(nil), // 11: google.protobuf.FieldMask- (*emptypb.Empty)(nil), // 12: google.protobuf.Empty+ (WorkloadIdentityConfig_ProviderType)(0), // 0: bytebase.v1.WorkloadIdentityConfig.ProviderType+ (*WorkloadIdentity)(nil), // 1: bytebase.v1.WorkloadIdentity+ (*WorkloadIdentityConfig)(nil), // 2: bytebase.v1.WorkloadIdentityConfig+ (*CreateWorkloadIdentityRequest)(nil), // 3: bytebase.v1.CreateWorkloadIdentityRequest+ (*GetWorkloadIdentityRequest)(nil), // 4: bytebase.v1.GetWorkloadIdentityRequest+ (*ListWorkloadIdentitiesRequest)(nil), // 5: bytebase.v1.ListWorkloadIdentitiesRequest+ (*ListWorkloadIdentitiesResponse)(nil), // 6: bytebase.v1.ListWorkloadIdentitiesResponse+ (*UpdateWorkloadIdentityRequest)(nil), // 7: bytebase.v1.UpdateWorkloadIdentityRequest+ (*DeleteWorkloadIdentityRequest)(nil), // 8: bytebase.v1.DeleteWorkloadIdentityRequest+ (*UndeleteWorkloadIdentityRequest)(nil), // 9: bytebase.v1.UndeleteWorkloadIdentityRequest+ (State)(0), // 10: bytebase.v1.State+ (*timestamppb.Timestamp)(nil), // 11: google.protobuf.Timestamp+ (*fieldmaskpb.FieldMask)(nil), // 12: google.protobuf.FieldMask+ (*emptypb.Empty)(nil), // 13: google.protobuf.Empty}var file_v1_workload_identity_service_proto_depIdxs = []int32{- 8, // 0: bytebase.v1.WorkloadIdentity.state:type_name -> bytebase.v1.State- 9, // 1: bytebase.v1.WorkloadIdentity.create_time:type_name -> google.protobuf.Timestamp- 10, // 2: bytebase.v1.WorkloadIdentity.workload_identity_config:type_name -> bytebase.v1.WorkloadIdentityConfig- 0, // 3: bytebase.v1.CreateWorkloadIdentityRequest.workload_identity:type_name -> bytebase.v1.WorkloadIdentity- 0, // 4: bytebase.v1.ListWorkloadIdentitiesResponse.workload_identities:type_name -> bytebase.v1.WorkloadIdentity- 0, // 5: bytebase.v1.UpdateWorkloadIdentityRequest.workload_identity:type_name -> bytebase.v1.WorkloadIdentity- 11, // 6: bytebase.v1.UpdateWorkloadIdentityRequest.update_mask:type_name -> google.protobuf.FieldMask- 1, // 7: bytebase.v1.WorkloadIdentityService.CreateWorkloadIdentity:input_type -> bytebase.v1.CreateWorkloadIdentityRequest- 2, // 8: bytebase.v1.WorkloadIdentityService.GetWorkloadIdentity:input_type -> bytebase.v1.GetWorkloadIdentityRequest- 3, // 9: bytebase.v1.WorkloadIdentityService.ListWorkloadIdentities:input_type -> bytebase.v1.ListWorkloadIdentitiesRequest- 5, // 10: bytebase.v1.WorkloadIdentityService.UpdateWorkloadIdentity:input_type -> bytebase.v1.UpdateWorkloadIdentityRequest- 6, // 11: bytebase.v1.WorkloadIdentityService.DeleteWorkloadIdentity:input_type -> bytebase.v1.DeleteWorkloadIdentityRequest- 7, // 12: bytebase.v1.WorkloadIdentityService.UndeleteWorkloadIdentity:input_type -> bytebase.v1.UndeleteWorkloadIdentityRequest- 0, // 13: bytebase.v1.WorkloadIdentityService.CreateWorkloadIdentity:output_type -> bytebase.v1.WorkloadIdentity- 0, // 14: bytebase.v1.WorkloadIdentityService.GetWorkloadIdentity:output_type -> bytebase.v1.WorkloadIdentity- 4, // 15: bytebase.v1.WorkloadIdentityService.ListWorkloadIdentities:output_type -> bytebase.v1.ListWorkloadIdentitiesResponse- 0, // 16: bytebase.v1.WorkloadIdentityService.UpdateWorkloadIdentity:output_type -> bytebase.v1.WorkloadIdentity- 12, // 17: bytebase.v1.WorkloadIdentityService.DeleteWorkloadIdentity:output_type -> google.protobuf.Empty- 0, // 18: bytebase.v1.WorkloadIdentityService.UndeleteWorkloadIdentity:output_type -> bytebase.v1.WorkloadIdentity- 13, // [13:19] is the sub-list for method output_type- 7, // [7:13] is the sub-list for method input_type- 7, // [7:7] is the sub-list for extension type_name- 7, // [7:7] is the sub-list for extension extendee- 0, // [0:7] is the sub-list for field type_name+ 10, // 0: bytebase.v1.WorkloadIdentity.state:type_name -> bytebase.v1.State+ 11, // 1: bytebase.v1.WorkloadIdentity.create_time:type_name -> google.protobuf.Timestamp+ 2, // 2: bytebase.v1.WorkloadIdentity.workload_identity_config:type_name -> bytebase.v1.WorkloadIdentityConfig+ 0, // 3: bytebase.v1.WorkloadIdentityConfig.provider_type:type_name -> bytebase.v1.WorkloadIdentityConfig.ProviderType+ 1, // 4: bytebase.v1.CreateWorkloadIdentityRequest.workload_identity:type_name -> bytebase.v1.WorkloadIdentity+ 1, // 5: bytebase.v1.ListWorkloadIdentitiesResponse.workload_identities:type_name -> bytebase.v1.WorkloadIdentity+ 1, // 6: bytebase.v1.UpdateWorkloadIdentityRequest.workload_identity:type_name -> bytebase.v1.WorkloadIdentity+ 12, // 7: bytebase.v1.UpdateWorkloadIdentityRequest.update_mask:type_name -> google.protobuf.FieldMask+ 3, // 8: bytebase.v1.WorkloadIdentityService.CreateWorkloadIdentity:input_type -> bytebase.v1.CreateWorkloadIdentityRequest+ 4, // 9: bytebase.v1.WorkloadIdentityService.GetWorkloadIdentity:input_type -> bytebase.v1.GetWorkloadIdentityRequest+ 5, // 10: bytebase.v1.WorkloadIdentityService.ListWorkloadIdentities:input_type -> bytebase.v1.ListWorkloadIdentitiesRequest+ 7, // 11: bytebase.v1.WorkloadIdentityService.UpdateWorkloadIdentity:input_type -> bytebase.v1.UpdateWorkloadIdentityRequest+ 8, // 12: bytebase.v1.WorkloadIdentityService.DeleteWorkloadIdentity:input_type -> bytebase.v1.DeleteWorkloadIdentityRequest+ 9, // 13: bytebase.v1.WorkloadIdentityService.UndeleteWorkloadIdentity:input_type -> bytebase.v1.UndeleteWorkloadIdentityRequest+ 1, // 14: bytebase.v1.WorkloadIdentityService.CreateWorkloadIdentity:output_type -> bytebase.v1.WorkloadIdentity+ 1, // 15: bytebase.v1.WorkloadIdentityService.GetWorkloadIdentity:output_type -> bytebase.v1.WorkloadIdentity+ 6, // 16: bytebase.v1.WorkloadIdentityService.ListWorkloadIdentities:output_type -> bytebase.v1.ListWorkloadIdentitiesResponse+ 1, // 17: bytebase.v1.WorkloadIdentityService.UpdateWorkloadIdentity:output_type -> bytebase.v1.WorkloadIdentity+ 13, // 18: bytebase.v1.WorkloadIdentityService.DeleteWorkloadIdentity:output_type -> google.protobuf.Empty+ 1, // 19: bytebase.v1.WorkloadIdentityService.UndeleteWorkloadIdentity:output_type -> bytebase.v1.WorkloadIdentity+ 14, // [14:20] is the sub-list for method output_type+ 8, // [8:14] is the sub-list for method input_type+ 8, // [8:8] is the sub-list for extension type_name+ 8, // [8:8] is the sub-list for extension extendee+ 0, // [0:8] is the sub-list for field type_name}func init() { file_v1_workload_identity_service_proto_init() }@@ -660,19 +798,19 @@ func file_v1_workload_identity_service_proto_init() {}file_v1_annotation_proto_init()file_v1_common_proto_init()- file_v1_user_service_proto_init()type x struct{}out := protoimpl.TypeBuilder{File: protoimpl.DescBuilder{GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_workload_identity_service_proto_rawDesc), len(file_v1_workload_identity_service_proto_rawDesc)),- NumEnums: 0,- NumMessages: 8,+ NumEnums: 1,+ NumMessages: 9,NumExtensions: 0,NumServices: 1,},GoTypes: file_v1_workload_identity_service_proto_goTypes,DependencyIndexes: file_v1_workload_identity_service_proto_depIdxs,+ EnumInfos: file_v1_workload_identity_service_proto_enumTypes,MessageInfos: file_v1_workload_identity_service_proto_msgTypes,}.Build()File_v1_workload_identity_service_proto = out.Filediff --git a/backend/generated-go/v1/workload_identity_service_equal.pb.go b/backend/generated-go/v1/workload_identity_service_equal.pb.goindex 52a495d7e5..9fe75b2b1a 100644--- a/backend/generated-go/v1/workload_identity_service_equal.pb.go+++ b/backend/generated-go/v1/workload_identity_service_equal.pb.go@@ -36,6 +36,33 @@ func (x *WorkloadIdentity) Equal(y *WorkloadIdentity) bool {return true}+func (x *WorkloadIdentityConfig) Equal(y *WorkloadIdentityConfig) bool {+ if x == y {+ return true+ }+ if x == nil || y == nil {+ return x == nil && y == nil+ }+ if x.ProviderType != y.ProviderType {+ return false+ }+ if x.IssuerUrl != y.IssuerUrl {+ return false+ }+ if len(x.AllowedAudiences) != len(y.AllowedAudiences) {+ return false+ }+ for i := 0; i < len(x.AllowedAudiences); i++ {+ if x.AllowedAudiences[i] != y.AllowedAudiences[i] {+ return false+ }+ }+ if x.SubjectPattern != y.SubjectPattern {+ return false+ }+ return true+}+func (x *CreateWorkloadIdentityRequest) Equal(y *CreateWorkloadIdentityRequest) bool {if x == y {return truediff --git a/backend/migrator/migration/3.16/0000##split_principal_table.sql b/backend/migrator/migration/3.16/0000##split_principal_table.sqlnew file mode 100644index 0000000000..e789267a9f--- /dev/null+++ b/backend/migrator/migration/3.16/0000##split_principal_table.sql@@ -0,0 +1,103 @@+-- Split principal table into three tables: principal (END_USER only), service_account, workload_identity.++-- Step 0: Fix legacy service account emails that don't match the required format.+-- Valid formats: {name}@service.bytebase.com OR {name}@{project}.service.bytebase.com+-- This MUST run BEFORE dropping FK constraints so that ON UPDATE CASCADE propagates email+-- changes to all creator/deleter columns automatically.+DO $$+DECLARE+ rec RECORD;+ new_email TEXT;+ base_local TEXT;+BEGIN+ FOR rec IN+ SELECT id, email, project+ FROM principal+ WHERE type = 'SERVICE_ACCOUNT'+ AND email NOT LIKE '%@service.bytebase.com'+ AND email NOT LIKE '%@%.service.bytebase.com'+ LOOP+ base_local := split_part(rec.email, '@', 1);+ IF rec.project IS NOT NULL THEN+ new_email := base_local || '@' || rec.project || '.service.bytebase.com';+ ELSE+ new_email := base_local || '@service.bytebase.com';+ END IF;+ -- Handle potential email collision by appending id+ IF EXISTS (SELECT 1 FROM principal WHERE email = new_email AND id != rec.id) THEN+ IF rec.project IS NOT NULL THEN+ new_email := base_local || '-' || rec.id || '@' || rec.project || '.service.bytebase.com';+ ELSE+ new_email := base_local || '-' || rec.id || '@service.bytebase.com';+ END IF;+ END IF;+ -- Update principal email (ON UPDATE CASCADE propagates to creator/deleter columns)+ UPDATE principal SET email = new_email WHERE id = rec.id;+ -- Update JSONB references in policies (members use 'serviceAccounts/{email}' format)+ UPDATE policy+ SET payload = replace(payload::text, 'serviceAccounts/' || rec.email, 'serviceAccounts/' || new_email)::jsonb+ WHERE payload::text LIKE '%serviceAccounts/' || rec.email || '%';+ -- Update user_group member references+ UPDATE user_group+ SET payload = replace(payload::text, 'serviceAccounts/' || rec.email, 'serviceAccounts/' || new_email)::jsonb+ WHERE payload::text LIKE '%serviceAccounts/' || rec.email || '%';+ END LOOP;+END $$;++-- Step 1: Create service_account table+CREATE TABLE service_account (+ deleted boolean NOT NULL DEFAULT FALSE,+ created_at timestamptz NOT NULL DEFAULT now(),+ name text NOT NULL,+ email text NOT NULL PRIMARY KEY,+ service_key_hash text NOT NULL,+ project text REFERENCES project(resource_id)+);++CREATE INDEX idx_service_account_project ON service_account(project) WHERE project IS NOT NULL;++INSERT INTO service_account (deleted, created_at, name, email, service_key_hash, project)+SELECT deleted, created_at, name, email, password_hash, project+FROM principal WHERE type = 'SERVICE_ACCOUNT';++-- Step 2: Create workload_identity table+CREATE TABLE workload_identity (+ deleted boolean NOT NULL DEFAULT FALSE,+ created_at timestamptz NOT NULL DEFAULT now(),+ name text NOT NULL,+ email text NOT NULL PRIMARY KEY,+ project text REFERENCES project(resource_id),+ -- Stored as WorkloadIdentityConfig (proto/store/store/user.proto)+ config jsonb NOT NULL DEFAULT '{}'+);++CREATE INDEX idx_workload_identity_project ON workload_identity(project) WHERE project IS NOT NULL;++INSERT INTO workload_identity (deleted, created_at, name, email, project, config)+SELECT deleted, created_at, name, email, project,+ COALESCE(profile->'workloadIdentityConfig', '{}')+FROM principal WHERE type = 'WORKLOAD_IDENTITY';++-- Step 3: Drop FK constraints on creator/deleter columns that can reference SA/WI emails.+-- Keep FKs on oauth2_authorization_code, oauth2_refresh_token, web_refresh_token (END_USER only).+ALTER TABLE plan DROP CONSTRAINT IF EXISTS plan_creator_fkey;+ALTER TABLE task_run DROP CONSTRAINT IF EXISTS task_run_creator_fkey;+ALTER TABLE issue DROP CONSTRAINT IF EXISTS issue_creator_fkey;+ALTER TABLE issue_comment DROP CONSTRAINT IF EXISTS issue_comment_creator_fkey;+ALTER TABLE query_history DROP CONSTRAINT IF EXISTS query_history_creator_fkey;+ALTER TABLE worksheet DROP CONSTRAINT IF EXISTS worksheet_creator_fkey;+ALTER TABLE worksheet_organizer DROP CONSTRAINT IF EXISTS worksheet_organizer_principal_fkey;+ALTER TABLE revision DROP CONSTRAINT IF EXISTS revision_deleter_fkey;+ALTER TABLE release DROP CONSTRAINT IF EXISTS release_creator_fkey;+ALTER TABLE access_grant DROP CONSTRAINT IF EXISTS access_grant_creator_fkey;++-- Step 4: Add missing index for plan.creator (queried in plan filter)+CREATE INDEX idx_plan_creator ON plan(creator);++-- Step 5: Clean up principal table+DELETE FROM principal WHERE type != 'END_USER';+ALTER TABLE principal DROP CONSTRAINT IF EXISTS principal_project_type_check;+ALTER TABLE principal DROP CONSTRAINT IF EXISTS principal_type_check;+ALTER TABLE principal DROP COLUMN type;+ALTER TABLE principal DROP COLUMN project;+DROP INDEX IF EXISTS idx_principal_project;diff --git a/backend/migrator/migration/LATEST.sql b/backend/migrator/migration/LATEST.sqlindex 0d00f49c4c..6858c8e74a 100644--- a/backend/migrator/migration/LATEST.sql+++ b/backend/migrator/migration/LATEST.sql@@ -33,7 +33,6 @@ CREATE TABLE principal (id serial PRIMARY KEY,deleted boolean NOT NULL DEFAULT FALSE,created_at timestamptz NOT NULL DEFAULT now(),- type text NOT NULL CHECK (type IN ('END_USER', 'SERVICE_ACCOUNT', 'WORKLOAD_IDENTITY')),name text NOT NULL,email text NOT NULL,password_hash text NOT NULL,@@ -41,18 +40,35 @@ CREATE TABLE principal (-- Stored as MFAConfig (proto/store/store/user.proto)mfa_config jsonb NOT NULL DEFAULT '{}',-- Stored as UserProfile (proto/store/store/user.proto)- profile jsonb NOT NULL DEFAULT '{}',- -- project references the owning project for SERVICE_ACCOUNT and WORKLOAD_IDENTITY.- -- NULL for END_USER/SYSTEM_BOT, and for workspace-level SERVICE_ACCOUNT/WORKLOAD_IDENTITY.- project text REFERENCES project(resource_id),- CONSTRAINT principal_project_type_check CHECK (- (type = 'END_USER' AND project IS NULL) OR- (type IN ('SERVICE_ACCOUNT', 'WORKLOAD_IDENTITY'))- )+ profile jsonb NOT NULL DEFAULT '{}');CREATE UNIQUE INDEX idx_principal_unique_email ON principal(email);-CREATE INDEX idx_principal_project ON principal(project) WHERE project IS NOT NULL;++-- service_account+CREATE TABLE service_account (+ deleted boolean NOT NULL DEFAULT FALSE,+ created_at timestamptz NOT NULL DEFAULT now(),+ name text NOT NULL,+ email text NOT NULL PRIMARY KEY,+ service_key_hash text NOT NULL,+ project text REFERENCES project(resource_id)+);++CREATE INDEX idx_service_account_project ON service_account(project) WHERE project IS NOT NULL;++-- workload_identity+CREATE TABLE workload_identity (+ deleted boolean NOT NULL DEFAULT FALSE,+ created_at timestamptz NOT NULL DEFAULT now(),+ name text NOT NULL,+ email text NOT NULL PRIMARY KEY,+ project text REFERENCES project(resource_id),+ -- Stored as WorkloadIdentityConfig (proto/store/store/user.proto)+ config jsonb NOT NULL DEFAULT '{}'+);++CREATE INDEX idx_workload_identity_project ON workload_identity(project) WHERE project IS NOT NULL;-- SettingCREATE TABLE setting (@@ -187,7 +203,7 @@ CREATE TABLE sheet_blob (CREATE TABLE plan (id bigserial PRIMARY KEY,deleted boolean NOT NULL DEFAULT FALSE,- creator text NOT NULL REFERENCES principal(email) ON UPDATE CASCADE,+ creator text NOT NULL,created_at timestamptz NOT NULL DEFAULT now(),updated_at timestamptz NOT NULL DEFAULT now(),project text NOT NULL REFERENCES project(resource_id),@@ -198,6 +214,7 @@ CREATE TABLE plan ();CREATE INDEX idx_plan_project ON plan(project);+CREATE INDEX idx_plan_creator ON plan(creator);CREATE INDEX idx_plan_config_has_rollout ON plan ((config->>'hasRollout'));ALTER SEQUENCE plan_id_seq RESTART WITH 101;@@ -247,7 +264,7 @@ ALTER SEQUENCE task_id_seq RESTART WITH 101;-- task run table stores the task runCREATE TABLE task_run (id serial PRIMARY KEY,- creator text REFERENCES principal(email) ON UPDATE CASCADE ON DELETE SET NULL,+ creator text,created_at timestamptz NOT NULL DEFAULT now(),updated_at timestamptz NOT NULL DEFAULT now(),task_id integer NOT NULL REFERENCES task(id),@@ -300,7 +317,7 @@ ALTER SEQUENCE task_run_log_id_seq RESTART WITH 101;-- issueCREATE TABLE issue (id serial PRIMARY KEY,- creator text NOT NULL REFERENCES principal(email) ON UPDATE CASCADE,+ creator text NOT NULL,created_at timestamptz NOT NULL DEFAULT now(),updated_at timestamptz NOT NULL DEFAULT now(),project text NOT NULL REFERENCES project(resource_id),@@ -357,7 +374,7 @@ ALTER SEQUENCE audit_log_id_seq RESTART WITH 101;CREATE TABLE issue_comment (id bigserial PRIMARY KEY,- creator text NOT NULL REFERENCES principal(email) ON UPDATE CASCADE,+ creator text NOT NULL,created_at timestamptz NOT NULL DEFAULT now(),updated_at timestamptz NOT NULL DEFAULT now(),issue_id integer NOT NULL REFERENCES issue(id),@@ -371,7 +388,7 @@ ALTER SEQUENCE issue_comment_id_seq RESTART WITH 101;CREATE TABLE query_history (id bigserial PRIMARY KEY,- creator text NOT NULL REFERENCES principal(email) ON UPDATE CASCADE,+ creator text NOT NULL,created_at timestamptz NOT NULL DEFAULT now(),project_id text NOT NULL, -- the project resource iddatabase text NOT NULL, -- the database resource name, for example, instances/{instance}/databases/{database}@@ -390,7 +407,7 @@ ALTER SEQUENCE query_history_id_seq RESTART WITH 101;-- worksheet table stores worksheets in SQL Editor.CREATE TABLE worksheet (id serial PRIMARY KEY,- creator text NOT NULL REFERENCES principal(email) ON UPDATE CASCADE,+ creator text NOT NULL,created_at timestamptz NOT NULL DEFAULT now(),updated_at timestamptz NOT NULL DEFAULT now(),project text NOT NULL REFERENCES project(resource_id),@@ -412,7 +429,7 @@ ALTER SEQUENCE worksheet_id_seq RESTART WITH 101;CREATE TABLE worksheet_organizer (id serial PRIMARY KEY,worksheet_id integer NOT NULL REFERENCES worksheet(id) ON DELETE CASCADE,- principal text NOT NULL REFERENCES principal(email) ON UPDATE CASCADE,+ principal text NOT NULL,payload jsonb NOT NULL DEFAULT '{}');@@ -470,7 +487,7 @@ CREATE TABLE revision (instance text NOT NULL,db_name text NOT NULL,created_at timestamptz NOT NULL DEFAULT now(),- deleter text REFERENCES principal(email) ON UPDATE CASCADE,+ deleter text,deleted_at timestamptz,version text NOT NULL,-- Stored as RevisionPayload (proto/store/store/revision.proto)@@ -520,7 +537,7 @@ CREATE TABLE release (deleted boolean NOT NULL DEFAULT FALSE,project text NOT NULL REFERENCES project(resource_id),release_id text NOT NULL DEFAULT '',- creator text NOT NULL REFERENCES principal(email) ON UPDATE CASCADE,+ creator text NOT NULL,created_at timestamptz NOT NULL DEFAULT now(),train text NOT NULL DEFAULT '',iteration integer NOT NULL DEFAULT 0,@@ -578,7 +595,7 @@ ALTER SEQUENCE principal_id_seq RESTART WITH 101;CREATE TABLE access_grant (id text PRIMARY KEY,project text NOT NULL REFERENCES project(resource_id),- creator text NOT NULL REFERENCES principal(email) ON UPDATE CASCADE,+ creator text NOT NULL,status text NOT NULL DEFAULT 'PENDING',expire_time timestamptz,-- Stored as AccessGrantPayload (proto/store/store/access_grant.proto)diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.goindex 91787b01d6..3347e33d0c 100644--- a/backend/migrator/migrator_test.go+++ b/backend/migrator/migrator_test.go@@ -15,8 +15,8 @@ import (func TestLatestVersion(t *testing.T) {files, err := getSortedVersionedFiles()require.NoError(t, err)- require.Equal(t, semver.MustParse("3.15.11"), *files[len(files)-1].version)- require.Equal(t, "migration/3.15/0011##fix_legacy_issue_with_approval_flow.sql", files[len(files)-1].path)+ require.Equal(t, semver.MustParse("3.16.0"), *files[len(files)-1].version)+ require.Equal(t, "migration/3.16/0000##split_principal_table.sql", files[len(files)-1].path)}func TestVersionUnique(t *testing.T) {diff --git a/backend/store/account.go b/backend/store/account.gonew file mode 100644index 0000000000..c165d5acee--- /dev/null+++ b/backend/store/account.go@@ -0,0 +1,65 @@+package store++import (+ "context"++ "github.com/bytebase/bytebase/backend/common"+ storepb "github.com/bytebase/bytebase/backend/generated-go/store"+)++// GetPrincipalByEmail gets any principal (user, service account, or workload identity) by email.+// This is used by the auth layer where the JWT subject can be any principal type.+// It determines the principal type by the email format and calls the appropriate method.+func (s *Store) GetPrincipalByEmail(ctx context.Context, email string) (*UserMessage, error) {+ // Use the unified cache first for all types+ if v, ok := s.userEmailCache.Get(email); ok && s.enableCache {+ return v, nil+ }++ // Determine principal type by email format and query accordingly+ if common.IsServiceAccountEmail(email) {+ sa, err := s.GetServiceAccountByEmail(ctx, email)+ if err != nil {+ return nil, err+ }+ if sa == nil {+ return nil, nil+ }+ // Convert to UserMessage for compatibility with auth layer+ user := &UserMessage{+ Email: sa.Email,+ Name: sa.Name,+ PasswordHash: sa.ServiceKeyHash,+ Type: storepb.PrincipalType_SERVICE_ACCOUNT,+ MemberDeleted: sa.MemberDeleted,+ MFAConfig: &storepb.MFAConfig{},+ Profile: &storepb.UserProfile{},+ }+ s.userEmailCache.Add(user.Email, user)+ return user, nil+ }++ if common.IsWorkloadIdentityEmail(email) {+ wi, err := s.GetWorkloadIdentityByEmail(ctx, email)+ if err != nil {+ return nil, err+ }+ if wi == nil {+ return nil, nil+ }+ // Convert to UserMessage for compatibility with auth layer+ user := &UserMessage{+ Email: wi.Email,+ Name: wi.Name,+ Type: storepb.PrincipalType_WORKLOAD_IDENTITY,+ MemberDeleted: wi.MemberDeleted,+ MFAConfig: &storepb.MFAConfig{},+ Profile: &storepb.UserProfile{},+ }+ s.userEmailCache.Add(user.Email, user)+ return user, nil+ }++ // Default to end user lookup.+ return s.GetUserByEmail(ctx, email)+}diff --git a/backend/store/account_filter.go b/backend/store/account_filter.gonew file mode 100644index 0000000000..c702b01fc6--- /dev/null+++ b/backend/store/account_filter.go@@ -0,0 +1,136 @@+package store++import (+ "strings"++ "github.com/google/cel-go/cel"+ celast "github.com/google/cel-go/common/ast"+ celoperators "github.com/google/cel-go/common/operators"+ celoverloads "github.com/google/cel-go/common/overloads"+ "github.com/pkg/errors"++ "github.com/bytebase/bytebase/backend/common"+ "github.com/bytebase/bytebase/backend/common/qb"+ v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"+)++// AccountListFilter contains the filter query for service accounts and workload identities.+type AccountListFilter struct {+ Query *qb.Query+ ProjectID *string+}++// GetAccountListFilter parses a CEL filter string and returns a query for filtering service accounts and workload identities.+func GetAccountListFilter(filter string) (*AccountListFilter, error) {+ if filter == "" {+ return &AccountListFilter{}, nil+ }++ e, err := cel.NewEnv()+ if err != nil {+ return nil, errors.Errorf("failed to create cel env")+ }+ ast, iss := e.Parse(filter)+ if iss != nil {+ return nil, errors.Errorf("failed to parse filter %v, error: %v", filter, iss.String())+ }++ var getFilter func(expr celast.Expr) (*qb.Query, error)+ var projectID *string++ parseToSQL := func(variable string, value any) (*qb.Query, error) {+ switch variable {+ case "email":+ return qb.Q().Space("email = ?", value.(string)), nil+ case "name":+ return qb.Q().Space("name = ?", value.(string)), nil+ case "state":+ stateStr, ok := value.(string)+ if !ok {+ return nil, errors.Errorf("state value must be string, got %T", value)+ }+ // Try with STATE_ prefix first (e.g., "STATE_ACTIVE", "STATE_DELETED")+ v1State, ok := v1pb.State_value[stateStr]+ if !ok {+ // If not found, try without STATE_ prefix (e.g., "ACTIVE", "DELETED")+ if v, exists := v1pb.State_value[strings.TrimPrefix(stateStr, "STATE_")]; exists {+ v1State = v+ ok = true+ }+ }+ if !ok {+ return nil, errors.Errorf("invalid state filter %q", value)+ }+ return qb.Q().Space("deleted = ?", v1pb.State(v1State) == v1pb.State_DELETED), nil+ case "project":+ pid, err := common.GetProjectID(value.(string))+ if err != nil {+ return nil, errors.Errorf("invalid project filter %q", value)+ }+ projectID = &pid+ return qb.Q().Space("TRUE"), nil+ default:+ return nil, errors.Errorf("unsupported variable %q", variable)+ }+ }++ getFilter = func(expr celast.Expr) (*qb.Query, error) {+ q := qb.Q()+ switch expr.Kind() {+ case celast.CallKind:+ functionName := expr.AsCall().FunctionName()+ switch functionName {+ case celoperators.LogicalOr:+ for _, arg := range expr.AsCall().Args() {+ qq, err := getFilter(arg)+ if err != nil {+ return nil, err+ }+ q.Or("?", qq)+ }+ return qb.Q().Space("(?)", q), nil+ case celoperators.LogicalAnd:+ for _, arg := range expr.AsCall().Args() {+ qq, err := getFilter(arg)+ if err != nil {+ return nil, err+ }+ q.And("?", qq)+ }+ return qb.Q().Space("(?)", q), nil+ case celoperators.Equals:+ variable, value := getVariableAndValueFromExpr(expr)+ return parseToSQL(variable, value)+ case celoverloads.Matches:+ variable := expr.AsCall().Target().AsIdent()+ args := expr.AsCall().Args()+ if len(args) != 1 {+ return nil, errors.Errorf(`invalid args for %q`, variable)+ }+ value := args[0].AsLiteral().Value()+ if variable != "name" && variable != "email" {+ return nil, errors.Errorf(`only "name" and "email" support %q operator, but found %q`, celoverloads.Matches, variable)+ }+ strValue, ok := value.(string)+ if !ok {+ return nil, errors.Errorf("expect string, got %T, hint: filter literals should be string", value)+ }+ return qb.Q().Space("LOWER("+variable+") LIKE ?", "%"+strings.ToLower(strValue)+"%"), nil+ default:+ return nil, errors.Errorf("unexpected function %v", functionName)+ }+ default:+ return nil, errors.Errorf("unexpected expr kind %v", expr.Kind())+ }+ }++ q, err := getFilter(ast.NativeRep().Expr())+ if err != nil {+ return nil, err+ }++ return &AccountListFilter{+ Query: qb.Q().Space("(?)", q),+ ProjectID: projectID,+ }, nil+}diff --git a/backend/store/principal_filter_test.go b/backend/store/account_filter_test.gosimilarity index 83%rename from backend/store/principal_filter_test.gorename to backend/store/account_filter_test.goindex dbb4438d0a..8b6846831b 100644--- a/backend/store/principal_filter_test.go+++ b/backend/store/account_filter_test.go@@ -6,7 +6,7 @@ import ("github.com/stretchr/testify/require")-func TestGetListUserFilter(t *testing.T) {+func TestGetAccountListFilter(t *testing.T) {tests := []struct {name stringfilter string@@ -26,42 +26,42 @@ func TestGetListUserFilter(t *testing.T) {{name: "name filter",filter: `name == "ed"`,- wantSQL: "(principal.name = $1)",+ wantSQL: "(name = $1)",wantArgs: []any{"ed"},wantErr: false,},{name: "email filter",filter: `email == "[email protected]"`,- wantSQL: "(principal.email = $1)",+ wantSQL: "(email = $1)",wantArgs: []any{"[email protected]"},wantErr: false,},{name: "name matches",filter: `name.matches("ED")`,- wantSQL: "(LOWER(principal.name) LIKE $1)",+ wantSQL: "(LOWER(name) LIKE $1)",wantArgs: []any{"%ed%"},wantErr: false,},{name: "email matches",filter: `email.matches("test")`,- wantSQL: "(LOWER(principal.email) LIKE $1)",+ wantSQL: "(LOWER(email) LIKE $1)",wantArgs: []any{"%test%"},wantErr: false,},{name: "state filter - STATE_ACTIVE",filter: `state == "STATE_ACTIVE"`,- wantSQL: "(principal.deleted = $1)",+ wantSQL: "(deleted = $1)",wantArgs: []any{false},wantErr: false,},{name: "state filter - STATE_DELETED",filter: `state == "STATE_DELETED"`,- wantSQL: "(principal.deleted = $1)",+ wantSQL: "(deleted = $1)",wantArgs: []any{true},wantErr: false,},@@ -76,21 +76,21 @@ func TestGetListUserFilter(t *testing.T) {{name: "AND condition",filter: `name == "ed" && email == "[email protected]"`,- wantSQL: "((principal.name = $1 AND principal.email = $2))",+ wantSQL: "((name = $1 AND email = $2))",wantArgs: []any{"ed", "[email protected]"},wantErr: false,},{name: "OR condition",filter: `name == "ed" || name == "alice"`,- wantSQL: "((principal.name = $1 OR principal.name = $2))",+ wantSQL: "((name = $1 OR name = $2))",wantArgs: []any{"ed", "alice"},wantErr: false,},{name: "complex nested condition",filter: `(name == "ed" || name == "alice")`,- wantSQL: "((principal.name = $1 OR principal.name = $2))",+ wantSQL: "((name = $1 OR name = $2))",wantArgs: []any{"ed", "alice"},wantErr: false,},@@ -98,7 +98,7 @@ func TestGetListUserFilter(t *testing.T) {name: "unsupported variable",filter: `title == "ed"`,wantErr: true,- errContains: "unsupport variable",+ errContains: "unsupported variable",},{name: "invalid filter syntax",@@ -116,7 +116,7 @@ func TestGetListUserFilter(t *testing.T) {for _, tt := range tests {t.Run(tt.name, func(t *testing.T) {- result, err := GetListUserFilter(tt.filter)+ result, err := GetAccountListFilter(tt.filter)if tt.wantErr {require.Error(t, err)diff --git a/backend/store/principal.go b/backend/store/principal.goindex f76dd25b43..33a2a6939c 100644--- a/backend/store/principal.go+++ b/backend/store/principal.go@@ -24,7 +24,6 @@ type FindUserMessage struct {Offset *intFilterQ *qb.QueryProjectID *string- UserTypes *[]storepb.PrincipalType}// UpdateUserMessage is the message to update a user.@@ -55,12 +54,6 @@ type UserMessage struct {CreatedAt time.Time}-type UserStat struct {- Type storepb.PrincipalType- Deleted bool- Count int-}-// GetUserByID gets the user by ID.func (s *Store) GetUserByID(ctx context.Context, id int) (*UserMessage, error) {users, err := s.ListUsers(ctx, &FindUserMessage{ID: &id})@@ -73,67 +66,6 @@ func (s *Store) GetUserByID(ctx context.Context, id int) (*UserMessage, error) {return users[0], nil}-// GetPrincipalByEmail gets any principal (user, service account, or workload identity) by email.-// This is used by the auth layer where the JWT subject can be any principal type.-// It determines the principal type by the email format and calls the appropriate method.-func (s *Store) GetPrincipalByEmail(ctx context.Context, email string) (*UserMessage, error) {- // Use the unified cache first for all types- if v, ok := s.userEmailCache.Get(email); ok && s.enableCache {- return v, nil- }-- // Determine principal type by email format and query accordingly- if common.IsServiceAccountEmail(email) {- sa, err := s.GetServiceAccountByEmail(ctx, email)- if err != nil {- return nil, err- }- if sa == nil {- return nil, nil- }- // Convert to UserMessage for compatibility with auth layer- user := &UserMessage{- ID: sa.ID,- Email: sa.Email,- Name: sa.Name,- PasswordHash: sa.PasswordHash,- Type: storepb.PrincipalType_SERVICE_ACCOUNT,- MemberDeleted: sa.MemberDeleted,- MFAConfig: &storepb.MFAConfig{},- Profile: &storepb.UserProfile{},- }- s.userEmailCache.Add(user.Email, user)- return user, nil- }-- if common.IsWorkloadIdentityEmail(email) {- wi, err := s.GetWorkloadIdentityByEmail(ctx, email)- if err != nil {- return nil, err- }- if wi == nil {- return nil, nil- }- // Convert to UserMessage for compatibility with auth layer- user := &UserMessage{- ID: wi.ID,- Email: wi.Email,- Name: wi.Name,- Type: storepb.PrincipalType_WORKLOAD_IDENTITY,- MemberDeleted: wi.MemberDeleted,- MFAConfig: &storepb.MFAConfig{},- Profile: &storepb.UserProfile{},- }- s.userEmailCache.Add(user.Email, user)- return user, nil- }-- // Default to end user lookup, which loads and caches all principals- // (regardless of type) so legacy service accounts/workload identities- // with non-standard email formats are also found.- return s.GetUserByEmail(ctx, email)-}-// GetUserByEmail gets the user by email.func (s *Store) GetUserByEmail(ctx context.Context, email string) (*UserMessage, error) {if v, ok := s.userEmailCache.Get(email); ok && s.enableCache {@@ -148,144 +80,61 @@ func (s *Store) GetUserByEmail(ctx context.Context, email string) (*UserMessage,return user, nil}-// BatchGetUsersByEmails gets users (of any type) by emails in batch using a single SQL query.+// BatchGetUsersByEmails gets users (of any type) by emails in batch.func (s *Store) BatchGetUsersByEmails(ctx context.Context, emails []string) ([]*UserMessage, error) {if len(emails) == 0 {return nil, nil}- // Normalize emails to lowercasenormalizedEmails := make([]string, len(emails))for i, email := range emails {normalizedEmails[i] = strings.ToLower(email)}- q := qb.Q().Space(`- SELECT- id,- deleted,- email,- name,- type,- password_hash,- mfa_config,- phone,- profile,- created_at- FROM principal- WHERE email = ANY(?)- ORDER BY created_at ASC- `, normalizedEmails)+ var users []*UserMessage+ q := qb.Q().Space(`+ SELECT id, deleted, email, name, password_hash, mfa_config, phone, profile, created_at+ FROM principal WHERE email = ANY(?) ORDER BY created_at ASC+ `, normalizedEmails)sqlStr, args, err := q.ToSQL()if err != nil {return nil, errors.Wrapf(err, "failed to build sql")}-rows, err := s.GetDB().QueryContext(ctx, sqlStr, args...)if err != nil {return nil, err}defer rows.Close()-- var users []*UserMessagefor rows.Next() {var user UserMessage- var mfaConfigBytes []byte- var profileBytes []byte- var typeString string- if err := rows.Scan(- &user.ID,- &user.MemberDeleted,- &user.Email,- &user.Name,- &typeString,- &user.PasswordHash,- &mfaConfigBytes,- &user.Phone,- &profileBytes,- &user.CreatedAt,- ); err != nil {+ var mfaConfigBytes, profileBytes []byte+ if err := rows.Scan(&user.ID, &user.MemberDeleted, &user.Email, &user.Name, &user.PasswordHash, &mfaConfigBytes, &user.Phone, &profileBytes, &user.CreatedAt); err != nil {return nil, err}- if typeValue, ok := storepb.PrincipalType_value[typeString]; ok {- user.Type = storepb.PrincipalType(typeValue)- } else {- return nil, errors.Errorf("invalid principal type string: %s", typeString)- }-+ user.Type = storepb.PrincipalType_END_USERmfaConfig := storepb.MFAConfig{}if err := common.ProtojsonUnmarshaler.Unmarshal(mfaConfigBytes, &mfaConfig); err != nil {return nil, err}user.MFAConfig = &mfaConfig-profile := storepb.UserProfile{}if err := common.ProtojsonUnmarshaler.Unmarshal(profileBytes, &profile); err != nil {return nil, err}user.Profile = &profile-users = append(users, &user)}if err := rows.Err(); err != nil {return nil, errors.Wrapf(err, "failed to scan rows")}- // Update cachefor _, user := range users {s.userEmailCache.Add(user.Email, user)}-return users, nil}-func (s *Store) StatUsers(ctx context.Context) ([]*UserStat, error) {- q := qb.Q().Space(`- SELECT- COUNT(*),- type,- deleted- FROM principal- GROUP BY type, deleted- `)- sql, args, err := q.ToSQL()- if err != nil {- return nil, errors.Wrapf(err, "failed to build sql")- }-- rows, err := s.GetDB().QueryContext(ctx, sql, args...)- if err != nil {- return nil, err- }- defer rows.Close()-- var stats []*UserStat-- for rows.Next() {- var stat UserStat- var typeString string- if err := rows.Scan(- &stat.Count,- &typeString,- &stat.Deleted,- ); err != nil {- return nil, err- }- if typeValue, ok := storepb.PrincipalType_value[typeString]; ok {- stat.Type = storepb.PrincipalType(typeValue)- } else {- return nil, errors.Errorf("invalid principal type string: %s", typeString)- }- stats = append(stats, &stat)- }- if err := rows.Err(); err != nil {- return nil, errors.Wrapf(err, "failed to scan rows")- }-- return stats, nil-}-// ListUsers list users.func (s *Store) ListUsers(ctx context.Context, find *FindUserMessage) ([]*UserMessage, error) {tx, err := s.GetDB().BeginTx(ctx, nil)@@ -365,13 +214,6 @@ func listUserImpl(ctx context.Context, txn *sql.Tx, find *FindUserMessage) ([]*Uwhere.And("principal.email = ?", strings.ToLower(*v))}}- if v := find.UserTypes; v != nil {- typeStrings := make([]string, 0, len(*v))- for _, t := range *v {- typeStrings = append(typeStrings, t.String())- }- where.And("principal.type = ANY(?)", typeStrings)- }if !find.ShowDeleted {where.And("principal.deleted = ?", false)}@@ -383,7 +225,6 @@ func listUserImpl(ctx context.Context, txn *sql.Tx, find *FindUserMessage) ([]*Uprincipal.deleted,principal.email,principal.name,- principal.type,principal.password_hash,principal.mfa_config,principal.phone,@@ -391,7 +232,7 @@ func listUserImpl(ctx context.Context, txn *sql.Tx, find *FindUserMessage) ([]*Uprincipal.created_atFROM ?WHERE ?- ORDER BY type DESC, created_at ASC+ ORDER BY created_at ASC`, from, where)if v := find.Limit; v != nil {@@ -416,13 +257,11 @@ func listUserImpl(ctx context.Context, txn *sql.Tx, find *FindUserMessage) ([]*Uvar userMessage UserMessagevar mfaConfigBytes []bytevar profileBytes []byte- var typeString stringif err := rows.Scan(&userMessage.ID,&userMessage.MemberDeleted,&userMessage.Email,&userMessage.Name,- &typeString,&userMessage.PasswordHash,&mfaConfigBytes,&userMessage.Phone,@@ -431,11 +270,7 @@ func listUserImpl(ctx context.Context, txn *sql.Tx, find *FindUserMessage) ([]*U); err != nil {return nil, err}- if typeValue, ok := storepb.PrincipalType_value[typeString]; ok {- userMessage.Type = storepb.PrincipalType(typeValue)- } else {- return nil, errors.Errorf("invalid principal type string: %s", typeString)- }+ userMessage.Type = storepb.PrincipalType_END_USERmfaConfig := storepb.MFAConfig{}if err := common.ProtojsonUnmarshaler.Unmarshal(mfaConfigBytes, &mfaConfig); err != nil {@@ -462,13 +297,11 @@ func scanPrincipalRow(ctx context.Context, tx *sql.Tx, sqlStr string, args []anyvar user UserMessagevar mfaConfigBytes []bytevar profileBytes []byte- var typeString stringif err := tx.QueryRowContext(ctx, sqlStr, args...).Scan( // NOSONAR: query is parameterized via qb.Query&user.ID,&user.MemberDeleted,&user.Email,&user.Name,- &typeString,&user.PasswordHash,&mfaConfigBytes,&user.Phone,@@ -477,12 +310,7 @@ func scanPrincipalRow(ctx context.Context, tx *sql.Tx, sqlStr string, args []any); err != nil {return nil, err}-- if typeValue, ok := storepb.PrincipalType_value[typeString]; ok {- user.Type = storepb.PrincipalType(typeValue)- } else {- return nil, errors.Errorf("invalid principal type string: %s", typeString)- }+ user.Type = storepb.PrincipalType_END_USERmfaConfig := storepb.MFAConfig{}if err := common.ProtojsonUnmarshaler.Unmarshal(mfaConfigBytes, &mfaConfig); err != nil {@@ -507,12 +335,6 @@ func (s *Store) CreateUser(ctx context.Context, create *UserMessage) (*UserMessareturn nil, errors.Errorf("emails must be lower-case when they are passed into store")}- tx, err := s.GetDB().BeginTx(ctx, nil)- if err != nil {- return nil, err- }- defer tx.Rollback()-if create.Profile == nil {create.Profile = &storepb.UserProfile{}}@@ -525,40 +347,34 @@ func (s *Store) CreateUser(ctx context.Context, create *UserMessage) (*UserMessaINSERT INTO principal (email,name,- type,password_hash,phone,profile)- VALUES (?, ?, ?, ?, ?, ?)+ VALUES (?, ?, ?, ?, ?)RETURNING id, created_at- `, create.Email, create.Name, create.Type.String(), create.PasswordHash, create.Phone, profileBytes)+ `, create.Email, create.Name, create.PasswordHash, create.Phone, profileBytes)- sql, args, err := q.ToSQL()+ sqlStr, args, err := q.ToSQL()if err != nil {return nil, errors.Wrapf(err, "failed to build sql")}- var userID int- if err := tx.QueryRowContext(ctx, sql, args...).Scan(&userID, &create.CreatedAt); err != nil { // NOSONAR: query is parameterized via qb.Query- return nil, err- }-- if err := tx.Commit(); err != nil {- return nil, err- }-user := &UserMessage{- ID: userID,Email: create.Email,Name: create.Name,- Type: create.Type,+ Type: storepb.PrincipalType_END_USER,PasswordHash: create.PasswordHash,Phone: create.Phone,CreatedAt: create.CreatedAt,Profile: create.Profile,MFAConfig: &storepb.MFAConfig{},}++ if err := s.GetDB().QueryRowContext(ctx, sqlStr, args...).Scan(&user.ID, &user.CreatedAt); err != nil {+ return nil, err+ }+s.userEmailCache.Add(user.Email, user)return user, nil}@@ -602,7 +418,7 @@ func (s *Store) UpdateUser(ctx context.Context, currentUser *UserMessage, patch}sql, args, err := qb.Q().Space(`UPDATE principal SET ? WHERE id = ?- RETURNING id, deleted, email, name, type, password_hash, mfa_config, phone, profile, created_at`,+ RETURNING id, deleted, email, name, password_hash, mfa_config, phone, profile, created_at`,set, currentUser.ID).ToSQL()if err != nil {return nil, errors.Wrapf(err, "failed to build sql")@@ -639,13 +455,8 @@ func (s *Store) UpdateUserEmail(ctx context.Context, user *UserMessage, newEmaildefer tx.Rollback()// 1. Update Principal table- // Because we have ON UPDATE CASCADE on foreign keys (issue.creator, etc.),- // this will automatically update the creator field in:- // - issue- // - issue_comment- // - simple table references (plan, pipeline, task_run, etc.)query := qb.Q().Space(`UPDATE principal SET email = ? WHERE id = ?- RETURNING id, deleted, email, name, type, password_hash, mfa_config, phone, profile, created_at`,+ RETURNING id, deleted, email, name, password_hash, mfa_config, phone, profile, created_at`,newEmail, user.ID)sqlStr, args, err := query.ToSQL()if err != nil {@@ -657,6 +468,25 @@ func (s *Store) UpdateUserEmail(ctx context.Context, user *UserMessage, newEmailreturn nil, errors.Wrapf(err, "failed to update principal email")}+ // 1b. Update creator/deleter columns that previously relied on ON UPDATE CASCADE.+ creatorUpdates := []string{+ "UPDATE plan SET creator = $1 WHERE creator = $2",+ "UPDATE task_run SET creator = $1 WHERE creator = $2",+ "UPDATE issue SET creator = $1 WHERE creator = $2",+ "UPDATE issue_comment SET creator = $1 WHERE creator = $2",+ "UPDATE query_history SET creator = $1 WHERE creator = $2",+ "UPDATE worksheet SET creator = $1 WHERE creator = $2",+ "UPDATE worksheet_organizer SET principal = $1 WHERE principal = $2",+ "UPDATE revision SET deleter = $1 WHERE deleter = $2",+ "UPDATE release SET creator = $1 WHERE creator = $2",+ "UPDATE access_grant SET creator = $1 WHERE creator = $2",+ }+ for _, stmt := range creatorUpdates {+ if _, err := tx.ExecContext(ctx, stmt, newEmail, user.Email); err != nil {+ return nil, errors.Wrapf(err, "failed to update creator/deleter references")+ }+ }+// 2. Update GrantRequest in Issue payload// The user in GrantRequest is stored as "users/{email}" within the JSON payload.// We use text replacement for the specific path.diff --git a/backend/store/principal_end_user.go b/backend/store/principal_end_user.godeleted file mode 100644index e02a62feec..0000000000--- a/backend/store/principal_end_user.go+++ /dev/null@@ -1,122 +0,0 @@-package store--import (- "context"- "strings"-- "github.com/pkg/errors"- "google.golang.org/protobuf/encoding/protojson"-- "github.com/bytebase/bytebase/backend/common/qb"- storepb "github.com/bytebase/bytebase/backend/generated-go/store"-)--// GetEndUserByEmail gets an end user by email.-func (s *Store) GetEndUserByEmail(ctx context.Context, email string) (*UserMessage, error) {- if v, ok := s.userEmailCache.Get(email); ok && s.enableCache {- if v.Type == storepb.PrincipalType_END_USER {- return v, nil- }- return nil, nil- }-- users, err := s.ListEndUsers(ctx, &FindUserMessage{Email: &email, ShowDeleted: true})- if err != nil {- return nil, err- }- if len(users) == 0 {- return nil, nil- }- return users[0], nil-}--// listEndUsers lists end users.-func (s *Store) ListEndUsers(ctx context.Context, find *FindUserMessage) ([]*UserMessage, error) {- userTypes := []storepb.PrincipalType{- storepb.PrincipalType_END_USER,- }- find.UserTypes = &userTypes- return s.ListUsers(ctx, find)-}--// CreateEndUser creates an end user.-func (s *Store) CreateEndUser(ctx context.Context, create *UserMessage) (*UserMessage, error) {- if create.Type != storepb.PrincipalType_END_USER {- return nil, errors.Errorf("expected END_USER type, got %s", create.Type.String())- }- return s.CreateUser(ctx, create)-}--// UpdateEndUser updates an end user.-func (s *Store) UpdateEndUser(ctx context.Context, currentUser *UserMessage, patch *UpdateUserMessage) (*UserMessage, error) {- if currentUser.Type != storepb.PrincipalType_END_USER {- return nil, errors.Errorf("expected END_USER type, got %s", currentUser.Type.String())- }- return s.UpdateUser(ctx, currentUser, patch)-}--// UpdateEndUserEmail updates an end user's email and all related references.-func (s *Store) UpdateEndUserEmail(ctx context.Context, user *UserMessage, newEmail string) (*UserMessage, error) {- if user.Type != storepb.PrincipalType_END_USER {- return nil, errors.Errorf("expected END_USER type, got %s", user.Type.String())- }- return s.UpdateUserEmail(ctx, user, newEmail)-}--// CreateEndUserMessage is the message for creating an end user.-type CreateEndUserMessage struct {- Email string- Name string- PasswordHash string- Phone string- Profile *storepb.UserProfile-}--// CreateEndUserFromMessage creates an end user from CreateEndUserMessage.-func (s *Store) CreateEndUserFromMessage(ctx context.Context, create *CreateEndUserMessage) (*UserMessage, error) {- email := strings.ToLower(create.Email)-- profile := create.Profile- if profile == nil {- profile = &storepb.UserProfile{}- }- profileBytes, err := protojson.Marshal(profile)- if err != nil {- return nil, err- }-- q := qb.Q().Space(`- INSERT INTO principal (- email,- name,- type,- password_hash,- phone,- profile- )- VALUES (?, ?, ?, ?, ?, ?)- RETURNING id, created_at- `, email, create.Name, storepb.PrincipalType_END_USER.String(), create.PasswordHash, create.Phone, profileBytes)-- sqlStr, args, err := q.ToSQL()- if err != nil {- return nil, errors.Wrapf(err, "failed to build sql")- }-- user := &UserMessage{- Email: email,- Name: create.Name,- Type: storepb.PrincipalType_END_USER,- PasswordHash: create.PasswordHash,- Phone: create.Phone,- Profile: profile,- MFAConfig: &storepb.MFAConfig{},- }-- if err := s.GetDB().QueryRowContext(ctx, sqlStr, args...).Scan(&user.ID, &user.CreatedAt); err != nil {- return nil, err- }-- s.userEmailCache.Add(user.Email, user)- return user, nil-}diff --git a/backend/store/principal_filter.go b/backend/store/principal_filter.godeleted file mode 100644index d8c52546e7..0000000000--- a/backend/store/principal_filter.go+++ /dev/null@@ -1,247 +0,0 @@-package store--import (- "strings"-- "github.com/google/cel-go/cel"- celast "github.com/google/cel-go/common/ast"- celoperators "github.com/google/cel-go/common/operators"- celoverloads "github.com/google/cel-go/common/overloads"- "github.com/pkg/errors"-- "github.com/bytebase/bytebase/backend/common"- "github.com/bytebase/bytebase/backend/common/qb"- v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"-)--// GetListUserFilterResult contains the filter query and optional project ID.-type GetListUserFilterResult struct {- Query *qb.Query- ProjectID *string-}--// GetAccountListFilterResult contains the filter query for service accounts and workload identities.-type GetAccountListFilterResult struct {- Query *qb.Query-}--// GetListUserFilter parses a CEL filter string and returns a query for filtering users.-func GetListUserFilter(filter string) (*GetListUserFilterResult, error) {- if filter == "" {- return &GetListUserFilterResult{}, nil- }-- e, err := cel.NewEnv()- if err != nil {- return nil, errors.Errorf("failed to create cel env")- }- ast, iss := e.Parse(filter)- if iss != nil {- return nil, errors.Errorf("failed to parse filter %v, error: %v", filter, iss.String())- }-- var getFilter func(expr celast.Expr) (*qb.Query, error)- var projectID *string-- parseToSQL := func(variable, value any) (*qb.Query, error) {- switch variable {- case "email":- return qb.Q().Space("principal.email = ?", value.(string)), nil- case "name":- return qb.Q().Space("principal.name = ?", value.(string)), nil- case "state":- stateStr, ok := value.(string)- if !ok {- return nil, errors.Errorf("state value must be string, got %T", value)- }- // Try with STATE_ prefix first (e.g., "STATE_ACTIVE", "STATE_DELETED")- v1State, ok := v1pb.State_value[stateStr]- if !ok {- // If not found, try without STATE_ prefix (e.g., "ACTIVE", "DELETED")- if v, exists := v1pb.State_value[strings.TrimPrefix(stateStr, "STATE_")]; exists {- v1State = v- ok = true- }- }- if !ok {- return nil, errors.Errorf("invalid state filter %q", value)- }- return qb.Q().Space("principal.deleted = ?", v1pb.State(v1State) == v1pb.State_DELETED), nil- case "project":- pid, err := common.GetProjectID(value.(string))- if err != nil {- return nil, errors.Errorf("invalid project filter %q", value)- }- projectID = &pid- return qb.Q().Space("TRUE"), nil- default:- return nil, errors.Errorf("unsupport variable %q", variable)- }- }-- getFilter = func(expr celast.Expr) (*qb.Query, error) {- q := qb.Q()- switch expr.Kind() {- case celast.CallKind:- functionName := expr.AsCall().FunctionName()- switch functionName {- case celoperators.LogicalOr:- for _, arg := range expr.AsCall().Args() {- qq, err := getFilter(arg)- if err != nil {- return nil, err- }- q.Or("?", qq)- }- return qb.Q().Space("(?)", q), nil- case celoperators.LogicalAnd:- for _, arg := range expr.AsCall().Args() {- qq, err := getFilter(arg)- if err != nil {- return nil, err- }- q.And("?", qq)- }- return qb.Q().Space("(?)", q), nil- case celoperators.Equals:- variable, value := getVariableAndValueFromExpr(expr)- return parseToSQL(variable, value)- case celoverloads.Matches:- variable := expr.AsCall().Target().AsIdent()- args := expr.AsCall().Args()- if len(args) != 1 {- return nil, errors.Errorf(`invalid args for %q`, variable)- }- value := args[0].AsLiteral().Value()- if variable != "name" && variable != "email" {- return nil, errors.Errorf(`only "name" and "email" support %q operator, but found %q`, celoverloads.Matches, variable)- }- strValue, ok := value.(string)- if !ok {- return nil, errors.Errorf("expect string, got %T, hint: filter literals should be string", value)- }- return qb.Q().Space("LOWER(principal."+variable+") LIKE ?", "%"+strings.ToLower(strValue)+"%"), nil- default:- return nil, errors.Errorf("unexpected function %v", functionName)- }- default:- return nil, errors.Errorf("unexpected expr kind %v", expr.Kind())- }- }-- q, err := getFilter(ast.NativeRep().Expr())- if err != nil {- return nil, err- }-- return &GetListUserFilterResult{- Query: qb.Q().Space("(?)", q),- ProjectID: projectID,- }, nil-}--// GetAccountListFilter parses a CEL filter string and returns a query for filtering service accounts and workload identities.-func GetAccountListFilter(filter string) (*GetAccountListFilterResult, error) {- if filter == "" {- return &GetAccountListFilterResult{}, nil- }-- e, err := cel.NewEnv()- if err != nil {- return nil, errors.Errorf("failed to create cel env")- }- ast, iss := e.Parse(filter)- if iss != nil {- return nil, errors.Errorf("failed to parse filter %v, error: %v", filter, iss.String())- }-- var getFilter func(expr celast.Expr) (*qb.Query, error)-- parseToSQL := func(variable string, value any) (*qb.Query, error) {- switch variable {- case "email":- return qb.Q().Space("principal.email = ?", value.(string)), nil- case "name":- return qb.Q().Space("principal.name = ?", value.(string)), nil- case "state":- stateStr, ok := value.(string)- if !ok {- return nil, errors.Errorf("state value must be string, got %T", value)- }- // Try with STATE_ prefix first (e.g., "STATE_ACTIVE", "STATE_DELETED")- v1State, ok := v1pb.State_value[stateStr]- if !ok {- // If not found, try without STATE_ prefix (e.g., "ACTIVE", "DELETED")- if v, exists := v1pb.State_value[strings.TrimPrefix(stateStr, "STATE_")]; exists {- v1State = v- ok = true- }- }- if !ok {- return nil, errors.Errorf("invalid state filter %q", value)- }- return qb.Q().Space("principal.deleted = ?", v1pb.State(v1State) == v1pb.State_DELETED), nil- default:- return nil, errors.Errorf("unsupported variable %q", variable)- }- }-- getFilter = func(expr celast.Expr) (*qb.Query, error) {- q := qb.Q()- switch expr.Kind() {- case celast.CallKind:- functionName := expr.AsCall().FunctionName()- switch functionName {- case celoperators.LogicalOr:- for _, arg := range expr.AsCall().Args() {- qq, err := getFilter(arg)- if err != nil {- return nil, err- }- q.Or("?", qq)- }- return qb.Q().Space("(?)", q), nil- case celoperators.LogicalAnd:- for _, arg := range expr.AsCall().Args() {- qq, err := getFilter(arg)- if err != nil {- return nil, err- }- q.And("?", qq)- }- return qb.Q().Space("(?)", q), nil- case celoperators.Equals:- variable, value := getVariableAndValueFromExpr(expr)- return parseToSQL(variable, value)- case celoverloads.Matches:- variable := expr.AsCall().Target().AsIdent()- args := expr.AsCall().Args()- if len(args) != 1 {- return nil, errors.Errorf(`invalid args for %q`, variable)- }- value := args[0].AsLiteral().Value()- if variable != "name" && variable != "email" {- return nil, errors.Errorf(`only "name" and "email" support %q operator, but found %q`, celoverloads.Matches, variable)- }- strValue, ok := value.(string)- if !ok {- return nil, errors.Errorf("expect string, got %T, hint: filter literals should be string", value)- }- return qb.Q().Space("LOWER(principal."+variable+") LIKE ?", "%"+strings.ToLower(strValue)+"%"), nil- default:- return nil, errors.Errorf("unexpected function %v", functionName)- }- default:- return nil, errors.Errorf("unexpected expr kind %v", expr.Kind())- }- }-- q, err := getFilter(ast.NativeRep().Expr())- if err != nil {- return nil, err- }-- return &GetAccountListFilterResult{- Query: qb.Q().Space("(?)", q),- }, nil-}diff --git a/backend/store/principal_workload_identity_test.go b/backend/store/principal_workload_identity_test.godeleted file mode 100644index f43e564561..0000000000--- a/backend/store/principal_workload_identity_test.go+++ /dev/null@@ -1,94 +0,0 @@-package store--import (- "testing"-- "github.com/stretchr/testify/require"-- storepb "github.com/bytebase/bytebase/backend/generated-go/store"-)--// TestWorkloadIdentityConfigInUserMessage verifies that WorkloadIdentityConfig-// is accessible through the UserMessage.Profile field.-func TestWorkloadIdentityConfigInUserMessage(t *testing.T) {- // Create a UserMessage with WorkloadIdentityConfig in the Profile- profile := &storepb.UserProfile{- WorkloadIdentityConfig: &storepb.WorkloadIdentityConfig{- ProviderType: storepb.WorkloadIdentityConfig_GITHUB,- IssuerUrl: "https://token.actions.githubusercontent.com",- AllowedAudiences: []string{"https://github.com/myorg"},- SubjectPattern: "repo:myorg/myrepo:ref:refs/heads/main",- },- }- user := &UserMessage{- Profile: profile,- }-- // Verify WorkloadIdentityConfig is accessible- require.NotNil(t, user.Profile)- require.NotNil(t, user.Profile.WorkloadIdentityConfig)-- // Verify the config values- wic := user.Profile.WorkloadIdentityConfig- require.Equal(t, storepb.WorkloadIdentityConfig_GITHUB, wic.ProviderType)- require.Equal(t, "https://token.actions.githubusercontent.com", wic.IssuerUrl)- require.Equal(t, []string{"https://github.com/myorg"}, wic.AllowedAudiences)- require.Equal(t, "repo:myorg/myrepo:ref:refs/heads/main", wic.SubjectPattern)-- // Verify we can use GetWorkloadIdentityConfig() helper- wic2 := user.Profile.GetWorkloadIdentityConfig()- require.NotNil(t, wic2)- require.Equal(t, wic, wic2)-}--// TestCreateUserMessageWithWorkloadIdentityConfig verifies that CreateUser-// can handle UserMessage with WorkloadIdentityConfig in the Profile.-func TestCreateUserMessageWithWorkloadIdentityConfig(t *testing.T) {- // Create a user with workload identity config- profile := &storepb.UserProfile{- WorkloadIdentityConfig: &storepb.WorkloadIdentityConfig{- ProviderType: storepb.WorkloadIdentityConfig_GITHUB,- IssuerUrl: "https://token.actions.githubusercontent.com",- AllowedAudiences: []string{"https://github.com/myorg"},- SubjectPattern: "repo:myorg/*",- },- }- create := &UserMessage{- Type: storepb.PrincipalType_WORKLOAD_IDENTITY,- Profile: profile,- }-- // Verify the structure is correctly formed- require.Equal(t, storepb.PrincipalType_WORKLOAD_IDENTITY, create.Type)- require.NotNil(t, create.Profile)- require.NotNil(t, create.Profile.WorkloadIdentityConfig)-- // The actual CreateUser function will marshal this Profile to JSONB- // and store it in the database. The existing code already handles this- // without any modifications needed.-}--// TestUpdateUserMessageWithWorkloadIdentityConfig verifies that UpdateUser-// can handle updates to WorkloadIdentityConfig.-func TestUpdateUserMessageWithWorkloadIdentityConfig(t *testing.T) {- // Update patch with modified workload identity config- patch := &UpdateUserMessage{- Profile: &storepb.UserProfile{- WorkloadIdentityConfig: &storepb.WorkloadIdentityConfig{- ProviderType: storepb.WorkloadIdentityConfig_GITHUB,- IssuerUrl: "https://token.actions.githubusercontent.com",- AllowedAudiences: []string{"https://github.com/myorg"},- SubjectPattern: "repo:myorg/*",- },- },- }-- // Verify the patch is correctly formed- require.NotNil(t, patch.Profile)- require.NotNil(t, patch.Profile.WorkloadIdentityConfig)- require.Equal(t, "repo:myorg/*", patch.Profile.WorkloadIdentityConfig.SubjectPattern)-- // The actual UpdateUser function will marshal this Profile to JSONB- // and update it in the database. The existing code already handles this- // without any modifications needed.-}diff --git a/backend/store/project.go b/backend/store/project.goindex 0cb4176678..3ee9668660 100644--- a/backend/store/project.go+++ b/backend/store/project.go@@ -489,15 +489,12 @@ func (s *Store) DeleteProject(ctx context.Context, resourceID string) error {return errors.Wrapf(err, "failed to delete project_webhook for project %s", resourceID)}- // Delete resources referencing project principals (service accounts) before deleting principals.- // Note: oauth2_authorization_code, oauth2_refresh_token, and web_refresh_token are skipped- // because project-scoped principals can only be SERVICE_ACCOUNT or WORKLOAD_IDENTITY- // (enforced by principal_project_type_check constraint), and only END_USER can create- // OAuth2/web session tokens.-- // Delete worksheet_organizer entries where the principal is a project service account- q = qb.Q().Space("DELETE FROM worksheet_organizer")- q.Space("WHERE principal IN (SELECT email FROM principal WHERE project = ?)", resourceID)+ // Delete resources referencing project service accounts and workload identities.++ // Delete worksheet_organizer entries+ q = qb.Q().Space(`DELETE FROM worksheet_organizer+ WHERE principal IN (SELECT email FROM service_account WHERE project = ?)+ OR principal IN (SELECT email FROM workload_identity WHERE project = ?)`, resourceID, resourceID)sql, args, err = q.ToSQL()if err != nil {return errors.Wrap(err, "failed to build worksheet_organizer delete query")@@ -506,10 +503,10 @@ func (s *Store) DeleteProject(ctx context.Context, resourceID string) error {return errors.Wrapf(err, "failed to delete worksheet_organizer for project %s", resourceID)}- // Delete worksheets created by project service accounts- // (worksheet.creator is NOT NULL, so we must delete rather than nullify)- q = qb.Q().Space("DELETE FROM worksheet")- q.Space("WHERE creator IN (SELECT email FROM principal WHERE project = ?)", resourceID)+ // Delete worksheets created by project service accounts or workload identities+ q = qb.Q().Space(`DELETE FROM worksheet+ WHERE creator IN (SELECT email FROM service_account WHERE project = ?)+ OR creator IN (SELECT email FROM workload_identity WHERE project = ?)`, resourceID, resourceID)sql, args, err = q.ToSQL()if err != nil {return errors.Wrap(err, "failed to build worksheet delete query for principals")@@ -518,9 +515,10 @@ func (s *Store) DeleteProject(ctx context.Context, resourceID string) error {return errors.Wrapf(err, "failed to delete worksheets for project principals %s", resourceID)}- // Nullify revision.deleter references to project service accounts- q = qb.Q().Space("UPDATE revision SET deleter = NULL")- q.Space("WHERE deleter IN (SELECT email FROM principal WHERE project = ?)", resourceID)+ // Nullify revision.deleter references+ q = qb.Q().Space(`UPDATE revision SET deleter = NULL+ WHERE deleter IN (SELECT email FROM service_account WHERE project = ?)+ OR deleter IN (SELECT email FROM workload_identity WHERE project = ?)`, resourceID, resourceID)sql, args, err = q.ToSQL()if err != nil {return errors.Wrap(err, "failed to build revision update query")@@ -529,14 +527,24 @@ func (s *Store) DeleteProject(ctx context.Context, resourceID string) error {return errors.Wrapf(err, "failed to nullify revision.deleter for project %s", resourceID)}- // Delete project principals (service accounts)- q = qb.Q().Space("DELETE FROM principal WHERE project = ?", resourceID)+ // Delete project service accounts+ q = qb.Q().Space("DELETE FROM service_account WHERE project = ?", resourceID)+ sql, args, err = q.ToSQL()+ if err != nil {+ return errors.Wrap(err, "failed to build service_account delete query")+ }+ if _, err := tx.ExecContext(ctx, sql, args...); err != nil {+ return errors.Wrapf(err, "failed to delete service accounts for project %s", resourceID)+ }++ // Delete project workload identities+ q = qb.Q().Space("DELETE FROM workload_identity WHERE project = ?", resourceID)sql, args, err = q.ToSQL()if err != nil {- return errors.Wrap(err, "failed to build principal delete query")+ return errors.Wrap(err, "failed to build workload_identity delete query")}if _, err := tx.ExecContext(ctx, sql, args...); err != nil {- return errors.Wrapf(err, "failed to delete principals for project %s", resourceID)+ return errors.Wrapf(err, "failed to delete workload identities for project %s", resourceID)}// Finally, delete the project itself (only if it's marked as deleted)diff --git a/backend/store/principal_service_account.go b/backend/store/service_account.gosimilarity index 77%rename from backend/store/principal_service_account.gorename to backend/store/service_account.goindex 88b16b50f6..c41525a5ab 100644--- a/backend/store/principal_service_account.go+++ b/backend/store/service_account.go@@ -6,27 +6,23 @@ import ("strings""github.com/pkg/errors"- "google.golang.org/protobuf/encoding/protojson""github.com/bytebase/bytebase/backend/common/qb"- storepb "github.com/bytebase/bytebase/backend/generated-go/store")// ServiceAccountMessage is the message for a service account.type ServiceAccountMessage struct {- ID int// Email must be lower case, format: {name}@{project-id}.service.bytebase.com or {name}@service.bytebase.com- Email string- Name string- PasswordHash string- MemberDeleted bool+ Email string+ Name string+ ServiceKeyHash string+ MemberDeleted bool// Project is the owning project. NULL for workspace-level service accounts.Project *string}// FindServiceAccountMessage is the message for finding service accounts.type FindServiceAccountMessage struct {- ID *intEmail *stringShowDeleted boolLimit *int@@ -40,18 +36,18 @@ type FindServiceAccountMessage struct {// CreateServiceAccountMessage is the message for creating a service account.type CreateServiceAccountMessage struct {// Email must be lower case.- Email string- Name string- PasswordHash string+ Email string+ Name string+ ServiceKeyHash string// Project is the owning project. NULL for workspace-level service accounts.Project *string}// UpdateServiceAccountMessage is the message to update a service account.type UpdateServiceAccountMessage struct {- Name *string- PasswordHash *string- Delete *bool+ Name *string+ ServiceKeyHash *string+ Delete *bool}// GetServiceAccountByEmail gets a service account by email.@@ -68,11 +64,8 @@ func (s *Store) GetServiceAccountByEmail(ctx context.Context, email string) (*Se// ListServiceAccounts lists service accounts.func (s *Store) ListServiceAccounts(ctx context.Context, find *FindServiceAccountMessage) ([]*ServiceAccountMessage, error) {- where := qb.Q().Space("type = ?", storepb.PrincipalType_SERVICE_ACCOUNT.String())+ where := qb.Q().Space("TRUE")- if v := find.ID; v != nil {- where.And("id = ?", *v)- }if v := find.Email; v != nil {where.And("email = ?", strings.ToLower(*v))}@@ -92,13 +85,12 @@ func (s *Store) ListServiceAccounts(ctx context.Context, find *FindServiceAccounq := qb.Q().Space(`SELECT- id,deleted,email,name,- password_hash,+ service_key_hash,project- FROM principal+ FROM service_accountWHERE ?ORDER BY created_at ASC`, where)@@ -126,11 +118,10 @@ func (s *Store) ListServiceAccounts(ctx context.Context, find *FindServiceAccounvar sa ServiceAccountMessagevar project sql.NullStringif err := rows.Scan(- &sa.ID,&sa.MemberDeleted,&sa.Email,&sa.Name,- &sa.PasswordHash,+ &sa.ServiceKeyHash,&project,); err != nil {return nil, err@@ -151,41 +142,30 @@ func (s *Store) ListServiceAccounts(ctx context.Context, find *FindServiceAccounfunc (s *Store) CreateServiceAccount(ctx context.Context, create *CreateServiceAccountMessage) (*ServiceAccountMessage, error) {email := strings.ToLower(create.Email)- profileBytes, err := protojson.Marshal(&storepb.UserProfile{})- if err != nil {- return nil, err- }-q := qb.Q().Space(`- INSERT INTO principal (+ INSERT INTO service_account (email,name,- type,- password_hash,- phone,- profile,+ service_key_hash,project)- VALUES (?, ?, ?, ?, '', ?, ?)- RETURNING id- `, email, create.Name, storepb.PrincipalType_SERVICE_ACCOUNT.String(), create.PasswordHash, profileBytes, create.Project)+ VALUES (?, ?, ?, ?)+ `, email, create.Name, create.ServiceKeyHash, create.Project)sqlStr, args, err := q.ToSQL()if err != nil {return nil, errors.Wrapf(err, "failed to build sql")}- var saID int- if err := s.GetDB().QueryRowContext(ctx, sqlStr, args...).Scan(&saID); err != nil {+ if _, err := s.GetDB().ExecContext(ctx, sqlStr, args...); err != nil {return nil, err}return &ServiceAccountMessage{- ID: saID,- Email: email,- Name: create.Name,- PasswordHash: create.PasswordHash,- Project: create.Project,+ Email: email,+ Name: create.Name,+ ServiceKeyHash: create.ServiceKeyHash,+ Project: create.Project,}, nil}@@ -198,17 +178,17 @@ func (s *Store) UpdateServiceAccount(ctx context.Context, sa *ServiceAccountMessif v := patch.Name; v != nil {set.Comma("name = ?", *v)}- if v := patch.PasswordHash; v != nil {- set.Comma("password_hash = ?", *v)+ if v := patch.ServiceKeyHash; v != nil {+ set.Comma("service_key_hash = ?", *v)}if set.Len() == 0 {return sa, nil}- sqlStr, args, err := qb.Q().Space(`UPDATE principal SET ? WHERE id = ?- RETURNING id, deleted, email, name, password_hash, project`,- set, sa.ID).ToSQL()+ sqlStr, args, err := qb.Q().Space(`UPDATE service_account SET ? WHERE email = ?+ RETURNING deleted, email, name, service_key_hash, project`,+ set, sa.Email).ToSQL()if err != nil {return nil, errors.Wrapf(err, "failed to build sql")}@@ -216,11 +196,10 @@ func (s *Store) UpdateServiceAccount(ctx context.Context, sa *ServiceAccountMessvar updated ServiceAccountMessagevar project sql.NullStringif err := s.GetDB().QueryRowContext(ctx, sqlStr, args...).Scan(- &updated.ID,&updated.MemberDeleted,&updated.Email,&updated.Name,- &updated.PasswordHash,+ &updated.ServiceKeyHash,&project,); err != nil {return nil, errdiff --git a/backend/store/stats.go b/backend/store/stats.goindex 05b62ec2e4..3557bc47c7 100644--- a/backend/store/stats.go+++ b/backend/store/stats.go@@ -6,7 +6,6 @@ import ("github.com/pkg/errors""github.com/bytebase/bytebase/backend/common/qb"- storepb "github.com/bytebase/bytebase/backend/generated-go/store")// CountActiveInstances counts the number of instances.@@ -27,7 +26,7 @@ func (s *Store) CountActiveInstances(ctx context.Context) (int, error) {// CountActiveEndUsers counts the number of endusers.func (s *Store) CountActiveEndUsers(ctx context.Context) (int, error) {- q := qb.Q().Space("SELECT count(DISTINCT principal.id) FROM principal WHERE principal.deleted = ? AND principal.type = ?", false, storepb.PrincipalType_END_USER.String())+ q := qb.Q().Space("SELECT count(DISTINCT principal.id) FROM principal WHERE principal.deleted = ?", false)query, args, err := q.ToSQL()if err != nil {return 0, errors.Wrapf(err, "failed to build sql")diff --git a/backend/store/principal_workload_identity.go b/backend/store/workload_identity.gosimilarity index 70%rename from backend/store/principal_workload_identity.gorename to backend/store/workload_identity.goindex 0493e0708b..7207a4d064 100644--- a/backend/store/principal_workload_identity.go+++ b/backend/store/workload_identity.go@@ -7,7 +7,6 @@ import ("github.com/pkg/errors""google.golang.org/protobuf/encoding/protojson"- "google.golang.org/protobuf/types/known/timestamppb""github.com/bytebase/bytebase/backend/common""github.com/bytebase/bytebase/backend/common/qb"@@ -16,7 +15,6 @@ import (// WorkloadIdentityMessage is the message for a workload identity.type WorkloadIdentityMessage struct {- ID int// Email must be lower case, format: {name}@{project-id}.workload.bytebase.com or {name}@workload.bytebase.comEmail stringName string@@ -25,13 +23,10 @@ type WorkloadIdentityMessage struct {Project *string// Config is the workload identity configuration.Config *storepb.WorkloadIdentityConfig- // LastLoginTime is the last login time of the workload identity.- LastLoginTime *timestamppb.Timestamp}// FindWorkloadIdentityMessage is the message for finding workload identities.type FindWorkloadIdentityMessage struct {- ID *intEmail *stringShowDeleted boolLimit *int@@ -55,10 +50,9 @@ type CreateWorkloadIdentityMessage struct {// UpdateWorkloadIdentityMessage is the message to update a workload identity.type UpdateWorkloadIdentityMessage struct {- Name *string- Delete *bool- Config *storepb.WorkloadIdentityConfig- LastLoginTime *timestamppb.Timestamp+ Name *string+ Delete *bool+ Config *storepb.WorkloadIdentityConfig}// GetWorkloadIdentityByEmail gets a workload identity by email.@@ -75,11 +69,8 @@ func (s *Store) GetWorkloadIdentityByEmail(ctx context.Context, email string) (*// ListWorkloadIdentities lists workload identities.func (s *Store) ListWorkloadIdentities(ctx context.Context, find *FindWorkloadIdentityMessage) ([]*WorkloadIdentityMessage, error) {- where := qb.Q().Space("type = ?", storepb.PrincipalType_WORKLOAD_IDENTITY.String())+ where := qb.Q().Space("TRUE")- if v := find.ID; v != nil {- where.And("id = ?", *v)- }if v := find.Email; v != nil {where.And("email = ?", strings.ToLower(*v))}@@ -99,13 +90,12 @@ func (s *Store) ListWorkloadIdentities(ctx context.Context, find *FindWorkloadIdq := qb.Q().Space(`SELECT- id,deleted,email,name,project,- profile- FROM principal+ config+ FROM workload_identityWHERE ?ORDER BY created_at ASC`, where)@@ -132,27 +122,24 @@ func (s *Store) ListWorkloadIdentities(ctx context.Context, find *FindWorkloadIdfor rows.Next() {var wi WorkloadIdentityMessagevar project sql.NullString- var profileBytes []byte+ var configBytes []byteif err := rows.Scan(- &wi.ID,&wi.MemberDeleted,&wi.Email,&wi.Name,&project,- &profileBytes,+ &configBytes,); err != nil {return nil, err}if project.Valid {wi.Project = &project.String}- // Parse profile to extract workload identity config- var profile storepb.UserProfile- if err := common.ProtojsonUnmarshaler.Unmarshal(profileBytes, &profile); err != nil {+ var config storepb.WorkloadIdentityConfig+ if err := common.ProtojsonUnmarshaler.Unmarshal(configBytes, &config); err != nil {return nil, err}- wi.Config = profile.WorkloadIdentityConfig- wi.LastLoginTime = profile.LastLoginTime+ wi.Config = &configwis = append(wis, &wi)}if err := rows.Err(); err != nil {@@ -166,40 +153,31 @@ func (s *Store) ListWorkloadIdentities(ctx context.Context, find *FindWorkloadIdfunc (s *Store) CreateWorkloadIdentity(ctx context.Context, create *CreateWorkloadIdentityMessage) (*WorkloadIdentityMessage, error) {email := strings.ToLower(create.Email)- profile := &storepb.UserProfile{- WorkloadIdentityConfig: create.Config,- }- profileBytes, err := protojson.Marshal(profile)+ configBytes, err := protojson.Marshal(create.Config)if err != nil {return nil, err}q := qb.Q().Space(`- INSERT INTO principal (+ INSERT INTO workload_identity (email,name,- type,- password_hash,- phone,- profile,- project+ project,+ config)- VALUES (?, ?, ?, '', '', ?, ?)- RETURNING id- `, email, create.Name, storepb.PrincipalType_WORKLOAD_IDENTITY.String(), profileBytes, create.Project)+ VALUES (?, ?, ?, ?)+ `, email, create.Name, create.Project, configBytes)sqlStr, args, err := q.ToSQL()if err != nil {return nil, errors.Wrapf(err, "failed to build sql")}- var wiID int- if err := s.GetDB().QueryRowContext(ctx, sqlStr, args...).Scan(&wiID); err != nil {+ if _, err := s.GetDB().ExecContext(ctx, sqlStr, args...); err != nil {return nil, err}return &WorkloadIdentityMessage{- ID: wiID,Email: email,Name: create.Name,Project: create.Project,@@ -216,63 +194,46 @@ func (s *Store) UpdateWorkloadIdentity(ctx context.Context, wi *WorkloadIdentityif v := patch.Name; v != nil {set.Comma("name = ?", *v)}- // Config update requires updating the profile JSON- updateConfig := patch.Config != nil- updateLastLoginTime := patch.LastLoginTime != nil- if updateConfig || updateLastLoginTime {- profile := &storepb.UserProfile{- WorkloadIdentityConfig: wi.Config,- LastLoginTime: wi.LastLoginTime,- }- if updateConfig {- profile.WorkloadIdentityConfig = patch.Config- }- if updateLastLoginTime {- profile.LastLoginTime = patch.LastLoginTime- }- profileBytes, err := protojson.Marshal(profile)+ if v := patch.Config; v != nil {+ configBytes, err := protojson.Marshal(v)if err != nil {return nil, err}- set.Comma("profile = ?", profileBytes)+ set.Comma("config = ?", configBytes)}if set.Len() == 0 {return wi, nil}- sqlStr, args, err := qb.Q().Space(`UPDATE principal SET ? WHERE id = ?- RETURNING id, deleted, email, name, project, profile`,- set, wi.ID).ToSQL()+ sqlStr, args, err := qb.Q().Space(`UPDATE workload_identity SET ? WHERE email = ?+ RETURNING deleted, email, name, project, config`,+ set, wi.Email).ToSQL()if err != nil {return nil, errors.Wrapf(err, "failed to build sql")}var updated WorkloadIdentityMessagevar project sql.NullString- var profileBytes []byte+ var configBytes []byteif err := s.GetDB().QueryRowContext(ctx, sqlStr, args...).Scan(- &updated.ID,&updated.MemberDeleted,&updated.Email,&updated.Name,&project,- &profileBytes,+ &configBytes,); err != nil {return nil, err}if project.Valid {updated.Project = &project.String}- // Parse profile to extract workload identity config- var profile storepb.UserProfile- if err := common.ProtojsonUnmarshaler.Unmarshal(profileBytes, &profile); err != nil {+ var config storepb.WorkloadIdentityConfig+ if err := common.ProtojsonUnmarshaler.Unmarshal(configBytes, &config); err != nil {return nil, err}- updated.Config = profile.WorkloadIdentityConfig- updated.LastLoginTime = profile.LastLoginTime+ updated.Config = &config- // Also update the unified cache if this WI is in theres.userEmailCache.Remove(wi.Email)return &updated, nildiff --git a/backend/store/workload_identity_test.go b/backend/store/workload_identity_test.gonew file mode 100644index 0000000000..2e2196f48b--- /dev/null+++ b/backend/store/workload_identity_test.go@@ -0,0 +1,59 @@+package store++import (+ "testing"++ "github.com/stretchr/testify/require"++ storepb "github.com/bytebase/bytebase/backend/generated-go/store"+)++func TestWorkloadIdentityMessageConfig(t *testing.T) {+ config := &storepb.WorkloadIdentityConfig{+ ProviderType: storepb.WorkloadIdentityConfig_GITHUB,+ IssuerUrl: "https://token.actions.githubusercontent.com",+ AllowedAudiences: []string{"https://github.com/myorg"},+ SubjectPattern: "repo:myorg/myrepo:ref:refs/heads/main",+ }+ wi := &WorkloadIdentityMessage{+ Config: config,+ }++ require.NotNil(t, wi.Config)+ require.Equal(t, storepb.WorkloadIdentityConfig_GITHUB, wi.Config.ProviderType)+ require.Equal(t, "https://token.actions.githubusercontent.com", wi.Config.IssuerUrl)+ require.Equal(t, []string{"https://github.com/myorg"}, wi.Config.AllowedAudiences)+ require.Equal(t, "repo:myorg/myrepo:ref:refs/heads/main", wi.Config.SubjectPattern)+}++func TestCreateWorkloadIdentityMessageConfig(t *testing.T) {+ create := &CreateWorkloadIdentityMessage{+ Email: "[email protected]",+ Name: "test",+ Config: &storepb.WorkloadIdentityConfig{+ ProviderType: storepb.WorkloadIdentityConfig_GITHUB,+ IssuerUrl: "https://token.actions.githubusercontent.com",+ AllowedAudiences: []string{"https://github.com/myorg"},+ SubjectPattern: "repo:myorg/*",+ },+ }++ require.Equal(t, "[email protected]", create.Email)+ require.Equal(t, "test", create.Name)+ require.NotNil(t, create.Config)+ require.Equal(t, storepb.WorkloadIdentityConfig_GITHUB, create.Config.ProviderType)+}++func TestUpdateWorkloadIdentityMessageConfig(t *testing.T) {+ patch := &UpdateWorkloadIdentityMessage{+ Config: &storepb.WorkloadIdentityConfig{+ ProviderType: storepb.WorkloadIdentityConfig_GITHUB,+ IssuerUrl: "https://token.actions.githubusercontent.com",+ AllowedAudiences: []string{"https://github.com/myorg"},+ SubjectPattern: "repo:myorg/*",+ },+ }++ require.NotNil(t, patch.Config)+ require.Equal(t, "repo:myorg/*", patch.Config.SubjectPattern)+}diff --git a/backend/tests/approval_test.go b/backend/tests/approval_test.goindex dfecd244c6..6d284128f9 100644--- a/backend/tests/approval_test.go+++ b/backend/tests/approval_test.go@@ -937,7 +937,6 @@ func TestSelfApprovalBlocked(t *testing.T) {Email: approverEmail,Password: approverPassword,Title: "Approver",- UserType: v1pb.UserType_USER,},}))a.NoError(err)diff --git a/backend/tests/tests.go b/backend/tests/tests.goindex 81955dc786..5f0d59d989 100644--- a/backend/tests/tests.go+++ b/backend/tests/tests.go@@ -369,7 +369,6 @@ func (ctl *controller) signupAndLogin(ctx context.Context) (string, error) {Email: "[email protected]",Password: "1024bytebase",Title: "demo",- UserType: v1pb.UserType_USER,},}))if err != nil && !strings.Contains(err.Error(), "exist") {diff --git a/backend/tests/user_test.go b/backend/tests/user_test.goindex cdde3dce9b..c077d14780 100644--- a/backend/tests/user_test.go+++ b/backend/tests/user_test.go@@ -28,7 +28,6 @@ func TestDeleteUser(t *testing.T) {memberResp, err := ctl.userServiceClient.CreateUser(ctx, connect.NewRequest(&v1pb.CreateUserRequest{User: &v1pb.User{Title: "member",- UserType: v1pb.UserType_USER,Email: "[email protected]",Password: "1024bytebase",},@@ -158,7 +157,6 @@ func TestUpdateUserEmail(t *testing.T) {userResp, err := ctl.userServiceClient.CreateUser(ctx, connect.NewRequest(&v1pb.CreateUserRequest{User: &v1pb.User{Title: "temp-user",- UserType: v1pb.UserType_USER,Email: originalEmail,Password: "1024bytebase",},diff --git a/docs/plans/saas/00.challenges-and-roadmap.md b/docs/plans/saas/00.challenges-and-roadmap.mdnew file mode 100644index 0000000000..7882a6a924--- /dev/null+++ b/docs/plans/saas/00.challenges-and-roadmap.md@@ -0,0 +1,191 @@+# SaaS Multi-Tenancy: Challenges and Roadmap++## Goal++Refactor Bytebase from per-user isolation (one container per workspace) to a true SaaS model (single container, shared endpoint at `console.bytebase.com`).++## Chosen Approach: Row-Level Isolation++Add a `workspace_id` column to root-level tables. Project-child tables reuse their existing `project` FK for workspace scoping -- the `project` table has `workspace_id`, so any query that filters by `project` is implicitly workspace-scoped.++---++## Key Challenges++### Challenge 1: Workspace Isolation++Separate different workspaces so users only see their own data.++### Challenge 2: Database Connection Routing++Single connection pool; workspace resolved from JWT, applied as query filter (`WHERE workspace_id = $1` on root tables, `WHERE project = $1` on project children).++### Challenge 3: Background Runners++Runners poll for pending tasks across ALL workspaces with a single query. Each task carries `workspace_id` for context when processing.++### Challenge 4: API Resource Naming++Current API uses flat resource names with no workspace prefix:+- `projects/{project}`, `instances/{instance}`, `environments/{environment}`+- `projects/{project}/issues/{issue}`, `instances/{instance}/databases/{database}`++Two options:++**Option A: Keep flat names, resolve workspace from JWT (recommended)**++The middleware resolves workspace from the JWT and injects it as a query parameter. Resource IDs like `projects/default` are unique per-workspace because `project` has `UNIQUE(workspace_id, resource_id)`. Project-child queries use the project FK which is already workspace-scoped.++- Zero API breaking changes+- Zero proto changes+- Resource ID uniqueness scoped by `workspace_id` in unique indexes on root tables++**Option B: Explicit workspace prefix (`workspaces/{workspace}/projects/{project}`)**++AIP-compliant but requires changing every endpoint, proto definition, resource name parser, frontend API call, and external integration (Terraform provider, API clients, webhooks).++**Recommendation**: Option A. Workspace scoping is enforced at the DB level (root tables via `workspace_id`, child tables via `project` FK), making URL-level scoping redundant.++### Challenge 5: Multi-Workspace User Identity++Current model: single workspace per installation. `principal` table holds END_USER, SERVICE_ACCOUNT, and WORKLOAD_IDENTITY in one table.++SaaS model requires:+- A user can belong to multiple workspaces+- Auth (login, password, MFA, OAuth) is workspace-independent+- After login, user picks a workspace (or auto-redirects if only one)+- JWT includes both `user_id` and `workspace_id`++**Solution**: Split the `principal` table into three separate tables:+- **`principal`** -- keeps only END_USER rows. This IS the global account/identity table. No `workspace_id` needed (a user can belong to multiple workspaces). No data migration required -- just remove SERVICE_ACCOUNT/WORKLOAD_IDENTITY rows.+- **`service_account`** -- new table for SERVICE_ACCOUNT rows. Workspace-scoped via `project` FK (project-level) or `workspace_id` (workspace-level).+- **`workload_identity`** -- new table for WORKLOAD_IDENTITY rows. Same scoping as service_account.++The store layer already treats these as separate entities (`principal.go`, `principal_service_account.go`, `principal_workload_identity.go`), all querying the same `principal` table with `WHERE type = ?`. The split makes the schema match the existing code structure.++Workspace membership is tracked by the `policy` table's IAM policy (`resource_type = 'WORKSPACE'`), so no separate membership table is needed.++### Why RLS Was Rejected++RLS policies are per-table: each table must have its own `workspace_id` column for the policy `USING (workspace_id = current_setting('app.workspace_id'))` to evaluate. This means:++- All 30+ workspace-scoped tables would need a `workspace_id` column+- Cannot leverage existing `project` FK for workspace scoping on child tables+- Conflicts with the goal of minimizing schema changes++Row-level isolation with project-FK scoping requires `workspace_id` on only 12 root tables, while child tables use their existing FK relationships.++---++## Table Classification++### Tier 1: Root Tables That Need `workspace_id` (12 tables)++These are top-level entities with no parent FK that provides workspace scoping. They get a `workspace_id` column directly.++| Table | Notes |+|-------|-------|+| `project` | Top-level resource, anchor for project-child scoping |+| `instance` | Top-level resource |+| `service_account` | New table (split from `principal`), workspace-scoped |+| `workload_identity` | New table (split from `principal`), workspace-scoped |+| `setting` | Workspace configuration |+| `policy` | Workspace/env/project policies |+| `role` | Custom roles |+| `idp` | Identity providers |+| `review_config` | Review configurations |+| `user_group` | Groups |+| `export_archive` | Data exports |+| `audit_log` | Audit trail |++### Tier 2: Project Children -- Scoped via `project` FK (9 tables)++These already have a `project` FK referencing `project(resource_id)`. Since `project` has `workspace_id`, queries on these tables filter by `WHERE project = $1` where the project is already validated as belonging to the current workspace. **No `workspace_id` column needed.**++| Table | FK |+|-------|-----|+| `plan` | `project text NOT NULL REFERENCES project(resource_id)` |+| `issue` | `project text NOT NULL REFERENCES project(resource_id)` |+| `db` | `project text NOT NULL REFERENCES project(resource_id)` |+| `project_webhook` | `project text NOT NULL REFERENCES project(resource_id)` |+| `worksheet` | `project text NOT NULL REFERENCES project(resource_id)` |+| `db_group` | `project text NOT NULL REFERENCES project(resource_id)` |+| `release` | `project text NOT NULL REFERENCES project(resource_id)` |+| `access_grant` | `project text NOT NULL REFERENCES project(resource_id)` |+| `query_history` | `project_id text NOT NULL` (resource id, no FK constraint) |++### Tier 3: Grandchild Tables -- Scoped via Parent Chain (11 tables)++These are children of Tier 2 tables. They have no `project` FK and no `workspace_id`. Workspace scoping is inherited through the FK chain -- they are always accessed via their parent, which is already workspace-scoped.++**Plan/pipeline grandchildren (5):**++| Table | FK chain to workspace |+|-------|----------------------|+| `plan_check_run` | -> `plan(id)` -> `plan.project` -> `project.workspace_id` |+| `plan_webhook_delivery` | -> `plan(id)` -> `plan.project` -> `project.workspace_id` |+| `task` | -> `plan(id)` -> `plan.project` -> `project.workspace_id` |+| `task_run` | -> `task(id)` -> `plan(id)` -> ... |+| `task_run_log` | -> `task_run(id)` -> `task(id)` -> ... |++**Issue grandchildren (1):**++| Table | FK chain to workspace |+|-------|----------------------|+| `issue_comment` | -> `issue(id)` -> `issue.project` -> `project.workspace_id` |++**DB grandchildren (4):**++| Table | FK chain to workspace |+|-------|----------------------|+| `db_schema` | -> `db` (via instance+db_name) -> `db.project` -> `project.workspace_id` |+| `revision` | -> `db` (via instance+db_name) -> `db.project` -> `project.workspace_id` |+| `sync_history` | -> `db` (via instance+db_name) -> `db.project` -> `project.workspace_id` |+| `changelog` | -> `db` (via instance+db_name) -> `db.project` -> `project.workspace_id` |++**Worksheet grandchildren (1):**++| Table | FK chain to workspace |+|-------|----------------------|+| `worksheet_organizer` | -> `worksheet(id)` -> `worksheet.project` -> `project.workspace_id` |++### Tables That Do NOT Need `workspace_id` (5 tables)++| Table | Reason |+|-------|--------|+| `sheet_blob` | Content-addressed by SHA256, shared/deduped across workspaces |+| `replica_heartbeat` | Infrastructure, not workspace-scoped |+| `instance_change_history` | Bytebase internal migration version tracker |+| `workspace` | It IS the workspace |+| `principal` | Global identity layer (END_USER only, cross-workspace) |++### Auth Token Tables -- Tied to Identity Layer (no `workspace_id`)++| Table | Reason |+|-------|--------|+| `web_refresh_token` | Tied to principal, not workspace |+| `oauth2_client` | Global OAuth2 app registration |+| `oauth2_authorization_code` | Login flow |+| `oauth2_refresh_token` | Login flow |++### Summary++| Tier | Tables | `workspace_id` column | Workspace scoping mechanism |+|------|--------|-----------------------|----------------------------|+| **Root** | 12 | Yes (10 existing + 2 new) | Direct `WHERE workspace_id = $1` |+| **Project children** | 9 | No | `WHERE project = $1` (project already validated) |+| **Grandchildren** | 11 | No | Parent FK chain (parent validated by caller) |+| **Global** | 5 | No | Not workspace-scoped |+| **Auth** | 4 | No | Tied to `principal` (identity) layer |+| **Total** | **41** | **12 have column** | |++---++## Roadmap++| Step | File | Description |+|------|------|-------------|+| 01 | [01.prepare-for-saas.md](./01.prepare-for-saas.md) | Preparatory refactors that can land independently: split `principal` table, fix workspace IAM policy resource field, migrate `serial` to `bigserial` |+| 02 | [02.database-migration.md](./02.database-migration.md) | Create `workspace` table, add `workspace_id` to root tables, update unique indexes |+| 03 | [03.application-layer.md](./03.application-layer.md) | Middleware, store/service changes to enforce workspace scoping on API requests |+| 04 | [04.runners-and-auth.md](./04.runners-and-auth.md) | Background runner workspace resolution, auth flow changes (login, workspace picker, JWT) |diff --git a/docs/plans/saas/01.prepare-for-saas.md b/docs/plans/saas/01.prepare-for-saas.mdnew file mode 100644index 0000000000..7663ac17ee--- /dev/null+++ b/docs/plans/saas/01.prepare-for-saas.md@@ -0,0 +1,469 @@+# Step 01: Prepare for SaaS++Preparatory refactors that can land independently on the current single-workspace codebase. Each section is a self-contained change with no dependency on the `workspace` table.++---++## 1. Split `principal` into Three Tables++### Why++The `principal` table currently stores three entity types (`END_USER`, `SERVICE_ACCOUNT`, `WORKLOAD_IDENTITY`) differentiated by a `type` column. In SaaS mode:+- `principal` (END_USER) becomes the **global identity** table -- no `workspace_id`, since a user can belong to multiple workspaces.+- `service_account` and `workload_identity` become **workspace-scoped** tables with `workspace_id`.++The store layer already treats them as separate entities (`principal.go`, `principal_service_account.go`, `principal_workload_identity.go`), all querying the same table with `WHERE type = ?`. Splitting the table makes the schema match the code.++### Current Schema++```sql+CREATE TABLE principal (+ id serial PRIMARY KEY,+ deleted boolean NOT NULL DEFAULT FALSE,+ created_at timestamptz NOT NULL DEFAULT now(),+ type text NOT NULL CHECK (type IN ('END_USER', 'SERVICE_ACCOUNT', 'WORKLOAD_IDENTITY')),+ name text NOT NULL,+ email text NOT NULL,+ password_hash text NOT NULL,+ phone text NOT NULL DEFAULT '',+ mfa_config jsonb NOT NULL DEFAULT '{}',+ profile jsonb NOT NULL DEFAULT '{}',+ project text REFERENCES project(resource_id),+ CONSTRAINT principal_project_type_check CHECK (+ (type = 'END_USER' AND project IS NULL) OR+ (type IN ('SERVICE_ACCOUNT', 'WORKLOAD_IDENTITY'))+ )+);+```++### Foreign Key Impact: `creator` / `deleter` Columns++13 columns across the schema have `REFERENCES principal(email) ON UPDATE CASCADE`. Splitting the table requires dropping these FKs since creator emails can belong to any of the three types.++**All 13 FK references to `principal(email)`:**++| # | Table | Column | Constraint | Can be SA/WI? |+|---|-------|--------|-----------|---------------|+| 1 | `plan` | `creator` | NOT NULL, ON UPDATE CASCADE | Yes |+| 2 | `task_run` | `creator` | nullable, ON UPDATE CASCADE ON DELETE SET NULL | Yes |+| 3 | `issue` | `creator` | NOT NULL, ON UPDATE CASCADE | Yes |+| 4 | `issue_comment` | `creator` | NOT NULL, ON UPDATE CASCADE | Yes |+| 5 | `query_history` | `creator` | NOT NULL, ON UPDATE CASCADE | Yes |+| 6 | `worksheet` | `creator` | NOT NULL, ON UPDATE CASCADE | Yes |+| 7 | `worksheet_organizer` | `principal` | NOT NULL, ON UPDATE CASCADE | Yes |+| 8 | `revision` | `deleter` | nullable, ON UPDATE CASCADE | Yes |+| 9 | `release` | `creator` | NOT NULL, ON UPDATE CASCADE | Yes |+| 10 | `access_grant` | `creator` | NOT NULL, ON UPDATE CASCADE | Yes |+| 11 | `oauth2_authorization_code` | `user_email` | NOT NULL, ON UPDATE CASCADE | No (END_USER only) |+| 12 | `oauth2_refresh_token` | `user_email` | NOT NULL, ON UPDATE CASCADE | No (END_USER only) |+| 13 | `web_refresh_token` | `user_email` | NOT NULL, ON UPDATE CASCADE | No (END_USER only) |++Drop FKs on #1-10 (creator/deleter can be SA/WI). Keep FKs on #11-13 (END_USER only, auth tokens).++**Where creator/deleter is queried in code (6 places):**++| Store file | Query | Has index? |+|-----------|-------|-----------|+| `issue.go:250` | `WHERE issue.creator = ?` | Yes (`idx_issue_creator`) |+| `plan.go:301` | `WHERE plan.creator = ?` | **No -- needs adding** |+| `query_history.go:126` | `WHERE query_history.creator = ?` | Yes (`idx_query_history_creator_created_at_project_id`) |+| `worksheet.go:423,479` | `WHERE worksheet.creator = ?` / `!= ?` | Yes (`idx_worksheet_creator_project`) |+| `access_grant.go:350` | `WHERE access_grant.creator = ?` | Yes (`idx_access_grant_project_creator_expire_time`) |+| `project.go:500-533` | Cascading delete by `SELECT email FROM principal WHERE project = ?` | N/A (will query new tables) |++Other creator/deleter columns (`task_run.creator`, `issue_comment.creator`, `revision.deleter`, `release.creator`) are only SELECTed, never used in WHERE filters.++**Performance impact: none.** All creator queries use `WHERE creator = 'email'` with the stored email value -- they do NOT JOIN to `principal`. Splitting the table has zero impact on these queries. The only lookup that resolves a creator email to its entity is `GetPrincipalByEmail()` in the application layer, which already dispatches by email format (`IsServiceAccountEmail` / `IsWorkloadIdentityEmail`).++**ON UPDATE CASCADE replacement:** Only needed for END_USER email changes. `UpdateUserEmail()` already manually updates policies, issue payloads, groups, and audit logs. After dropping FKs, add explicit UPDATE statements for the 10 creator/deleter columns to that function.++### Migration SQL++```sql+-- Step 1: Create service_account table+CREATE TABLE service_account (+ id bigserial PRIMARY KEY,+ deleted boolean NOT NULL DEFAULT FALSE,+ created_at timestamptz NOT NULL DEFAULT now(),+ name text NOT NULL,+ email text NOT NULL,+ password_hash text NOT NULL,+ project text REFERENCES project(resource_id)+);++CREATE UNIQUE INDEX idx_service_account_unique_email ON service_account(email);+CREATE INDEX idx_service_account_project ON service_account(project) WHERE project IS NOT NULL;++-- Migrate SERVICE_ACCOUNT rows+INSERT INTO service_account (id, deleted, created_at, name, email, password_hash, project)+SELECT id, deleted, created_at, name, email, password_hash, project+FROM principal WHERE type = 'SERVICE_ACCOUNT';++-- Reset sequence to max id+SELECT setval('service_account_id_seq', GREATEST(COALESCE((SELECT MAX(id) FROM service_account), 0), 100) + 1, false);++-- Step 2: Create workload_identity table+CREATE TABLE workload_identity (+ id bigserial PRIMARY KEY,+ deleted boolean NOT NULL DEFAULT FALSE,+ created_at timestamptz NOT NULL DEFAULT now(),+ name text NOT NULL,+ email text NOT NULL,+ project text REFERENCES project(resource_id),+ -- Extracted from principal.profile->'workloadIdentityConfig'+ config jsonb NOT NULL DEFAULT '{}'+);++CREATE UNIQUE INDEX idx_workload_identity_unique_email ON workload_identity(email);+CREATE INDEX idx_workload_identity_project ON workload_identity(project) WHERE project IS NOT NULL;++-- Migrate WORKLOAD_IDENTITY rows (extract config from profile JSON)+INSERT INTO workload_identity (id, deleted, created_at, name, email, project, config)+SELECT id, deleted, created_at, name, email, project,+ COALESCE(profile->'workloadIdentityConfig', '{}')+FROM principal WHERE type = 'WORKLOAD_IDENTITY';++-- Reset sequence to max id+SELECT setval('workload_identity_id_seq', GREATEST(COALESCE((SELECT MAX(id) FROM workload_identity), 0), 100) + 1, false);++-- Step 3: Drop FK constraints on creator/deleter columns that can reference SA/WI emails.+-- Keep FKs on oauth2_authorization_code, oauth2_refresh_token, web_refresh_token (END_USER only).+ALTER TABLE plan DROP CONSTRAINT IF EXISTS plan_creator_fkey;+ALTER TABLE task_run DROP CONSTRAINT IF EXISTS task_run_creator_fkey;+ALTER TABLE issue DROP CONSTRAINT IF EXISTS issue_creator_fkey;+ALTER TABLE issue_comment DROP CONSTRAINT IF EXISTS issue_comment_creator_fkey;+ALTER TABLE query_history DROP CONSTRAINT IF EXISTS query_history_creator_fkey;+ALTER TABLE worksheet DROP CONSTRAINT IF EXISTS worksheet_creator_fkey;+ALTER TABLE worksheet_organizer DROP CONSTRAINT IF EXISTS worksheet_organizer_principal_fkey;+ALTER TABLE revision DROP CONSTRAINT IF EXISTS revision_deleter_fkey;+ALTER TABLE release DROP CONSTRAINT IF EXISTS release_creator_fkey;+ALTER TABLE access_grant DROP CONSTRAINT IF EXISTS access_grant_creator_fkey;++-- Step 4: Add missing index for plan.creator (queried in plan filter)+CREATE INDEX idx_plan_creator ON plan(creator);++-- Step 5: Clean up principal table -- remove non-END_USER rows, drop type and project columns+DELETE FROM principal WHERE type != 'END_USER';+ALTER TABLE principal DROP CONSTRAINT IF EXISTS principal_project_type_check;+ALTER TABLE principal DROP CONSTRAINT IF EXISTS principal_type_check;+ALTER TABLE principal DROP COLUMN type;+ALTER TABLE principal DROP COLUMN project;+DROP INDEX IF EXISTS idx_principal_project;+```++### Code Changes++**Store layer** -- `principal_service_account.go` and `principal_workload_identity.go` already have separate message types and query functions. The only change is updating the SQL to query `service_account` / `workload_identity` tables instead of `principal WHERE type = ?`.++Key files to update:+- `backend/store/principal.go` -- remove `type` from SELECT/INSERT/UPDATE, remove `UserTypes` filter from `FindUserMessage`+- `backend/store/principal.go` `CreateUser()` -- remove `type` from INSERT (all rows are END_USER)+- `backend/store/principal.go` `GetPrincipalByEmail()` -- already dispatches by email format, just update to query new tables+- `backend/store/principal.go` `BatchGetUsersByEmails()` -- needs to handle cross-table lookup (query `principal` for END_USER emails, `service_account` for SA emails, `workload_identity` for WI emails)+- `backend/store/principal.go` `StatUsers()` -- query all three tables and aggregate+- `backend/store/principal.go` `UpdateUserEmail()` -- add explicit UPDATE statements for the 10 creator/deleter columns that lost ON UPDATE CASCADE+- `backend/store/principal_service_account.go` -- change `FROM principal WHERE type = 'SERVICE_ACCOUNT'` to `FROM service_account`+- `backend/store/principal_workload_identity.go` -- change `FROM principal WHERE type = 'WORKLOAD_IDENTITY'` to `FROM workload_identity`+- `backend/store/principal_filter.go` -- update `GetAccountListFilter` to use table name instead of `principal.` prefix+- `backend/store/project.go` -- update cascading delete (lines 498-540) to query `service_account` / `workload_identity` instead of `principal WHERE project = ?`+- `backend/store/stats.go` -- simplify `CountActiveEndUsers` (no `type` filter needed)+- `backend/store/principal_end_user.go` -- simplify (no type checks needed)++**Migration test** -- update `TestLatestVersion` in `backend/migrator/migrator_test.go`.++---++## 2. Fix Workspace IAM Policy Resource Field++### Why++Currently, workspace-level IAM policies in the `policy` table have `resource_type = 'WORKSPACE'` but `resource = ''` (empty string). For SaaS mode, each workspace needs its own IAM policy, so we need the `resource` field to contain the workspace identifier (`workspaces/{id}`) to distinguish them.++### Current State++```sql+-- Current: resource is empty for workspace policies+SELECT resource_type, resource, type FROM policy+WHERE resource_type = 'WORKSPACE' AND type = 'IAM';+-- Returns: ('WORKSPACE', '', 'IAM')+```++The workspace identifier is stored in the `setting` table:+```sql+SELECT value->>'workspaceId' FROM setting WHERE name = 'WORKSPACE_PROFILE';+-- Returns the workspace ID (e.g., 'abc123')+```++### Migration SQL++```sql+-- Set resource = 'workspaces/{workspace_id}' for all workspace-level policies+UPDATE policy+SET resource = 'workspaces/' || (+ SELECT value->>'workspaceId'+ FROM setting+ WHERE name = 'WORKSPACE_PROFILE'+)+WHERE resource_type = 'WORKSPACE' AND resource = '';+```++### Code Changes++Update the store/service layer where workspace policies are queried or created:++- `backend/store/policy.go` `GetWorkspaceIamPolicy()` -- currently queries with just `ResourceType: WORKSPACE` and no resource filter. Update to include the workspace resource name.+- Any place that creates workspace-level policies -- ensure `resource = 'workspaces/{id}'` is set.+- Update the unique index for policy to ensure no duplicates:++```sql+-- The existing unique index on policy is:+-- idx_policy_unique_resource_type_resource_type ON policy(resource_type, resource, type)+-- This already works -- two workspace policies with different resource values are distinct.+```++---++## 3. Migrate Integer IDs to String IDs++### Why++Sequential integer IDs (`serial`/`bigserial`) have two problems for SaaS:++1. **Security** -- Sequential IDs are guessable and leak information (total count, creation rate, ordering). An attacker can enumerate resources by incrementing IDs: `plans/101`, `plans/102`, etc.+2. **Multi-tenancy** -- In a shared database, sequential IDs leak cross-tenant information. A customer creating `issues/5000` can infer that ~5000 issues exist across all tenants.++String IDs (e.g., UUIDs or nanoids) are opaque, non-sequential, and safe to expose in URLs.++### Tables That Expose Integer IDs in API++These 9 tables currently expose their integer `id` in API resource names:++| Table | API format | Current type |+|-------|-----------|-------------|+| `plan` | `projects/{project}/plans/{plan}` | bigserial |+| `task` | `.../tasks/{task}` | serial |+| `task_run` | `.../taskRuns/{taskRun}` | serial |+| `issue` | `projects/{project}/issues/{issue}` | serial |+| `issue_comment` | `.../issueComments/{issueComment}` | bigserial |+| `revision` | `.../revisions/{revision}` | bigserial |+| `changelog` | `.../changelogs/{changelog}` | bigserial |+| `worksheet` | `worksheets/{worksheet}` | serial |+| `project_webhook` | `projects/{project}/webhooks/{webhook}` | serial |++### Tables with Internal-Only Integer IDs++These 4 tables use integer IDs internally but do NOT expose them in API paths:++| Table | Usage |+|-------|-------|+| `sync_history` | Referenced via `changelog.sync_history_id` FK |+| `query_history` | Internal query audit trail |+| `export_archive` | Internal export tracking |+| `worksheet_organizer` | Internal worksheet pinning |++### Tables Already Using String IDs++These tables already use string/email identifiers (no change needed):++- `principal` -- `users/{email}`+- `service_account` -- `serviceAccounts/{email}`+- `workload_identity` -- `workloadIdentities/{email}`+- `project` -- `projects/{resource_id}`+- `instance` -- `instances/{resource_id}`+- `idp` -- `idps/{resource_id}`+- `role` -- `roles/{resource_id}`+- `user_group` -- UUID text PK+- `review_config` -- text PK+- `access_grant` -- UUID text PK++### Migration Plan++**Phase 1: Add `resource_id` column to API-exposed tables**++Add a new `text` column with a generated default, backfill existing rows, then switch the API to use it. This allows a zero-downtime migration.++```sql+-- For each API-exposed table, add resource_id column.+-- Use gen_random_uuid() for simplicity; can switch to nanoid if preferred.+ALTER TABLE plan ADD COLUMN resource_id text NOT NULL DEFAULT gen_random_uuid()::text;+ALTER TABLE task ADD COLUMN resource_id text NOT NULL DEFAULT gen_random_uuid()::text;+ALTER TABLE task_run ADD COLUMN resource_id text NOT NULL DEFAULT gen_random_uuid()::text;+ALTER TABLE issue ADD COLUMN resource_id text NOT NULL DEFAULT gen_random_uuid()::text;+ALTER TABLE issue_comment ADD COLUMN resource_id text NOT NULL DEFAULT gen_random_uuid()::text;+ALTER TABLE revision ADD COLUMN resource_id text NOT NULL DEFAULT gen_random_uuid()::text;+ALTER TABLE changelog ADD COLUMN resource_id text NOT NULL DEFAULT gen_random_uuid()::text;+ALTER TABLE worksheet ADD COLUMN resource_id text NOT NULL DEFAULT gen_random_uuid()::text;+ALTER TABLE project_webhook ADD COLUMN resource_id text NOT NULL DEFAULT gen_random_uuid()::text;++-- Create unique indexes+CREATE UNIQUE INDEX idx_plan_unique_resource_id ON plan(resource_id);+CREATE UNIQUE INDEX idx_task_unique_resource_id ON task(resource_id);+CREATE UNIQUE INDEX idx_task_run_unique_resource_id ON task_run(resource_id);+CREATE UNIQUE INDEX idx_issue_unique_resource_id ON issue(resource_id);+CREATE UNIQUE INDEX idx_issue_comment_unique_resource_id ON issue_comment(resource_id);+CREATE UNIQUE INDEX idx_revision_unique_resource_id ON revision(resource_id);+CREATE UNIQUE INDEX idx_changelog_unique_resource_id ON changelog(resource_id);+CREATE UNIQUE INDEX idx_worksheet_unique_resource_id ON worksheet(resource_id);+CREATE UNIQUE INDEX idx_project_webhook_unique_resource_id ON project_webhook(resource_id);+```++**Phase 2: Switch API layer to use `resource_id`**++Update resource name parsing functions in `backend/common/resource_name.go`:+- `GetProjectIDPlanID()` -- return `string` instead of `int64`+- `GetProjectIDIssueUID()` -- return `string` instead of `int`+- `GetWorksheetUID()` -- return `string` instead of `int`+- etc.++Update store `FindXxxMessage` structs to use `ResourceID *string` instead of `UID *int`.++**Phase 3: Migrate FK references from integer to string**++Tables that reference these IDs via FK need to be updated:++| FK column | References | Action |+|-----------|-----------|--------|+| `task.plan_id` | `plan(id)` | Change to `plan_resource_id text REFERENCES plan(resource_id)` |+| `task_run.task_id` | `task(id)` | Change to `task_resource_id text REFERENCES task(resource_id)` |+| `task_run_log.task_run_id` | `task_run(id)` | Change to `task_run_resource_id text REFERENCES task_run(resource_id)` |+| `issue.plan_id` | `plan(id)` | Change to `plan_resource_id text REFERENCES plan(resource_id)` |+| `issue_comment.issue_id` | `issue(id)` | Change to `issue_resource_id text REFERENCES issue(resource_id)` |+| `worksheet_organizer.worksheet_id` | `worksheet(id)` | Change to `worksheet_resource_id text REFERENCES worksheet(resource_id)` |+| `changelog.sync_history_id` | `sync_history(id)` | Keep as-is (internal, not exposed in API) |+| `plan_check_run.plan_id` | `plan(id)` | Change to `plan_resource_id text REFERENCES plan(resource_id)` |+| `plan_webhook_delivery.plan_id` | `plan(id)` | Change to `plan_resource_id text REFERENCES plan(resource_id)` |++**Phase 4: Drop integer `id` columns from API-exposed tables**++After all FK references are migrated, drop the old integer `id` columns and promote `resource_id` to primary key (same approach as Section 4).++### Code Changes++- **`backend/common/resource_name.go`** -- All `GetXxxID()` functions return `string` instead of `int`/`int64`. Remove `strconv.Atoi()`/`strconv.ParseInt()` calls.+- **Store message types** -- Change `ID int` / `UID int` fields to `ResourceID string`.+- **Store SQL** -- Update all `WHERE id = ?` to `WHERE resource_id = ?`, all `RETURNING id` to `RETURNING resource_id`.+- **Proto** -- No change needed (resource names are already strings in the proto API).+- **Frontend** -- No change needed (the frontend already treats resource IDs as opaque strings in URL paths).++### Internal-Only Tables++The 4 tables with internal-only integer IDs (`sync_history`, `query_history`, `export_archive`, `worksheet_organizer`) can keep integer IDs since they are never exposed in API paths. However, for consistency, consider migrating them in a follow-up.++---++## 4. Remove Unused `id` Columns++### Why++Many tables have a `serial`/`bigserial` `id` column as the PRIMARY KEY but never use it for queries -- all lookups, JOINs, and foreign keys use natural keys (`resource_id`, `email`, `name`, composite unique constraints). These unused `id` columns add unnecessary overhead and complicate the schema. Removing them simplifies the data model and makes the natural keys the explicit primary keys.++**Relationship with Section 3:** Section 3 migrates tables that DO use their integer `id` to string `resource_id`. This section removes the `id` column from tables that DON'T use it at all. Both sections can be done independently.++### Tables with Unused `id` Columns++| Table | Natural Key | `id` usage | FK references to `id`? |+|-------|------------|------------|----------------------|+| `setting` | `name` (unique) | None | No |+| `policy` | `(resource_type, resource, type)` (unique) | None | No |+| `idp` | `resource_id` (unique) | `ORDER BY id` only | No |+| `role` | `resource_id` (unique) | None | No |+| `db_schema` | `(instance, db_name)` (unique) | None | No |+| `db_group` | `(project, resource_id)` (unique) | None | No |+| `project` | `resource_id` (unique) | None | No (FKs use `resource_id`) |+| `instance` | `resource_id` (unique) | None | No (FKs use `resource_id`) |+| `db` | `(instance, name)` (unique) | None | No (FKs use `(instance, name)`) |+| `task_run_log` | `task_run_id` (FK) | `ORDER BY id` only | No |+| `release` | `(project, train, iteration)` (unique) | `RETURNING id` (discarded), `ORDER BY id` | No |+| `instance_change_history` | `version` (unique) | No store file (legacy table) | No |++### Tables Where `id` IS Used (Keep or Migrate per Section 3)++These tables actively use `id` in WHERE/JOIN or have FK references from other tables. Tables marked with ★ are covered by Section 3 (migrate integer `id` → string `resource_id`):++| Table | Why `id` is needed | Section 3? |+|-------|-------------------|-----------|+| `plan` | FK from `task`, `issue`, `plan_check_run`, `plan_webhook_delivery` | ★ API-exposed |+| `task` | FK from `task_run` | ★ API-exposed |+| `task_run` | FK from `task_run_log`; used in WHERE for lookups | ★ API-exposed |+| `issue` | FK from `issue_comment`; used in WHERE for lookups | ★ API-exposed |+| `issue_comment` | Used in WHERE/UPDATE by id | ★ API-exposed |+| `revision` | Used in WHERE/DELETE by id | ★ API-exposed |+| `changelog` | Used in WHERE/UPDATE by id | ★ API-exposed |+| `worksheet` | FK from `worksheet_organizer`; used in WHERE/DELETE | ★ API-exposed |+| `project_webhook` | Used in WHERE/UPDATE/DELETE by id | ★ API-exposed |+| `plan_check_run` | Used in WHERE/UPDATE by id | Singleton (no id in API path) |+| `sync_history` | FK from `changelog`; used in WHERE for lookups | Internal only |+| `principal` | Used in WHERE/UPDATE by id | Uses email |+| `service_account` | Used in WHERE/UPDATE by id | Uses email |+| `workload_identity` | Used in WHERE/UPDATE by id | Uses email |+| `audit_log` | Used in ORDER BY, stored in message | Internal only |+| `query_history` | Used in ORDER BY, stored in message | Internal only |+| `export_archive` | Used in WHERE/DELETE by id | Internal only |+| `worksheet_organizer` | Stored in message | Internal only |++### Migration SQL++```sql+-- For each table, drop the id column and promote the natural key to PRIMARY KEY.+-- Order matters: drop tables with no dependents first.++-- setting: natural key = name+ALTER TABLE setting DROP COLUMN id;+ALTER TABLE setting ADD PRIMARY KEY (name);++-- policy: natural key = (resource_type, resource, type)+ALTER TABLE policy DROP COLUMN id;+ALTER TABLE policy ADD PRIMARY KEY (resource_type, resource, type);++-- idp: natural key = resource_id+ALTER TABLE idp DROP COLUMN id;+ALTER TABLE idp ADD PRIMARY KEY (resource_id);++-- role: natural key = resource_id+ALTER TABLE role DROP COLUMN id;+ALTER TABLE role ADD PRIMARY KEY (resource_id);++-- db_schema: natural key = (instance, db_name)+ALTER TABLE db_schema DROP COLUMN id;+ALTER TABLE db_schema ADD PRIMARY KEY (instance, db_name);+DROP INDEX IF EXISTS idx_db_schema_unique_instance_db_name;++-- db_group: natural key = (project, resource_id)+ALTER TABLE db_group DROP COLUMN id;+ALTER TABLE db_group ADD PRIMARY KEY (project, resource_id);+DROP INDEX IF EXISTS idx_db_group_unique_project_resource_id;++-- project: natural key = resource_id+ALTER TABLE project DROP COLUMN id;+ALTER TABLE project ADD PRIMARY KEY (resource_id);++-- instance: natural key = resource_id+ALTER TABLE instance DROP COLUMN id;+ALTER TABLE instance ADD PRIMARY KEY (resource_id);++-- db: natural key = (instance, name)+ALTER TABLE db DROP COLUMN id;+ALTER TABLE db ADD PRIMARY KEY (instance, name);+DROP INDEX IF EXISTS idx_db_unique_instance_name;++-- task_run_log: no natural PK, use task_run_id + created_at+ALTER TABLE task_run_log DROP COLUMN id;+ALTER TABLE task_run_log ADD PRIMARY KEY (task_run_id, created_at);++-- release: natural key = (project, train, iteration)+ALTER TABLE release DROP COLUMN id;+ALTER TABLE release ADD PRIMARY KEY (project, train, iteration);+DROP INDEX IF EXISTS idx_release_project_train_iteration;++-- instance_change_history: natural key = version+ALTER TABLE instance_change_history DROP COLUMN id;+ALTER TABLE instance_change_history ADD PRIMARY KEY (version);+DROP INDEX IF EXISTS idx_instance_change_history_unique_version;+```++### Code Changes++- **Store files**: Remove `id` from SELECT lists, INSERT RETURNING clauses, and message struct fields where applicable.+- **ORDER BY id**: Replace with `ORDER BY created_at` (for `idp`, `task_run_log`, `release`) or `ORDER BY resource_id` where appropriate.+- **release.go**: Remove the `var id int64` scan from the RETURNING clause.+- **Migration test**: Update `TestLatestVersion` in `backend/migrator/migrator_test.go`.diff --git a/docs/plans/saas/02.database-migration.md b/docs/plans/saas/02.database-migration.mdnew file mode 100644index 0000000000..64e5b278a2--- /dev/null+++ b/docs/plans/saas/02.database-migration.md@@ -0,0 +1,181 @@+# Step 02: Database Migration++Create the `workspace` table, add `workspace_id` to root tables, and update indexes. This step depends on Step 01 (principal split, bigserial migration) being completed first.++---++## 1. Create `workspace` Table++```sql+CREATE TABLE workspace (+ id text PRIMARY KEY, -- 'ws-xxxxxx'+ resource_id text UNIQUE NOT NULL, -- user-chosen slug: 'acme-corp'+ name text NOT NULL, -- display name+ created_at timestamptz NOT NULL DEFAULT now(),+ deleted boolean NOT NULL DEFAULT FALSE+);++-- For existing single-workspace installations, create the default workspace.+-- The workspace ID is derived from the existing setting.+INSERT INTO workspace (id, resource_id, name)+SELECT+ 'ws-' || (value->>'workspaceId'),+ COALESCE(NULLIF(value->>'workspaceId', ''), 'default'),+ 'Default Workspace'+FROM setting+WHERE name = 'WORKSPACE_PROFILE';+```++No `plan` column -- workspace plan/license info is already stored in the `setting` table (name = `'SYSTEM'`, value contains license). Once `setting` gets `workspace_id`, plan info is naturally workspace-scoped.++---++## 2. Add `workspace_id` to Root Tables++Add `workspace_id` to the 10 existing root-level tables. (`service_account` and `workload_identity` will get `workspace_id` added in this step too, since Step 01 creates them without it.)++For each table, the pattern is:+1. Add nullable column with FK+2. Backfill with the default workspace ID+3. Set NOT NULL++```sql+-- Helper: get the default workspace ID+-- All statements below use this subquery inline.++-- project+ALTER TABLE project ADD COLUMN workspace_id text REFERENCES workspace(id);+UPDATE project SET workspace_id = (SELECT id FROM workspace LIMIT 1);+ALTER TABLE project ALTER COLUMN workspace_id SET NOT NULL;++-- instance+ALTER TABLE instance ADD COLUMN workspace_id text REFERENCES workspace(id);+UPDATE instance SET workspace_id = (SELECT id FROM workspace LIMIT 1);+ALTER TABLE instance ALTER COLUMN workspace_id SET NOT NULL;++-- setting+ALTER TABLE setting ADD COLUMN workspace_id text REFERENCES workspace(id);+UPDATE setting SET workspace_id = (SELECT id FROM workspace LIMIT 1);+ALTER TABLE setting ALTER COLUMN workspace_id SET NOT NULL;++-- policy+ALTER TABLE policy ADD COLUMN workspace_id text REFERENCES workspace(id);+UPDATE policy SET workspace_id = (SELECT id FROM workspace LIMIT 1);+ALTER TABLE policy ALTER COLUMN workspace_id SET NOT NULL;++-- role+ALTER TABLE role ADD COLUMN workspace_id text REFERENCES workspace(id);+UPDATE role SET workspace_id = (SELECT id FROM workspace LIMIT 1);+ALTER TABLE role ALTER COLUMN workspace_id SET NOT NULL;++-- idp+ALTER TABLE idp ADD COLUMN workspace_id text REFERENCES workspace(id);+UPDATE idp SET workspace_id = (SELECT id FROM workspace LIMIT 1);+ALTER TABLE idp ALTER COLUMN workspace_id SET NOT NULL;++-- review_config+ALTER TABLE review_config ADD COLUMN workspace_id text REFERENCES workspace(id);+UPDATE review_config SET workspace_id = (SELECT id FROM workspace LIMIT 1);+ALTER TABLE review_config ALTER COLUMN workspace_id SET NOT NULL;++-- user_group+ALTER TABLE user_group ADD COLUMN workspace_id text REFERENCES workspace(id);+UPDATE user_group SET workspace_id = (SELECT id FROM workspace LIMIT 1);+ALTER TABLE user_group ALTER COLUMN workspace_id SET NOT NULL;++-- export_archive+ALTER TABLE export_archive ADD COLUMN workspace_id text REFERENCES workspace(id);+UPDATE export_archive SET workspace_id = (SELECT id FROM workspace LIMIT 1);+ALTER TABLE export_archive ALTER COLUMN workspace_id SET NOT NULL;++-- audit_log+ALTER TABLE audit_log ADD COLUMN workspace_id text REFERENCES workspace(id);+UPDATE audit_log SET workspace_id = (SELECT id FROM workspace LIMIT 1);+ALTER TABLE audit_log ALTER COLUMN workspace_id SET NOT NULL;++-- service_account (created in Step 01 without workspace_id)+ALTER TABLE service_account ADD COLUMN workspace_id text REFERENCES workspace(id);+UPDATE service_account SET workspace_id = (SELECT id FROM workspace LIMIT 1);+ALTER TABLE service_account ALTER COLUMN workspace_id SET NOT NULL;++-- workload_identity (created in Step 01 without workspace_id)+ALTER TABLE workload_identity ADD COLUMN workspace_id text REFERENCES workspace(id);+UPDATE workload_identity SET workspace_id = (SELECT id FROM workspace LIMIT 1);+ALTER TABLE workload_identity ALTER COLUMN workspace_id SET NOT NULL;+```++Project-child tables (plan, issue, db, project_webhook, worksheet, db_group, release, access_grant, query_history) and grandchild tables do NOT get a `workspace_id` column -- they are scoped through their existing `project` FK chain.++---++## 3. Update Unique Indexes++Only root tables need index changes to include `workspace_id`:++```sql+-- project+DROP INDEX idx_project_unique_resource_id;+CREATE UNIQUE INDEX idx_project_unique_resource_id ON project(workspace_id, resource_id);++-- instance+DROP INDEX idx_instance_unique_resource_id;+CREATE UNIQUE INDEX idx_instance_unique_resource_id ON instance(workspace_id, resource_id);++-- principal: no change needed (global identity, email unique globally)++-- setting+DROP INDEX idx_setting_unique_name;+CREATE UNIQUE INDEX idx_setting_unique_name ON setting(workspace_id, name);++-- role+DROP INDEX idx_role_unique_resource_id;+CREATE UNIQUE INDEX idx_role_unique_resource_id ON role(workspace_id, resource_id);++-- idp+DROP INDEX idx_idp_unique_resource_id;+CREATE UNIQUE INDEX idx_idp_unique_resource_id ON idp(workspace_id, resource_id);++-- user_group+DROP INDEX idx_user_group_unique_email;+CREATE UNIQUE INDEX idx_user_group_unique_email ON user_group(workspace_id, email) WHERE email IS NOT NULL;++-- service_account+CREATE UNIQUE INDEX idx_service_account_unique_workspace_email ON service_account(workspace_id, email);++-- workload_identity+CREATE UNIQUE INDEX idx_workload_identity_unique_workspace_email ON workload_identity(workspace_id, email);+```++Child table unique indexes remain unchanged -- their uniqueness is naturally scoped because their parent references (e.g., `plan.project`, `db.instance`) are already workspace-unique:++```sql+-- These DO NOT change (already scoped through parent FKs):+-- idx_db_unique_instance_name ON db(instance, name) -- instance is workspace-unique+-- idx_plan_check_run_unique_plan_id ON plan_check_run(plan_id) -- plan_id is globally unique (bigserial)+-- idx_issue_unique_plan_id ON issue(plan_id) -- plan_id is globally unique (bigserial)+-- uk_task_run_task_id_attempt ON task_run(task_id, attempt) -- task_id is globally unique (bigserial)+-- idx_db_group_unique_project_resource_id ON db_group(project, resource_id) -- project is workspace-unique+-- idx_release_project_train_iteration ON release(project, train, iteration) -- project is workspace-unique+```++---++## 4. Add Workspace Query Performance Indexes++```sql+CREATE INDEX idx_project_workspace ON project(workspace_id);+CREATE INDEX idx_instance_workspace ON instance(workspace_id);+CREATE INDEX idx_setting_workspace ON setting(workspace_id);+CREATE INDEX idx_policy_workspace ON policy(workspace_id);+CREATE INDEX idx_audit_log_workspace ON audit_log(workspace_id);+CREATE INDEX idx_service_account_workspace ON service_account(workspace_id);+CREATE INDEX idx_workload_identity_workspace ON workload_identity(workspace_id);+```++---++## Migration Test++Update `TestLatestVersion` in `backend/migrator/migrator_test.go` after adding new migration files.++Update `backend/migrator/migration/LATEST.sql` to reflect the final schema state with the `workspace` table and `workspace_id` columns.diff --git a/docs/plans/saas/03.application-layer.md b/docs/plans/saas/03.application-layer.mdnew file mode 100644index 0000000000..d83dbb8e33--- /dev/null+++ b/docs/plans/saas/03.application-layer.md@@ -0,0 +1,165 @@+# Step 03: Application Layer Changes++Update middleware, store, and service layers to enforce workspace scoping on all API requests. This step depends on Step 02 (database migration) being completed.++---++## 1. Workspace Context Middleware++Extract `workspace_id` from the JWT and inject it into the request context. Every authenticated request carries workspace context.++```go+type workspaceIDKey struct{}++func WorkspaceMiddleware(next http.Handler) http.Handler {+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ workspaceID := extractWorkspaceFromJWT(r)+ ctx := context.WithValue(r.Context(), workspaceIDKey{}, workspaceID)+ next.ServeHTTP(w, r.WithContext(ctx))+ })+}++func WorkspaceIDFromContext(ctx context.Context) string {+ if v, ok := ctx.Value(workspaceIDKey{}).(string); ok {+ return v+ }+ return ""+}+```++---++## 2. Store Layer: Root Table Queries++All root table queries (12 tables) add `WHERE workspace_id = $1`. This is the primary isolation boundary.++### Pattern for Root Tables++```go+// GET: add workspace_id to WHERE clause+func (s *Store) GetProject(ctx context.Context, workspaceID, resourceID string) (*ProjectMessage, error) {+ query := "SELECT ... FROM project WHERE workspace_id = $1 AND resource_id = $2"+ // ...+}++// LIST: add workspace_id to WHERE clause+func (s *Store) ListInstances(ctx context.Context, workspaceID string, find *FindInstanceMessage) ([]*InstanceMessage, error) {+ where := qb.Q().Space("workspace_id = ?", workspaceID)+ // ... existing filters ...+}++// INSERT: include workspace_id+func (s *Store) CreateProject(ctx context.Context, workspaceID string, create *ProjectMessage) (*ProjectMessage, error) {+ query := "INSERT INTO project (workspace_id, resource_id, name, ...) VALUES ($1, $2, $3, ...)"+ // ...+}+```++### Tables to Update++| Table | Store file | Key functions |+|-------|-----------|---------------|+| `project` | `project.go` | `GetProject`, `ListProjects`, `CreateProject` |+| `instance` | `instance.go` | `GetInstance`, `ListInstances`, `CreateInstance` |+| `setting` | `setting.go` | `GetSetting`, `ListSettings`, `UpsertSetting` |+| `policy` | `policy.go` | `GetWorkspaceIamPolicy`, `GetPolicy`, `ListPolicies`, `UpsertPolicy` |+| `role` | `role.go` | `GetRole`, `ListRoles`, `CreateRole` |+| `idp` | `idp.go` | `GetIdentityProvider`, `ListIdentityProviders`, `CreateIdentityProvider` |+| `review_config` | `review_config.go` | `GetReviewConfig`, `ListReviewConfigs`, `CreateReviewConfig` |+| `user_group` | `user_group.go` | `GetGroup`, `ListGroups`, `CreateGroup` |+| `export_archive` | `export_archive.go` | `GetExportArchive`, `ListExportArchives`, `CreateExportArchive` |+| `audit_log` | `audit_log.go` | `CreateAuditLog`, `SearchAuditLogs` |+| `service_account` | `principal_service_account.go` | `ListServiceAccounts`, `CreateServiceAccount` |+| `workload_identity` | `principal_workload_identity.go` | `ListWorkloadIdentities`, `CreateWorkloadIdentity` |++### `principal` Table: NO Workspace Filter++`principal` is the global identity table. Queries like `GetUserByEmail`, `GetUserByID` do NOT add `workspace_id` -- a user identity is cross-workspace.++---++## 3. Store Layer: Project-Child Table Queries++These tables (plan, issue, db, project_webhook, worksheet, db_group, release, access_grant, query_history) filter by `project` FK. **No `workspace_id` changes needed in the store layer** -- they continue to use `WHERE project = $1`.++The security invariant is: the `project` value passed to the store has already been validated as belonging to the current workspace (see Service Layer below).++---++## 4. Service Layer: Workspace Scoping++### Root Table Services++Extract workspace from context, pass to store:++```go+func (s *ProjectService) GetProject(ctx context.Context, req *v1pb.GetProjectRequest) (*v1pb.Project, error) {+ workspaceID := WorkspaceIDFromContext(ctx)+ project, err := s.store.GetProject(ctx, workspaceID, resourceID)+ // ...+}+```++### Project-Child Services++Validate project ownership first, then query children:++```go+func (s *PlanService) ListPlans(ctx context.Context, req *v1pb.ListPlansRequest) (*v1pb.ListPlansResponse, error) {+ workspaceID := WorkspaceIDFromContext(ctx)+ projectID := getProjectID(req.Parent)++ // Step 1: validate project belongs to this workspace+ project, err := s.store.GetProject(ctx, workspaceID, projectID)+ if err != nil { return nil, err }++ // Step 2: query plans by project (already workspace-scoped)+ plans, err := s.store.ListPlans(ctx, &FindPlanMessage{ProjectID: &project.ResourceID})+ // ...+}+```++### Grandchild Services++Accessed through validated parent chain:++```go+func (s *RolloutService) GetTaskRun(ctx context.Context, req *v1pb.GetTaskRunRequest) (*v1pb.TaskRun, error) {+ workspaceID := WorkspaceIDFromContext(ctx)+ projectID, planUID, _, taskRunUID := parseTaskRunName(req.Name)++ // Validate project belongs to workspace+ project, err := s.store.GetProject(ctx, workspaceID, projectID)+ if err != nil { return nil, err }++ // Validate plan belongs to project+ plan, err := s.store.GetPlan(ctx, &FindPlanMessage{UID: &planUID, ProjectID: &project.ResourceID})+ if err != nil { return nil, err }++ // Query task_run (parent chain already validated)+ taskRun, err := s.store.GetTaskRun(ctx, &FindTaskRunMessage{UID: &taskRunUID})+ // ...+}+```++---++## 5. Security Checklist++Critical: every API endpoint that returns or mutates workspace-scoped data MUST enforce workspace isolation. Audit every endpoint against this checklist:++- [ ] **Root table endpoints**: store query includes `WHERE workspace_id = $1`+- [ ] **Project-child endpoints**: project is validated against workspace before querying children+- [ ] **Grandchild endpoints**: parent chain is validated (project -> plan/issue/db -> child)+- [ ] **Cross-table joins**: any JOIN that touches root tables includes workspace_id condition+- [ ] **Batch operations**: bulk queries (e.g., `BatchGetUsersByEmails`) handle cross-workspace correctly+- [ ] **Cache invalidation**: caches keyed by resource name include workspace context to prevent cross-workspace leaks+- [ ] **No direct PK lookups without parent validation**: queries like `GetPlan(ctx, &FindPlanMessage{UID: &planID})` must not be reachable from an API handler without first validating the parent project belongs to the workspace++### Cache Considerations++Current caches (`userEmailCache`, `policyCache`, `groupCache`, `iamPolicyCache`) are keyed without workspace context. In SaaS mode:+- `userEmailCache` -- OK, `principal` is global (email is globally unique)+- `policyCache` -- needs workspace in cache key (policies are per-workspace)+- `iamPolicyCache` -- needs workspace in cache key+- `groupCache` -- needs workspace in cache key (groups are per-workspace)diff --git a/docs/plans/saas/04.runners-and-auth.md b/docs/plans/saas/04.runners-and-auth.mdnew file mode 100644index 0000000000..19d57911d8--- /dev/null+++ b/docs/plans/saas/04.runners-and-auth.md@@ -0,0 +1,174 @@+# Step 04: Background Runners and Auth Flow++Update background runners to handle multi-workspace task processing, and implement the new auth flow with workspace selection. This step depends on Step 03 (application layer) being completed.++---++## 1. Background Runners++Runners poll for pending tasks across ALL workspaces with a single query (no workspace filter). They resolve workspace context from the task's parent chain when processing.++### Current Architecture++Runners are in `backend/runner/` and include:+- `approval/` -- approval workflow processing+- `relay/` -- external approval relay+- `taskrun/` -- task execution scheduler+- `schemasync/` -- database schema sync+- `slowquerysync/` -- slow query log sync+- `mail/` -- email notifications+- `metricreport/` -- metric reporting+- `plancheck/` -- plan check execution++### How Runners Work in SaaS Mode++```go+func (r *Scheduler) Run(ctx context.Context) {+ ticker := time.NewTicker(5 * time.Second)+ for {+ select {+ case <-ticker.C:+ // No workspace filter -- returns pending task runs across all workspaces+ tasks, _ := r.store.ListPendingTaskRuns(ctx)+ for _, task := range tasks {+ go r.processTask(ctx, task)+ }+ }+ }+}++func (r *Scheduler) processTask(ctx context.Context, taskRun *TaskRun) {+ // Resolve workspace through parent chain:+ // task_run -> task -> plan -> project -> workspace_id+ task, _ := r.store.GetTask(ctx, taskRun.TaskID)+ plan, _ := r.store.GetPlan(ctx, &FindPlanMessage{UID: &task.PlanID})+ project, _ := r.store.GetProjectByResourceID(ctx, plan.ProjectID)+ workspaceID := project.WorkspaceID++ // Use workspaceID for workspace-specific operations+ // (e.g., loading instance credentials, checking workspace settings)+}+```++### Runner-Specific Considerations++| Runner | Workspace resolution | Notes |+|--------|---------------------|-------|+| `taskrun/` | task_run -> task -> plan -> project -> workspace_id | Main execution pipeline |+| `plancheck/` | plan_check_run -> plan -> project -> workspace_id | Plan validation |+| `approval/` | issue -> project -> workspace_id | Approval workflows |+| `relay/` | issue -> project -> workspace_id | External approval relay |+| `schemasync/` | instance -> workspace_id (direct) | Instance is a root table |+| `slowquerysync/` | instance -> workspace_id (direct) | Instance is a root table |+| `mail/` | Varies by notification source | Resolve from the entity being notified about |+| `metricreport/` | Reports across all workspaces | May aggregate per-workspace or globally |++### Optimization: Denormalize `workspace_id`++For frequently polled runner queries, consider denormalizing `workspace_id` onto hot tables to avoid the join chain on every poll cycle:++```sql+-- Optional: add workspace_id to task for faster runner lookups+ALTER TABLE task ADD COLUMN workspace_id text REFERENCES workspace(id);+-- Backfill from parent chain: task -> plan -> project -> workspace_id+UPDATE task SET workspace_id = (+ SELECT p.workspace_id FROM project p+ JOIN plan pl ON pl.project = p.resource_id+ WHERE pl.id = task.plan_id+);+```++This is an optimization, not a requirement. Start without it and add if runner query latency becomes an issue.++---++## 2. Auth Flow Changes++### Current Flow (Per-Workspace Container)++1. User hits `{id}.bytebase.com` -> single workspace container+2. Login with email/password or SSO+3. JWT scoped to workspace implicitly (one workspace per container)++### SaaS Flow (Single Container)++1. User hits `console.bytebase.com`+2. Login (password/SSO) -> authenticates against global `principal` table (END_USER only)+3. Query workspace membership: find all workspaces where the user appears in `policy` (IAM binding with `resource_type = 'WORKSPACE'`)+4. If user has 1 workspace -> auto-redirect+5. If user has N workspaces -> workspace picker UI+6. If user has 0 workspaces -> create workspace or accept invitation+7. After workspace selected -> JWT includes both `user_id` (principal.id) and `workspace_id`+8. All subsequent requests scoped to that workspace++### JWT Structure++```json+{+ "sub": "users/[email protected]",+ "user_id": 123,+ "workspace_id": "ws-abc123",+ "iat": 1709654400,+ "exp": 1709740800+}+```++### Workspace Discovery Query++Find workspaces a user belongs to by scanning IAM policies:++```sql+-- Find all workspaces where [email protected] is a member+SELECT DISTINCT w.id, w.resource_id, w.name+FROM workspace w+JOIN policy p ON p.workspace_id = w.id+WHERE p.resource_type = 'WORKSPACE'+ AND p.type = 'IAM'+ AND EXISTS (+ SELECT 1+ FROM jsonb_array_elements(p.payload->'bindings') AS binding,+ jsonb_array_elements_text(binding->'members') AS member+ WHERE member = 'users/[email protected]'+ )+ AND w.deleted = FALSE;+```++### Service Accounts and Workload Identities++These are workspace-scoped in their own tables (`service_account`, `workload_identity`), each with a `workspace_id` column. They authenticate directly within workspace context (API key or token exchange) -- no workspace picker needed.++### Auth Token Tables++`web_refresh_token`, `oauth2_client`, `oauth2_authorization_code`, `oauth2_refresh_token` remain tied to the `principal` (identity) layer since login is cross-workspace. No `workspace_id` needed on these tables.++---++## 3. Workspace Switching++After initial login and workspace selection, users may need to switch workspaces without re-authenticating.++### Approach++1. User clicks "Switch Workspace" in the UI+2. Frontend calls a workspace-switch endpoint with the target `workspace_id`+3. Backend validates user is a member of the target workspace (check IAM policy)+4. Backend issues a new JWT with the updated `workspace_id`+5. Frontend reloads with new workspace context++```go+func (s *AuthService) SwitchWorkspace(ctx context.Context, req *SwitchWorkspaceRequest) (*SwitchWorkspaceResponse, error) {+ userID := UserIDFromContext(ctx)++ // Validate user is a member of the target workspace+ iamPolicy, err := s.store.GetWorkspaceIamPolicy(ctx, req.WorkspaceID)+ if err != nil { return nil, err }++ if !isMember(iamPolicy, userID) {+ return nil, status.Errorf(codes.PermissionDenied, "not a member of workspace %s", req.WorkspaceID)+ }++ // Issue new JWT with updated workspace_id+ token, err := s.issueJWT(userID, req.WorkspaceID)+ // ...+}+```diff --git a/frontend/src/components/Member/utils.ts b/frontend/src/components/Member/utils.tsindex 0c99b74e50..b96459a30d 100644--- a/frontend/src/components/Member/utils.ts+++ b/frontend/src/components/Member/utils.ts@@ -22,11 +22,7 @@ import {} from "@/types";import { GroupSchema } from "@/types/proto-es/v1/group_service_pb";import type { IamPolicy } from "@/types/proto-es/v1/iam_policy_pb";-import {- type User,- UserSchema,- UserType,-} from "@/types/proto-es/v1/user_service_pb";+import { type User, UserSchema } from "@/types/proto-es/v1/user_service_pb";import { convertMemberToFullname } from "@/utils";import type { GroupBinding, MemberBinding } from "./types";@@ -84,7 +80,6 @@ const getMemberBinding = (title: email,name: fullname,email: email,- userType: UserType.USER,});}}diff --git a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalUserView.vue b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalUserView.vueindex aeb774e93d..4da6b9896d 100644--- a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalUserView.vue+++ b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalUserView.vue@@ -14,8 +14,8 @@import { computedAsync } from "@vueuse/core";import { UserNameCell } from "@/components/v2/Model/cells";import { useUserStore } from "@/store";+import { AccountType, getAccountTypeByEmail } from "@/types";import { State } from "@/types/proto-es/v1/common_pb";-import { UserType } from "@/types/proto-es/v1/user_service_pb";const props = defineProps<{// candidate in users/{email} format.@@ -31,7 +31,10 @@ const candidateUser = computedAsync(async () => {if (!user) {return;}- if (user.userType !== UserType.USER || user.state !== State.ACTIVE) {+ if (+ getAccountTypeByEmail(user.email) !== AccountType.USER ||+ user.state !== State.ACTIVE+ ) {return;}return user;diff --git a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/PotentialApprovers.vue b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/PotentialApprovers.vueindex 611378c600..8c9f8c3e0f 100644--- a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/PotentialApprovers.vue+++ b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/PotentialApprovers.vue@@ -46,10 +46,10 @@ import { NPopover } from "naive-ui";import { computed } from "vue";import { useI18n } from "vue-i18n";import { UserNameCell } from "@/components/v2/Model/cells";-import type { User as UserType } from "@/types/proto-es/v1/user_service_pb";+import type { User } from "@/types/proto-es/v1/user_service_pb";const props = defineProps<{- users: UserType[];+ users: User[];}>();const { t } = useI18n();diff --git a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/useApprovalStep.ts b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/useApprovalStep.tsindex 8e597aa9d4..3ca8f944a8 100644--- a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/useApprovalStep.ts+++ b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/useApprovalStep.ts@@ -24,7 +24,6 @@ import {Issue_Approver_Status,RequestIssueRequestSchema,} from "@/types/proto-es/v1/issue_service_pb";-import type { User as UserType } from "@/types/proto-es/v1/user_service_pb";import {displayRoleTitle,ensureUserFullName,@@ -203,15 +202,15 @@ export function useApprovalStep(const users = await userStore.batchGetOrFetchUsers(filteredCandidateEmails.value.map(ensureUserFullName));- return (- users.filter((user) => {+ return users+ .filter((user) => {return user && user.state === State.ACTIVE;- }) as UserType[]- ).sort((a, b) => {- if (a.email === currentUserEmail.value) return -1;- if (b.email === currentUserEmail.value) return 1;- return a.title.localeCompare(b.title);- });+ })+ .sort((a, b) => {+ if (a.email === currentUserEmail.value) return -1;+ if (b.email === currentUserEmail.value) return 1;+ return a.title.localeCompare(b.title);+ });}, []);return {diff --git a/frontend/src/components/User/Settings/CreateServiceAccountDrawer.vue b/frontend/src/components/User/Settings/CreateServiceAccountDrawer.vueindex 238e6f8382..73edc5a587 100644--- a/frontend/src/components/User/Settings/CreateServiceAccountDrawer.vue+++ b/frontend/src/components/User/Settings/CreateServiceAccountDrawer.vue@@ -100,7 +100,6 @@ import {ensureServiceAccountFullName,getProjectName,pushNotification,- serviceAccountToUser,useProjectIamPolicyStore,useProjectV1Store,useServiceAccountStore,@@ -109,28 +108,27 @@ import {import {getServiceAccountNameInBinding,getServiceAccountSuffix,- unknownUser,} from "@/types";import { PresetRoleType } from "@/types/iam";import { BindingSchema } from "@/types/proto-es/v1/iam_policy_pb";-import type { User } from "@/types/proto-es/v1/user_service_pb";-import { UserSchema } from "@/types/proto-es/v1/user_service_pb";+import type { ServiceAccount } from "@/types/proto-es/v1/service_account_service_pb";+import { ServiceAccountSchema } from "@/types/proto-es/v1/service_account_service_pb";interface LocalState {isRequesting: boolean;- serviceAccount: User;+ serviceAccount: ServiceAccount;roles: string[];}const props = defineProps<{- serviceAccount?: User;+ serviceAccount?: ServiceAccount;project?: string;}>();const emit = defineEmits<{(event: "close"): void;- (event: "created", user: User): void;- (event: "updated", user: User): void;+ (event: "created", sa: ServiceAccount): void;+ (event: "updated", sa: ServiceAccount): void;}>();const { t } = useI18n();@@ -141,7 +139,7 @@ const projectIamPolicyStore = useProjectIamPolicyStore();const state = reactive<LocalState>({isRequesting: false,- serviceAccount: unknownUser(),+ serviceAccount: create(ServiceAccountSchema),roles: props.project ? [] : [PresetRoleType.WORKSPACE_MEMBER],});@@ -162,8 +160,7 @@ const emailSuffix = computed(() =>);const isEditMode = computed(- () =>- !!props.serviceAccount && props.serviceAccount.name !== unknownUser().name+ () => !!props.serviceAccount && !!props.serviceAccount.email);watch(@@ -172,7 +169,7 @@ watch(if (!sa) {return;}- state.serviceAccount = cloneDeep(create(UserSchema, sa));+ state.serviceAccount = cloneDeep(create(ServiceAccountSchema, sa));},{immediate: true,@@ -258,25 +255,24 @@ const createServiceAccount = async () => {},parent.value);- const createdUser = serviceAccountToUser(sa);if (state.roles.length > 0) {if (projectEntity.value) {await updateProjectIamPolicyForMember(projectEntity.value.name,- getServiceAccountNameInBinding(createdUser.email),+ getServiceAccountNameInBinding(sa.email),state.roles);} else {await workspaceStore.patchIamPolicy([{- member: getServiceAccountNameInBinding(createdUser.email),+ member: getServiceAccountNameInBinding(sa.email),roles: state.roles,},]);}}- emit("created", createdUser);+ emit("created", sa);pushNotification({module: "bytebase",style: "SUCCESS",@@ -296,10 +292,10 @@ const updateServiceAccount = async () => {updateMask.push("title");}- let updatedUser: User = sa;+ let updatedSa: ServiceAccount = sa;if (updateMask.length > 0) {- const updated = await serviceAccountStore.updateServiceAccount(+ updatedSa = await serviceAccountStore.updateServiceAccount({name: ensureServiceAccountFullName(sa.email),title: state.serviceAccount.title,@@ -308,10 +304,9 @@ const updateServiceAccount = async () => {paths: [...updateMask],}));- updatedUser = serviceAccountToUser(updated);}- emit("updated", updatedUser);+ emit("updated", updatedSa);pushNotification({module: "bytebase",style: "SUCCESS",diff --git a/frontend/src/components/User/Settings/CreateUserDrawer.vue b/frontend/src/components/User/Settings/CreateUserDrawer.vueindex 01351d1509..5098139621 100644--- a/frontend/src/components/User/Settings/CreateUserDrawer.vue+++ b/frontend/src/components/User/Settings/CreateUserDrawer.vue@@ -133,7 +133,6 @@ import type { User } from "@/types/proto-es/v1/user_service_pb";import {UpdateUserRequestSchema,UserSchema,- UserType,} from "@/types/proto-es/v1/user_service_pb";import { hasWorkspacePermissionV2 } from "@/utils";import UserPassword from "./UserPassword.vue";@@ -248,7 +247,6 @@ const createOrUpdateUser = async () => {const createUser = async () => {const createdUser = await userStore.createUser({...state.user,- userType: UserType.USER,title: state.user.title || extractUserTitle(state.user.email),password: state.user.password,});diff --git a/frontend/src/components/User/Settings/CreateWorkloadIdentityDrawer.vue b/frontend/src/components/User/Settings/CreateWorkloadIdentityDrawer.vueindex 2aa86319e6..bc2f2172ad 100644--- a/frontend/src/components/User/Settings/CreateWorkloadIdentityDrawer.vue+++ b/frontend/src/components/User/Settings/CreateWorkloadIdentityDrawer.vue@@ -343,21 +343,19 @@ import {useProjectV1Store,useWorkloadIdentityStore,useWorkspaceV1Store,- workloadIdentityToUser,} from "@/store";import {getWorkloadIdentityNameInBinding,getWorkloadIdentitySuffix,- unknownUser,} from "@/types";import { PresetRoleType } from "@/types/iam";import { BindingSchema } from "@/types/proto-es/v1/iam_policy_pb";-import type { User } from "@/types/proto-es/v1/user_service_pb";+import type { WorkloadIdentity } from "@/types/proto-es/v1/workload_identity_service_pb";import {- UserSchema,WorkloadIdentityConfig_ProviderType,WorkloadIdentityConfigSchema,-} from "@/types/proto-es/v1/user_service_pb";+ WorkloadIdentitySchema,+} from "@/types/proto-es/v1/workload_identity_service_pb";import {getWorkloadIdentityProviderText,parseWorkloadIdentitySubjectPattern,@@ -378,20 +376,20 @@ interface WifState {interface LocalState {isRequesting: boolean;- workloadIdentity: User;+ workloadIdentity: WorkloadIdentity;roles: string[];wif: WifState;}const props = defineProps<{- workloadIdentity?: User;+ workloadIdentity?: WorkloadIdentity;project?: string;}>();const emit = defineEmits<{(event: "close"): void;- (event: "created", user: User): void;- (event: "updated", user: User): void;+ (event: "created", wi: WorkloadIdentity): void;+ (event: "updated", wi: WorkloadIdentity): void;}>();const { t } = useI18n();@@ -402,7 +400,7 @@ const projectIamPolicyStore = useProjectIamPolicyStore();const state = reactive<LocalState>({isRequesting: false,- workloadIdentity: unknownUser(),+ workloadIdentity: create(WorkloadIdentitySchema),roles: props.project ? [] : [PresetRoleType.WORKSPACE_MEMBER],wif: {emailPrefix: "",@@ -435,9 +433,7 @@ const emailSuffix = computed(() =>);const isEditMode = computed(- () =>- !!props.workloadIdentity &&- props.workloadIdentity.name !== unknownUser().name+ () => !!props.workloadIdentity && !!props.workloadIdentity.email);watch(@@ -446,7 +442,11 @@ watch(if (!wi) {return;}- state.workloadIdentity = cloneDeep(create(UserSchema, wi));+ state.workloadIdentity = create(WorkloadIdentitySchema, {+ email: wi.email,+ title: wi.title,+ state: wi.state,+ });const config = wi.workloadIdentityConfig;if (config) {@@ -456,9 +456,7 @@ watch(state.wif.audience = config.allowedAudiences[0] || "";state.wif.subjectPattern = config.subjectPattern;- const parsed = parseWorkloadIdentitySubjectPattern(- state.workloadIdentity- );+ const parsed = parseWorkloadIdentitySubjectPattern(wi);if (parsed) {state.wif.owner = parsed.owner;state.wif.repo = parsed.repo;@@ -682,25 +680,24 @@ const createWorkloadIdentity = async () => {},parent.value);- const createdUser = workloadIdentityToUser(wi);if (state.roles.length > 0) {if (projectEntity.value) {await updateProjectIamPolicyForMember(projectEntity.value.name,- getWorkloadIdentityNameInBinding(createdUser.email),+ getWorkloadIdentityNameInBinding(wi.email),state.roles);} else {await workspaceStore.patchIamPolicy([{- member: getWorkloadIdentityNameInBinding(createdUser.email),+ member: getWorkloadIdentityNameInBinding(wi.email),roles: state.roles,},]);}}- emit("created", createdUser);+ emit("created", wi);pushNotification({module: "bytebase",style: "SUCCESS",@@ -720,8 +717,6 @@ const updateWorkloadIdentity = async () => {updateMask.push("title");}- let updatedUser: User = wi;-const updated = await workloadIdentityStore.updateWorkloadIdentity({name: ensureWorkloadIdentityFullName(wi.email),@@ -737,8 +732,7 @@ const updateWorkloadIdentity = async () => {paths: [...updateMask, "workload_identity_config"],}));- updatedUser = workloadIdentityToUser(updated);- emit("updated", updatedUser);+ emit("updated", updated);pushNotification({module: "bytebase",style: "SUCCESS",diff --git a/frontend/src/components/User/Settings/ServiceAccountPanel.vue b/frontend/src/components/User/Settings/ServiceAccountPanel.vueindex f0e2e49271..b516f107fd 100644--- a/frontend/src/components/User/Settings/ServiceAccountPanel.vue+++ b/frontend/src/components/User/Settings/ServiceAccountPanel.vue@@ -4,9 +4,6 @@<div class="flex items-center gap-x-2"><p class="text-lg font-medium leading-7 text-main"><span>{{ $t("settings.members.service-accounts") }}</span>- <span v-if="showCount" class="ml-1 font-normal text-control-light">- ({{ activeServiceAccountCount }})- </span></p></div>@@ -91,8 +88,8 @@state.editingServiceAccount = undefined;}"- @created="handleServiceAccountUpdated"- @updated="handleServiceAccountUpdated"+ @created="sa => handleServiceAccountUpdated(serviceAccountToUser(sa))"+ @updated="sa => handleServiceAccountUpdated(serviceAccountToUser(sa))"/></template>@@ -105,20 +102,20 @@ import PermissionGuardWrapper from "@/components/Permission/PermissionGuardWrappimport CreateServiceAccountDrawer from "@/components/User/Settings/CreateServiceAccountDrawer.vue";import UserDataTable from "@/components/User/Settings/UserDataTable/index.vue";import PagedTable from "@/components/v2/Model/PagedTable.vue";-import { useActuatorV1Store, useCurrentProjectV1 } from "@/store";+import { useCurrentProjectV1 } from "@/store";import {serviceAccountToUser,useServiceAccountStore,} from "@/store/modules/serviceAccount";-import { isValidProjectName, unknownUser } from "@/types";+import { isValidProjectName } from "@/types";import { State } from "@/types/proto-es/v1/common_pb";+import type { ServiceAccount } from "@/types/proto-es/v1/service_account_service_pb";import type { User } from "@/types/proto-es/v1/user_service_pb";-import { UserType } from "@/types/proto-es/v1/user_service_pb";type LocalState = {showInactiveList: boolean;showCreateDrawer: boolean;- editingServiceAccount?: User;+ editingServiceAccount?: ServiceAccount;};const state = reactive<LocalState>({@@ -127,7 +124,6 @@ const state = reactive<LocalState>({});const serviceAccountStore = useServiceAccountStore();-const actuatorStore = useActuatorV1Store();const serviceAccountPagedTable =ref<ComponentExposed<typeof PagedTable<User>>>();const deletedServiceAccountPagedTable =@@ -140,8 +136,6 @@ const project = computed(() =>: undefined);-const showCount = computed(() => !project.value);-const sessionKey = computed(() =>`bb.paged-service-account-table${project.value ? `.${project.value.name}` : ""}.active`@@ -198,24 +192,15 @@ const fetchInactiveServiceAccountList = async ({return { list: users, nextPageToken: response.nextPageToken };};-const activeServiceAccountCount = computed(() => {- return actuatorStore.countUser({- state: State.ACTIVE,- userTypes: [UserType.SERVICE_ACCOUNT],- });-});-const handleCreateServiceAccount = () => {- state.editingServiceAccount = {- ...unknownUser(),- userType: UserType.SERVICE_ACCOUNT,- title: "",- };+ state.editingServiceAccount = undefined;state.showCreateDrawer = true;};const handleServiceAccountSelected = (user: User) => {- state.editingServiceAccount = user;+ state.editingServiceAccount = serviceAccountStore.getServiceAccount(+ user.email+ );state.showCreateDrawer = true;};@@ -235,7 +220,7 @@ const handleServiceAccountRestore = (user: User) => {};const handleServiceAccountArchived = (user: User) => {- if (user.state !== State.DELETED) {+ if (user) {return;}serviceAccountPagedTable.value?.removeCache(user);diff --git a/frontend/src/components/User/Settings/UserDataTable/cells/UserOperationsCell.vue b/frontend/src/components/User/Settings/UserDataTable/cells/UserOperationsCell.vueindex 0ca4d7fac0..d1486605b8 100644--- a/frontend/src/components/User/Settings/UserDataTable/cells/UserOperationsCell.vue+++ b/frontend/src/components/User/Settings/UserDataTable/cells/UserOperationsCell.vue@@ -24,7 +24,7 @@v-if="allowViewUser"@click="(e) => $emit('user-selected', user, e)">- <PencilIcon v-if="user.userType === UserType.WORKLOAD_IDENTITY || user.userType === UserType.SERVICE_ACCOUNT" />+ <PencilIcon v-if="accountType === AccountType.WORKLOAD_IDENTITY || accountType === AccountType.SERVICE_ACCOUNT" /><EyeIcon v-else /></MiniActionButton>@@ -63,8 +63,9 @@ import {useWorkloadIdentityStore,workloadIdentityToUser,} from "@/store";+import { AccountType, getAccountTypeByEmail } from "@/types";import { State } from "@/types/proto-es/v1/common_pb";-import { type User, UserType } from "@/types/proto-es/v1/user_service_pb";+import type { User } from "@/types/proto-es/v1/user_service_pb";import { hasWorkspacePermissionV2 } from "@/utils";const props = defineProps<{@@ -82,11 +83,13 @@ const workloadIdentityStore = useWorkloadIdentityStore();const { t } = useI18n();const me = useCurrentUserV1();+const accountType = computed(() => getAccountTypeByEmail(props.user.email));+const allowView = computed(() => {- switch (props.user.userType) {- case UserType.SERVICE_ACCOUNT:+ switch (accountType.value) {+ case AccountType.SERVICE_ACCOUNT:return hasWorkspacePermissionV2("bb.serviceAccounts.get");- case UserType.WORKLOAD_IDENTITY:+ case AccountType.WORKLOAD_IDENTITY:return hasWorkspacePermissionV2("bb.workloadIdentities.get");default:return hasWorkspacePermissionV2("bb.users.get");@@ -94,10 +97,10 @@ const allowView = computed(() => {});const allowDelete = computed(() => {- switch (props.user.userType) {- case UserType.SERVICE_ACCOUNT:+ switch (accountType.value) {+ case AccountType.SERVICE_ACCOUNT:return hasWorkspacePermissionV2("bb.serviceAccounts.delete");- case UserType.WORKLOAD_IDENTITY:+ case AccountType.WORKLOAD_IDENTITY:return hasWorkspacePermissionV2("bb.workloadIdentities.delete");default:return hasWorkspacePermissionV2("bb.users.delete");@@ -105,10 +108,10 @@ const allowDelete = computed(() => {});const allowUndelete = computed(() => {- switch (props.user.userType) {- case UserType.SERVICE_ACCOUNT:+ switch (accountType.value) {+ case AccountType.SERVICE_ACCOUNT:return hasWorkspacePermissionV2("bb.serviceAccounts.undelete");- case UserType.WORKLOAD_IDENTITY:+ case AccountType.WORKLOAD_IDENTITY:return hasWorkspacePermissionV2("bb.workloadIdentities.undelete");default:return hasWorkspacePermissionV2("bb.users.undelete");@@ -137,12 +140,12 @@ const allowReactiveUser = computed(() => {const archiveUser = async (user: User): Promise<User> => {const fullname = getUserFullNameByType(user);- switch (user.userType) {- case UserType.SERVICE_ACCOUNT: {+ switch (getAccountTypeByEmail(user.email)) {+ case AccountType.SERVICE_ACCOUNT: {await serviceAccountStore.deleteServiceAccount(fullname);break;}- case UserType.WORKLOAD_IDENTITY: {+ case AccountType.WORKLOAD_IDENTITY: {await workloadIdentityStore.deleteWorkloadIdentity(fullname);break;}@@ -158,12 +161,12 @@ const archiveUser = async (user: User): Promise<User> => {const restoreUser = async (user: User): Promise<User> => {const fullname = getUserFullNameByType(user);- switch (user.userType) {- case UserType.SERVICE_ACCOUNT: {+ switch (getAccountTypeByEmail(user.email)) {+ case AccountType.SERVICE_ACCOUNT: {const sa = await serviceAccountStore.undeleteServiceAccount(fullname);return serviceAccountToUser(sa);}- case UserType.WORKLOAD_IDENTITY: {+ case AccountType.WORKLOAD_IDENTITY: {const wi = await workloadIdentityStore.undeleteWorkloadIdentity(fullname);return workloadIdentityToUser(wi);}diff --git a/frontend/src/components/User/Settings/WorkloadIdentityPanel.vue b/frontend/src/components/User/Settings/WorkloadIdentityPanel.vueindex c55d925606..cbd336efa7 100644--- a/frontend/src/components/User/Settings/WorkloadIdentityPanel.vue+++ b/frontend/src/components/User/Settings/WorkloadIdentityPanel.vue@@ -4,9 +4,6 @@<div class="flex items-center gap-x-2"><p class="text-lg font-medium leading-7 text-main"><span>{{ $t("settings.members.workload-identities") }}</span>- <span v-if="showCount" class="ml-1 font-normal text-control-light">- ({{ activeWorkloadIdentityCount }})- </span></p></div>@@ -93,8 +90,8 @@state.editingWorkloadIdentity = undefined;}"- @created="handleWorkloadIdentityUpdated"- @updated="handleWorkloadIdentityUpdated"+ @created="wi => handleWorkloadIdentityUpdated(workloadIdentityToUser(wi))"+ @updated="wi => handleWorkloadIdentityUpdated(workloadIdentityToUser(wi))"/></template>@@ -107,20 +104,20 @@ import PermissionGuardWrapper from "@/components/Permission/PermissionGuardWrappimport CreateWorkloadIdentityDrawer from "@/components/User/Settings/CreateWorkloadIdentityDrawer.vue";import UserDataTable from "@/components/User/Settings/UserDataTable/index.vue";import PagedTable from "@/components/v2/Model/PagedTable.vue";-import { useActuatorV1Store, useCurrentProjectV1 } from "@/store";+import { useCurrentProjectV1 } from "@/store";import {useWorkloadIdentityStore,workloadIdentityToUser,} from "@/store/modules/workloadIdentity";-import { isValidProjectName, unknownUser } from "@/types";+import { isValidProjectName } from "@/types";import { State } from "@/types/proto-es/v1/common_pb";import type { User } from "@/types/proto-es/v1/user_service_pb";-import { UserType } from "@/types/proto-es/v1/user_service_pb";+import type { WorkloadIdentity } from "@/types/proto-es/v1/workload_identity_service_pb";type LocalState = {showInactiveList: boolean;showCreateDrawer: boolean;- editingWorkloadIdentity?: User;+ editingWorkloadIdentity?: WorkloadIdentity;};const state = reactive<LocalState>({@@ -129,7 +126,6 @@ const state = reactive<LocalState>({});const workloadIdentityStore = useWorkloadIdentityStore();-const actuatorStore = useActuatorV1Store();const workloadIdentityPagedTable =ref<ComponentExposed<typeof PagedTable<User>>>();const deletedWorkloadIdentityPagedTable =@@ -142,8 +138,6 @@ const project = computed(() =>: undefined);-const showCount = computed(() => !project.value);-const sessionKey = computed(() =>`bb.paged-workload-identity-table${project.value ? `.${project.value.name}` : ""}.active`@@ -200,24 +194,15 @@ const fetchInactiveWorkloadIdentityList = async ({return { list: users, nextPageToken: response.nextPageToken };};-const activeWorkloadIdentityCount = computed(() => {- return actuatorStore.countUser({- state: State.ACTIVE,- userTypes: [UserType.WORKLOAD_IDENTITY],- });-});-const handleCreateWorkloadIdentity = () => {- state.editingWorkloadIdentity = {- ...unknownUser(),- userType: UserType.WORKLOAD_IDENTITY,- title: "",- };+ state.editingWorkloadIdentity = undefined;state.showCreateDrawer = true;};const handleWorkloadIdentitySelected = (user: User) => {- state.editingWorkloadIdentity = user;+ // Look up the original WorkloadIdentity from the store to get the config+ const wi = workloadIdentityStore.getWorkloadIdentity(user.email);+ state.editingWorkloadIdentity = wi;state.showCreateDrawer = true;};diff --git a/frontend/src/components/misc/AccountTag.vue b/frontend/src/components/misc/AccountTag.vueindex c858c672c7..f0e12c04ec 100644--- a/frontend/src/components/misc/AccountTag.vue+++ b/frontend/src/components/misc/AccountTag.vue@@ -1,6 +1,6 @@<template>- <NTag v-if="user.userType === UserType.SERVICE_ACCOUNT || user.userType === UserType.WORKLOAD_IDENTITY" v-bind="$attrs" round type="info">- {{ user.userType === UserType.SERVICE_ACCOUNT+ <NTag v-if="accountType === AccountType.SERVICE_ACCOUNT || accountType === AccountType.WORKLOAD_IDENTITY" v-bind="$attrs" round type="info">+ {{ accountType === AccountType.SERVICE_ACCOUNT? $t("settings.members.service-account"): $t("settings.members.workload-identity")}}@@ -9,9 +9,13 @@<script lang="ts" setup>import { NTag } from "naive-ui";-import { type User, UserType } from "@/types/proto-es/v1/user_service_pb";+import { computed } from "vue";+import { AccountType, getAccountTypeByEmail } from "@/types";+import type { User } from "@/types/proto-es/v1/user_service_pb";-defineProps<{+const props = defineProps<{user: User;}>();++const accountType = computed(() => getAccountTypeByEmail(props.user.email));</script>diff --git a/frontend/src/components/v2/Model/cells/UserLink.vue b/frontend/src/components/v2/Model/cells/UserLink.vueindex e9c006ecfb..a51258d7bb 100644--- a/frontend/src/components/v2/Model/cells/UserLink.vue+++ b/frontend/src/components/v2/Model/cells/UserLink.vue@@ -20,8 +20,7 @@import { computed } from "vue";import { HighlightLabelText } from "@/components/v2";import { WORKSPACE_ROUTE_USER_PROFILE } from "@/router/dashboard/workspaceRoutes";-import { getUserTypeByEmail } from "@/types";-import { UserType } from "@/types/proto-es/v1/user_service_pb";+import { AccountType, getAccountTypeByEmail } from "@/types";import { hasWorkspacePermissionV2 } from "@/utils";const props = withDefaults(@@ -37,7 +36,7 @@ const props = withDefaults();const isEndUser = computed(- () => getUserTypeByEmail(props.email) === UserType.USER+ () => getAccountTypeByEmail(props.email) === AccountType.USER);const isLink = computed(diff --git a/frontend/src/components/v2/Model/cells/UserNameCell.vue b/frontend/src/components/v2/Model/cells/UserNameCell.vueindex 5203242d0d..652a9de45e 100644--- a/frontend/src/components/v2/Model/cells/UserNameCell.vue+++ b/frontend/src/components/v2/Model/cells/UserNameCell.vue@@ -18,7 +18,7 @@:keyword="keyword":title="user.title":email="user.email"- :link="link && user.userType === UserType.USER"+ :link="link && getAccountTypeByEmail(user.email) === AccountType.USER"/></div><slot name="suffix">@@ -53,7 +53,7 @@</slot></div><div- v-if="!isDeleted && user.userType === UserType.SERVICE_ACCOUNT && allowEdit && hasPermission"+ v-if="!isDeleted && getAccountTypeByEmail(user.email) === AccountType.SERVICE_ACCOUNT && allowEdit && hasPermission"class="ml-3 text-xs"><CopyButton@@ -91,8 +91,9 @@ import YouTag from "@/components/misc/YouTag.vue";import UserAvatar from "@/components/User/UserAvatar.vue";import { CopyButton, HighlightLabelText } from "@/components/v2";import { useCurrentUserV1 } from "@/store";+import { AccountType, getAccountTypeByEmail } from "@/types";import { State } from "@/types/proto-es/v1/common_pb";-import { type User, UserType } from "@/types/proto-es/v1/user_service_pb";+import type { User } from "@/types/proto-es/v1/user_service_pb";import { hasWorkspacePermissionV2 } from "@/utils";import UserLink from "./UserLink.vue";diff --git a/frontend/src/components/v2/Select/AccountSelect.vue b/frontend/src/components/v2/Select/AccountSelect.vueindex b4f8baac36..c7bc64d075 100644--- a/frontend/src/components/v2/Select/AccountSelect.vue+++ b/frontend/src/components/v2/Select/AccountSelect.vue@@ -45,15 +45,16 @@ import {workloadIdentityToUser,} from "@/store";import {+ AccountType,allUsersUser,- getUserTypeByEmail,- getUserTypeByFullname,+ getAccountTypeByEmail,+ getAccountTypeByFullname,unknownGroup,unknownUser,} from "@/types";import type { Group } from "@/types/proto-es/v1/group_service_pb";import { ServiceAccountSchema } from "@/types/proto-es/v1/service_account_service_pb";-import { type User, UserType } from "@/types/proto-es/v1/user_service_pb";+import type { User } from "@/types/proto-es/v1/user_service_pb";import { WorkloadIdentitySchema } from "@/types/proto-es/v1/workload_identity_service_pb";import { ensureUserFullName, hasWorkspacePermissionV2 } from "@/utils";import { extractGrpcErrorMessage } from "@/utils/connect";@@ -162,9 +163,9 @@ const additionalOptions = computedAsync(async () => {groupNames.push(fullname);continue;}- const userType = getUserTypeByFullname(fullname);+ const userType = getAccountTypeByFullname(fullname);switch (userType) {- case UserType.SERVICE_ACCOUNT:+ case AccountType.SERVICE_ACCOUNT:if (!hasGetServiceAccountPermission.value) {continue;}@@ -174,7 +175,7 @@ const additionalOptions = computedAsync(async () => {);options.push(getUserOption(serviceAccountToUser(sa)));break;- case UserType.WORKLOAD_IDENTITY:+ case AccountType.WORKLOAD_IDENTITY:if (!hasGetWorkloadIdentityPermission.value) {continue;}@@ -247,14 +248,14 @@ const fetchAccounts = async (params: {nextPageToken: string;options: ResourceSelectOption<AccountResource>[];}> => {- let userType = getUserTypeByFullname(params.search);- if (userType === UserType.USER) {+ let userType = getAccountTypeByFullname(params.search);+ if (userType === AccountType.USER) {// If the params.search doesn't have the prefix,// we will try to guess the type by email suffix.- userType = getUserTypeByEmail(params.search);+ userType = getAccountTypeByEmail(params.search);}switch (userType) {- case UserType.SERVICE_ACCOUNT:+ case AccountType.SERVICE_ACCOUNT:if (!props.includeServiceAccount) {return {nextPageToken: "",@@ -287,7 +288,7 @@ const fetchAccounts = async (params: {nextPageToken: "",options: [getUserOption(serviceAccountToUser(sa))],};- case UserType.WORKLOAD_IDENTITY:+ case AccountType.WORKLOAD_IDENTITY:if (!props.includeWorkloadIdentity) {return {nextPageToken: "",diff --git a/frontend/src/store/modules/serviceAccount.ts b/frontend/src/store/modules/serviceAccount.tsindex c0c8d1e38d..f61f119366 100644--- a/frontend/src/store/modules/serviceAccount.ts+++ b/frontend/src/store/modules/serviceAccount.ts@@ -15,12 +15,7 @@ import {UndeleteServiceAccountRequestSchema,UpdateServiceAccountRequestSchema,} from "@/types/proto-es/v1/service_account_service_pb";-import {- type User,- UserSchema,- UserType,-} from "@/types/proto-es/v1/user_service_pb";-import { useActuatorV1Store } from "./v1/actuator";+import { type User, UserSchema } from "@/types/proto-es/v1/user_service_pb";import { extractServiceAccountId, serviceAccountNamePrefix } from "./v1/common";export interface AccountFilter {@@ -46,7 +41,6 @@ export const ensureServiceAccountFullName = (identifier: string) => {};export const useServiceAccountStore = defineStore("serviceAccount", () => {- const actuatorStore = useActuatorV1Store();const cacheByName = ref<Map<string, ServiceAccount>>(new Map());const listServiceAccounts = async ({@@ -121,13 +115,6 @@ export const useServiceAccountStore = defineStore("serviceAccount", () => {const sa =await serviceAccountServiceClientConnect.createServiceAccount(request);cacheByName.value.set(sa.name, sa);- actuatorStore.updateUserStat([- {- count: 1,- state: State.ACTIVE,- userType: UserType.SERVICE_ACCOUNT,- },- ]);return sa;};@@ -157,18 +144,6 @@ export const useServiceAccountStore = defineStore("serviceAccount", () => {if (sa) {sa.state = State.DELETED;}- actuatorStore.updateUserStat([- {- count: -1,- state: State.ACTIVE,- userType: UserType.SERVICE_ACCOUNT,- },- {- count: 1,- state: State.DELETED,- userType: UserType.SERVICE_ACCOUNT,- },- ]);};const undeleteServiceAccount = async (name: string) => {@@ -178,18 +153,6 @@ export const useServiceAccountStore = defineStore("serviceAccount", () => {const sa =await serviceAccountServiceClientConnect.undeleteServiceAccount(request);cacheByName.value.set(sa.name, sa);- actuatorStore.updateUserStat([- {- count: 1,- state: State.ACTIVE,- userType: UserType.SERVICE_ACCOUNT,- },- {- count: -1,- state: State.DELETED,- userType: UserType.SERVICE_ACCOUNT,- },- ]);return sa;};@@ -210,7 +173,6 @@ export const serviceAccountToUser = (sa: ServiceAccount): User => {email: sa.email,title: sa.title,state: sa.state,- userType: UserType.SERVICE_ACCOUNT,serviceKey: sa.serviceKey,});};diff --git a/frontend/src/store/modules/user.ts b/frontend/src/store/modules/user.tsindex 508391375b..dccc478d1c 100644--- a/frontend/src/store/modules/user.ts+++ b/frontend/src/store/modules/user.ts@@ -25,7 +25,6 @@ import {ListUsersRequestSchema,UndeleteUserRequestSchema,UpdateUserRequestSchema,- UserType,} from "@/types/proto-es/v1/user_service_pb";import { ensureUserFullName, hasWorkspacePermissionV2 } from "@/utils";import { useActuatorV1Store } from "./v1/actuator";@@ -123,13 +122,7 @@ export const useUserStore = defineStore("user", () => {user: user,});const response = await userServiceClientConnect.createUser(request);- actuatorStore.updateUserStat([- {- count: 1,- state: State.ACTIVE,- userType: UserType.USER,- },- ]);+ actuatorStore.updateUserStat(1);return setUser(response);};@@ -180,18 +173,7 @@ export const useUserStore = defineStore("user", () => {name,});await userServiceClientConnect.deleteUser(request);- actuatorStore.updateUserStat([- {- count: -1,- state: State.ACTIVE,- userType: UserType.USER,- },- {- count: 1,- state: State.DELETED,- userType: UserType.USER,- },- ]);+ actuatorStore.updateUserStat(-1);const user = userMapByName.value.get(name);if (user) {@@ -204,18 +186,7 @@ export const useUserStore = defineStore("user", () => {name,});const response = await userServiceClientConnect.undeleteUser(request);- actuatorStore.updateUserStat([- {- count: 1,- state: State.ACTIVE,- userType: UserType.USER,- },- {- count: -1,- state: State.DELETED,- userType: UserType.USER,- },- ]);+ actuatorStore.updateUserStat(1);return setUser(response);};diff --git a/frontend/src/store/modules/v1/actuator.ts b/frontend/src/store/modules/v1/actuator.tsindex 3f5132855c..f43d9277e2 100644--- a/frontend/src/store/modules/v1/actuator.ts+++ b/frontend/src/store/modules/v1/actuator.ts@@ -14,8 +14,6 @@ import type {ActuatorInfo,ResourcePackage,} from "@/types/proto-es/v1/actuator_service_pb";-import { State } from "@/types/proto-es/v1/common_pb";-import { UserType } from "@/types/proto-es/v1/user_service_pb";import {STORAGE_KEY_ONBOARDING,STORAGE_KEY_RELEASE,@@ -113,37 +111,19 @@ export const useActuatorV1Store = defineStore("actuator_v1", () => {const replicaCount = computed(() => serverInfo.value?.replicaCount ?? 1);- const countUser = ({- state,- userTypes,- }: {- state: State;- userTypes: UserType[];- }): number => {- return (serverInfo.value?.userStats ?? []).reduce((count, stat) => {- if (stat.state === state && userTypes.includes(stat.userType)) {- count += stat.count;- }- return count;- }, 0);- };+ const activeUserCount = computed(+ () => serverInfo.value?.activatedUserCount ?? 0+ );- const updateUserStat = (- updates: {- count: number;- state: State;- userType: UserType;- }[]- ) => {- for (const update of updates) {- const item = (serverInfo.value?.userStats ?? []).find(- (stat) =>- stat.state === update.state && stat.userType === update.userType- );- if (item) {- item.count += update.count;- }+ const updateUserStat = (count: number) => {+ if (!serverInfo.value) {+ return;}+ serverInfo.value.activatedUserCount += count;+ serverInfo.value.activatedUserCount = Math.max(+ 0,+ serverInfo.value.activatedUserCount+ );};const quickStartEnabled = computed(() => {@@ -155,12 +135,7 @@ export const useActuatorV1Store = defineStore("actuator_v1", () => {}// Hide quickstart if there are more than 1 active users.- return (- countUser({- state: State.ACTIVE,- userTypes: [UserType.USER],- }) <= 1- );+ return activeUserCount.value <= 1;});const setLogo = (logo: string) => {@@ -278,7 +253,7 @@ export const useActuatorV1Store = defineStore("actuator_v1", () => {replicaCount,quickStartEnabled,// Actions- countUser,+ activeUserCount,updateUserStat,setLogo,setServerInfo,diff --git a/frontend/src/store/modules/v1/auth.ts b/frontend/src/store/modules/v1/auth.tsindex 8bd474c2d4..cf5687fcf5 100644--- a/frontend/src/store/modules/v1/auth.ts+++ b/frontend/src/store/modules/v1/auth.ts@@ -25,7 +25,6 @@ import type { User } from "@/types/proto-es/v1/user_service_pb";import {CreateUserRequestSchema,UserSchema,- UserType,} from "@/types/proto-es/v1/user_service_pb";import { storageKeyResetPassword } from "@/utils";import { extractUserEmail } from "./common";@@ -156,7 +155,6 @@ export const useAuthStore = defineStore("auth_v1", () => {email: request.email,title: request.name,password: request.password,- userType: UserType.USER,});const createRequest = create(CreateUserRequestSchema, {user: user,diff --git a/frontend/src/store/modules/v1/common.ts b/frontend/src/store/modules/v1/common.tsindex 146c2432a1..95659f9373 100644--- a/frontend/src/store/modules/v1/common.ts+++ b/frontend/src/store/modules/v1/common.ts@@ -1,6 +1,7 @@import { UNKNOWN_ID } from "@/types/const";import type { ResourceId } from "@/types/id";-import { type User, UserType } from "@/types/proto-es/v1/user_service_pb";+import type { User } from "@/types/proto-es/v1/user_service_pb";+import { AccountType, getAccountTypeByEmail } from "@/types/v1/user";export const workspaceNamePrefix = "workspaces/";export const userNamePrefix = "users/";@@ -31,10 +32,10 @@ export const serviceAccountNamePrefix = "serviceAccounts/";export const workloadIdentityNamePrefix = "workloadIdentities/";export const getUserFullNameByType = (user: User): string => {- switch (user.userType) {- case UserType.SERVICE_ACCOUNT:+ switch (getAccountTypeByEmail(user.email)) {+ case AccountType.SERVICE_ACCOUNT:return `${serviceAccountNamePrefix}${user.email}`;- case UserType.WORKLOAD_IDENTITY:+ case AccountType.WORKLOAD_IDENTITY:return `${workloadIdentityNamePrefix}${user.email}`;default:return `${userNamePrefix}${user.email}`;diff --git a/frontend/src/store/modules/workloadIdentity.ts b/frontend/src/store/modules/workloadIdentity.tsindex c8b40834a2..eb5ac18679 100644--- a/frontend/src/store/modules/workloadIdentity.ts+++ b/frontend/src/store/modules/workloadIdentity.ts@@ -5,11 +5,7 @@ import { ref } from "vue";import { workloadIdentityServiceClientConnect } from "@/connect";import { silentContextKey } from "@/connect/context-key";import { State } from "@/types/proto-es/v1/common_pb";-import {- type User,- UserSchema,- UserType,-} from "@/types/proto-es/v1/user_service_pb";+import { type User, UserSchema } from "@/types/proto-es/v1/user_service_pb";import type { WorkloadIdentity } from "@/types/proto-es/v1/workload_identity_service_pb";import {CreateWorkloadIdentityRequestSchema,@@ -21,7 +17,6 @@ import {WorkloadIdentitySchema,} from "@/types/proto-es/v1/workload_identity_service_pb";import { type AccountFilter, getAccountListFilter } from "./serviceAccount";-import { useActuatorV1Store } from "./v1/actuator";import {extractWorkloadIdentityId,workloadIdentityNamePrefix,@@ -33,7 +28,6 @@ export const ensureWorkloadIdentityFullName = (identifier: string) => {};export const useWorkloadIdentityStore = defineStore("workloadIdentity", () => {- const actuatorStore = useActuatorV1Store();const cacheByName = ref<Map<string, WorkloadIdentity>>(new Map());const listWorkloadIdentities = async ({@@ -113,13 +107,6 @@ export const useWorkloadIdentityStore = defineStore("workloadIdentity", () => {request);cacheByName.value.set(wi.name, wi);- actuatorStore.updateUserStat([- {- count: 1,- state: State.ACTIVE,- userType: UserType.WORKLOAD_IDENTITY,- },- ]);return wi;};@@ -151,18 +138,6 @@ export const useWorkloadIdentityStore = defineStore("workloadIdentity", () => {if (wi) {wi.state = State.DELETED;}- actuatorStore.updateUserStat([- {- count: -1,- state: State.ACTIVE,- userType: UserType.WORKLOAD_IDENTITY,- },- {- count: 1,- state: State.DELETED,- userType: UserType.WORKLOAD_IDENTITY,- },- ]);};const undeleteWorkloadIdentity = async (name: string) => {@@ -174,18 +149,6 @@ export const useWorkloadIdentityStore = defineStore("workloadIdentity", () => {request);cacheByName.value.set(wi.name, wi);- actuatorStore.updateUserStat([- {- count: 1,- state: State.ACTIVE,- userType: UserType.WORKLOAD_IDENTITY,- },- {- count: -1,- state: State.DELETED,- userType: UserType.WORKLOAD_IDENTITY,- },- ]);return wi;};@@ -206,7 +169,5 @@ export const workloadIdentityToUser = (wi: WorkloadIdentity): User => {email: wi.email,title: wi.title,state: wi.state,- userType: UserType.WORKLOAD_IDENTITY,- workloadIdentityConfig: wi.workloadIdentityConfig,});};diff --git a/frontend/src/types/proto-es/v1/actuator_service_pb.d.ts b/frontend/src/types/proto-es/v1/actuator_service_pb.d.tsindex 4004227dde..acc75ef621 100644--- a/frontend/src/types/proto-es/v1/actuator_service_pb.d.ts+++ b/frontend/src/types/proto-es/v1/actuator_service_pb.d.ts@@ -6,8 +6,6 @@ import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenimport type { Message } from "@bufbuild/protobuf";import type { WorkspaceProfileSetting_PasswordRestriction } from "./setting_service_pb";import type { EmptySchema, Timestamp } from "@bufbuild/protobuf/wkt";-import type { UserType } from "./user_service_pb";-import type { State } from "./common_pb";/*** Describes the file v1/actuator_service.proto.@@ -221,11 +219,11 @@ export declare type ActuatorInfo = Message<"bytebase.v1.ActuatorInfo"> & {docker: boolean;/**- * Statistics about users in the system.+ * The number of activated users.*- * @generated from field: repeated bytebase.v1.ActuatorInfo.StatUser user_stats = 19;+ * @generated from field: int32 activated_user_count = 19;*/- userStats: ActuatorInfo_StatUser[];+ activatedUserCount: number;/*** The number of activated database instances.@@ -274,40 +272,6 @@ export declare type ActuatorInfo = Message<"bytebase.v1.ActuatorInfo"> & {*/export declare const ActuatorInfoSchema: GenMessage<ActuatorInfo>;-/**- * User statistics by type and state.- *- * @generated from message bytebase.v1.ActuatorInfo.StatUser- */-export declare type ActuatorInfo_StatUser = Message<"bytebase.v1.ActuatorInfo.StatUser"> & {- /**- * The type of user.- *- * @generated from field: bytebase.v1.UserType user_type = 1;- */- userType: UserType;-- /**- * The state of the user.- *- * @generated from field: bytebase.v1.State state = 2;- */- state: State;-- /**- * The count of users matching this type and state.- *- * @generated from field: int32 count = 3;- */- count: number;-};--/**- * Describes the message bytebase.v1.ActuatorInfo.StatUser.- * Use `create(ActuatorInfo_StatUserSchema)` to create a new message.- */-export declare const ActuatorInfo_StatUserSchema: GenMessage<ActuatorInfo_StatUser>;-/*** ActuatorService manages system health and operational information.*diff --git a/frontend/src/types/proto-es/v1/actuator_service_pb.js b/frontend/src/types/proto-es/v1/actuator_service_pb.jsindex 484689bbea..33f91f2740 100644--- a/frontend/src/types/proto-es/v1/actuator_service_pb.js+++ b/frontend/src/types/proto-es/v1/actuator_service_pb.js@@ -8,15 +8,13 @@ import { file_google_api_client } from "../google/api/client_pb";import { file_google_api_field_behavior } from "../google/api/field_behavior_pb";import { file_google_protobuf_empty, file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt";import { file_v1_annotation } from "./annotation_pb";-import { file_v1_common } from "./common_pb";import { file_v1_setting_service } from "./setting_service_pb";-import { file_v1_user_service } from "./user_service_pb";/*** Describes the file v1/actuator_service.proto.*/export const file_v1_actuator_service = /*@__PURE__*/- fileDesc("Chl2MS9hY3R1YXRvcl9zZXJ2aWNlLnByb3RvEgtieXRlYmFzZS52MSIbChlHZXRSZXNvdXJjZVBhY2thZ2VSZXF1ZXN0Ih8KD1Jlc291cmNlUGFja2FnZRIMCgRsb2dvGAEgASgMIhQKElNldHVwU2FtcGxlUmVxdWVzdCIYChZHZXRBY3R1YXRvckluZm9SZXF1ZXN0IhQKEkRlbGV0ZUNhY2hlUmVxdWVzdCKvAQoLUmVzdHJpY3Rpb24SHAoPZGlzYWxsb3dfc2lnbnVwGAEgASgIQgPgQQMSJQoYZGlzYWxsb3dfcGFzc3dvcmRfc2lnbmluGAIgASgIQgPgQQMSWwoUcGFzc3dvcmRfcmVzdHJpY3Rpb24YAyABKAsyOC5ieXRlYmFzZS52MS5Xb3Jrc3BhY2VQcm9maWxlU2V0dGluZy5QYXNzd29yZFJlc3RyaWN0aW9uQgPgQQMihQYKDEFjdHVhdG9ySW5mbxIUCgd2ZXJzaW9uGAEgASgJQgPgQQMSFwoKZ2l0X2NvbW1pdBgCIAEoCUID4EEDEhUKCHJlYWRvbmx5GAMgASgIQgPgQQMSEQoEc2FhcxgEIAEoCEID4EEDEhEKBGRlbW8YBSABKAhCA+BBAxIRCgRob3N0GAYgASgJQgPgQQMSEQoEcG9ydBgHIAEoCUID4EEDEhkKDGV4dGVybmFsX3VybBgIIAEoCUID4EEDEh0KEG5lZWRfYWRtaW5fc2V0dXAYCSABKAhCA+BBAxI5ChBsYXN0X2FjdGl2ZV90aW1lGAsgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEID4EEDEhkKDHdvcmtzcGFjZV9pZBgNIAEoCUID4EEDEiAKE3VubGljZW5zZWRfZmVhdHVyZXMYDyADKAlCA+BBAxITCgZkb2NrZXIYEiABKAhCA+BBAxI7Cgp1c2VyX3N0YXRzGBMgAygLMiIuYnl0ZWJhc2UudjEuQWN0dWF0b3JJbmZvLlN0YXRVc2VyQgPgQQMSJQoYYWN0aXZhdGVkX2luc3RhbmNlX2NvdW50GBQgASgFQgPgQQMSIQoUdG90YWxfaW5zdGFuY2VfY291bnQYFSABKAVCA+BBAxIaCg1lbmFibGVfc2FtcGxlGBYgASgIQgPgQQMSIwoWZXh0ZXJuYWxfdXJsX2Zyb21fZmxhZxgXIAEoCEID4EEDEhoKDXJlcGxpY2FfY291bnQYGCABKAVCA+BBAxIyCgtyZXN0cmljdGlvbhgZIAEoCzIYLmJ5dGViYXNlLnYxLlJlc3RyaWN0aW9uQgPgQQMaZgoIU3RhdFVzZXISKAoJdXNlcl90eXBlGAEgASgOMhUuYnl0ZWJhc2UudjEuVXNlclR5cGUSIQoFc3RhdGUYAiABKA4yEi5ieXRlYmFzZS52MS5TdGF0ZRINCgVjb3VudBgDIAEoBUoECAoQC0oECAwQDUoECBAQEUoECBEQEkoECA4QDzL3AwoPQWN0dWF0b3JTZXJ2aWNlEnMKD0dldEFjdHVhdG9ySW5mbxIjLmJ5dGViYXNlLnYxLkdldEFjdHVhdG9ySW5mb1JlcXVlc3QaGS5ieXRlYmFzZS52MS5BY3R1YXRvckluZm8iINpBAIDqMAGC0+STAhMSES92MS9hY3R1YXRvci9pbmZvEoIBCgtTZXR1cFNhbXBsZRIfLmJ5dGViYXNlLnYxLlNldHVwU2FtcGxlUmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSI6iuowEmJiLnByb2plY3RzLmNyZWF0ZZDqMAGC0+STAhoiGC92MS9hY3R1YXRvcjpzZXR1cFNhbXBsZRJmCgtEZWxldGVDYWNoZRIfLmJ5dGViYXNlLnYxLkRlbGV0ZUNhY2hlUmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIegOowAYLT5JMCFCoSL3YxL2FjdHVhdG9yL2NhY2hlEoEBChJHZXRSZXNvdXJjZVBhY2thZ2USJi5ieXRlYmFzZS52MS5HZXRSZXNvdXJjZVBhY2thZ2VSZXF1ZXN0GhwuYnl0ZWJhc2UudjEuUmVzb3VyY2VQYWNrYWdlIiXaQQCA6jABgtPkkwIYEhYvdjEvYWN0dWF0b3IvcmVzb3VyY2VzQqoBCg9jb20uYnl0ZWJhc2UudjFCFEFjdHVhdG9yU2VydmljZVByb3RvUAFaNGdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvYmFja2VuZC9nZW5lcmF0ZWQtZ28vdjGiAgNCWFiqAgtCeXRlYmFzZS5WMcoCC0J5dGViYXNlXFYx4gIXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_protobuf_empty, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common, file_v1_setting_service, file_v1_user_service]);+ fileDesc("Chl2MS9hY3R1YXRvcl9zZXJ2aWNlLnByb3RvEgtieXRlYmFzZS52MSIbChlHZXRSZXNvdXJjZVBhY2thZ2VSZXF1ZXN0Ih8KD1Jlc291cmNlUGFja2FnZRIMCgRsb2dvGAEgASgMIhQKElNldHVwU2FtcGxlUmVxdWVzdCIYChZHZXRBY3R1YXRvckluZm9SZXF1ZXN0IhQKEkRlbGV0ZUNhY2hlUmVxdWVzdCKvAQoLUmVzdHJpY3Rpb24SHAoPZGlzYWxsb3dfc2lnbnVwGAEgASgIQgPgQQMSJQoYZGlzYWxsb3dfcGFzc3dvcmRfc2lnbmluGAIgASgIQgPgQQMSWwoUcGFzc3dvcmRfcmVzdHJpY3Rpb24YAyABKAsyOC5ieXRlYmFzZS52MS5Xb3Jrc3BhY2VQcm9maWxlU2V0dGluZy5QYXNzd29yZFJlc3RyaWN0aW9uQgPgQQMigwUKDEFjdHVhdG9ySW5mbxIUCgd2ZXJzaW9uGAEgASgJQgPgQQMSFwoKZ2l0X2NvbW1pdBgCIAEoCUID4EEDEhUKCHJlYWRvbmx5GAMgASgIQgPgQQMSEQoEc2FhcxgEIAEoCEID4EEDEhEKBGRlbW8YBSABKAhCA+BBAxIRCgRob3N0GAYgASgJQgPgQQMSEQoEcG9ydBgHIAEoCUID4EEDEhkKDGV4dGVybmFsX3VybBgIIAEoCUID4EEDEh0KEG5lZWRfYWRtaW5fc2V0dXAYCSABKAhCA+BBAxI5ChBsYXN0X2FjdGl2ZV90aW1lGAsgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEID4EEDEhkKDHdvcmtzcGFjZV9pZBgNIAEoCUID4EEDEiAKE3VubGljZW5zZWRfZmVhdHVyZXMYDyADKAlCA+BBAxITCgZkb2NrZXIYEiABKAhCA+BBAxIhChRhY3RpdmF0ZWRfdXNlcl9jb3VudBgTIAEoBUID4EEDEiUKGGFjdGl2YXRlZF9pbnN0YW5jZV9jb3VudBgUIAEoBUID4EEDEiEKFHRvdGFsX2luc3RhbmNlX2NvdW50GBUgASgFQgPgQQMSGgoNZW5hYmxlX3NhbXBsZRgWIAEoCEID4EEDEiMKFmV4dGVybmFsX3VybF9mcm9tX2ZsYWcYFyABKAhCA+BBAxIaCg1yZXBsaWNhX2NvdW50GBggASgFQgPgQQMSMgoLcmVzdHJpY3Rpb24YGSABKAsyGC5ieXRlYmFzZS52MS5SZXN0cmljdGlvbkID4EEDSgQIChALSgQIDBANSgQIEBARSgQIERASSgQIDhAPMvcDCg9BY3R1YXRvclNlcnZpY2UScwoPR2V0QWN0dWF0b3JJbmZvEiMuYnl0ZWJhc2UudjEuR2V0QWN0dWF0b3JJbmZvUmVxdWVzdBoZLmJ5dGViYXNlLnYxLkFjdHVhdG9ySW5mbyIg2kEAgOowAYLT5JMCExIRL3YxL2FjdHVhdG9yL2luZm8SggEKC1NldHVwU2FtcGxlEh8uYnl0ZWJhc2UudjEuU2V0dXBTYW1wbGVSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IjqK6jASYmIucHJvamVjdHMuY3JlYXRlkOowAYLT5JMCGiIYL3YxL2FjdHVhdG9yOnNldHVwU2FtcGxlEmYKC0RlbGV0ZUNhY2hlEh8uYnl0ZWJhc2UudjEuRGVsZXRlQ2FjaGVSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5Ih6A6jABgtPkkwIUKhIvdjEvYWN0dWF0b3IvY2FjaGUSgQEKEkdldFJlc291cmNlUGFja2FnZRImLmJ5dGViYXNlLnYxLkdldFJlc291cmNlUGFja2FnZVJlcXVlc3QaHC5ieXRlYmFzZS52MS5SZXNvdXJjZVBhY2thZ2UiJdpBAIDqMAGC0+STAhgSFi92MS9hY3R1YXRvci9yZXNvdXJjZXNCqgEKD2NvbS5ieXRlYmFzZS52MUIUQWN0dWF0b3JTZXJ2aWNlUHJvdG9QAVo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MaICA0JYWKoCC0J5dGViYXNlLlYxygILQnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_protobuf_empty, file_google_protobuf_timestamp, file_v1_annotation, file_v1_setting_service]);/*** Describes the message bytebase.v1.GetResourcePackageRequest.@@ -67,13 +65,6 @@ export const RestrictionSchema = /*@__PURE__*/export const ActuatorInfoSchema = /*@__PURE__*/messageDesc(file_v1_actuator_service, 6);-/**- * Describes the message bytebase.v1.ActuatorInfo.StatUser.- * Use `create(ActuatorInfo_StatUserSchema)` to create a new message.- */-export const ActuatorInfo_StatUserSchema = /*@__PURE__*/- messageDesc(file_v1_actuator_service, 6, 0);-/*** ActuatorService manages system health and operational information.*diff --git a/frontend/src/types/proto-es/v1/user_service_pb.d.ts b/frontend/src/types/proto-es/v1/user_service_pb.d.tsindex 95d1a1c2d0..d608e85b5d 100644--- a/frontend/src/types/proto-es/v1/user_service_pb.d.ts+++ b/frontend/src/types/proto-es/v1/user_service_pb.d.ts@@ -2,7 +2,7 @@// @generated from file v1/user_service.proto (package bytebase.v1, syntax proto3)/* eslint-disable */-import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";+import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";import type { Message } from "@bufbuild/protobuf";import type { EmptySchema, FieldMask, Timestamp } from "@bufbuild/protobuf/wkt";import type { State } from "./common_pb";@@ -332,13 +332,6 @@ export declare type User = Message<"bytebase.v1.User"> & {*/title: string;- /**- * The type of user account.- *- * @generated from field: bytebase.v1.UserType user_type = 5;- */- userType: UserType;-/*** The password for authentication. Only used during user creation or password updates.*@@ -403,13 +396,6 @@ export declare type User = Message<"bytebase.v1.User"> & {* @generated from field: repeated string groups = 14;*/groups: string[];-- /**- * Workload Identity configuration (only for WORKLOAD_IDENTITY type)- *- * @generated from field: bytebase.v1.WorkloadIdentityConfig workload_identity_config = 15;- */- workloadIdentityConfig?: WorkloadIdentityConfig;};/**@@ -450,112 +436,6 @@ export declare type User_Profile = Message<"bytebase.v1.User.Profile"> & {*/export declare const User_ProfileSchema: GenMessage<User_Profile>;-/**- * WorkloadIdentityConfig for API layer- *- * @generated from message bytebase.v1.WorkloadIdentityConfig- */-export declare type WorkloadIdentityConfig = Message<"bytebase.v1.WorkloadIdentityConfig"> & {- /**- * Platform type (currently only GITHUB is supported)- *- * @generated from field: bytebase.v1.WorkloadIdentityConfig.ProviderType provider_type = 1;- */- providerType: WorkloadIdentityConfig_ProviderType;-- /**- * OIDC Issuer URL (auto-filled based on provider_type, can be overridden)- *- * @generated from field: string issuer_url = 2;- */- issuerUrl: string;-- /**- * Allowed audiences for token validation- *- * @generated from field: repeated string allowed_audiences = 3;- */- allowedAudiences: string[];-- /**- * Subject pattern to match (e.g., "repo:owner/repo:ref:refs/heads/main")- *- * @generated from field: string subject_pattern = 4;- */- subjectPattern: string;-};--/**- * Describes the message bytebase.v1.WorkloadIdentityConfig.- * Use `create(WorkloadIdentityConfigSchema)` to create a new message.- */-export declare const WorkloadIdentityConfigSchema: GenMessage<WorkloadIdentityConfig>;--/**- * ProviderType identifies the CI/CD platform.- *- * @generated from enum bytebase.v1.WorkloadIdentityConfig.ProviderType- */-export enum WorkloadIdentityConfig_ProviderType {- /**- * @generated from enum value: PROVIDER_TYPE_UNSPECIFIED = 0;- */- PROVIDER_TYPE_UNSPECIFIED = 0,-- /**- * @generated from enum value: GITHUB = 1;- */- GITHUB = 1,-- /**- * @generated from enum value: GITLAB = 2;- */- GITLAB = 2,-}--/**- * Describes the enum bytebase.v1.WorkloadIdentityConfig.ProviderType.- */-export declare const WorkloadIdentityConfig_ProviderTypeSchema: GenEnum<WorkloadIdentityConfig_ProviderType>;--/**- * @generated from enum bytebase.v1.UserType- */-export enum UserType {- /**- * Unspecified user type.- *- * @generated from enum value: USER_TYPE_UNSPECIFIED = 0;- */- USER_TYPE_UNSPECIFIED = 0,-- /**- * Regular human user account.- *- * @generated from enum value: USER = 1;- */- USER = 1,-- /**- * External CI/CD workload identity.- *- * @generated from enum value: WORKLOAD_IDENTITY = 2;- */- WORKLOAD_IDENTITY = 2,-- /**- * Service account for API integrations.- *- * @generated from enum value: SERVICE_ACCOUNT = 3;- */- SERVICE_ACCOUNT = 3,-}--/**- * Describes the enum bytebase.v1.UserType.- */-export declare const UserTypeSchema: GenEnum<UserType>;-/*** UserService manages user accounts and authentication.*diff --git a/frontend/src/types/proto-es/v1/user_service_pb.js b/frontend/src/types/proto-es/v1/user_service_pb.jsindex 93ae7ca725..b94f7d1cf0 100644--- a/frontend/src/types/proto-es/v1/user_service_pb.js+++ b/frontend/src/types/proto-es/v1/user_service_pb.js@@ -2,7 +2,7 @@// @generated from file v1/user_service.proto (package bytebase.v1, syntax proto3)/* eslint-disable */-import { enumDesc, fileDesc, messageDesc, serviceDesc, tsEnum } from "@bufbuild/protobuf/codegenv2";+import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2";import { file_buf_validate_validate } from "../buf/validate/validate_pb";import { file_google_api_annotations } from "../google/api/annotations_pb";import { file_google_api_client } from "../google/api/client_pb";@@ -16,7 +16,7 @@ import { file_v1_common } from "./common_pb";* Describes the file v1/user_service.proto.*/export const file_v1_user_service = /*@__PURE__*/- fileDesc("ChV2MS91c2VyX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIjkKDkdldFVzZXJSZXF1ZXN0EicKBG5hbWUYASABKAlCGeBBAvpBEwoRYnl0ZWJhc2UuY29tL1VzZXIiQAoUQmF0Y2hHZXRVc2Vyc1JlcXVlc3QSKAoFbmFtZXMYASADKAlCGeBBAvpBEwoRYnl0ZWJhc2UuY29tL1VzZXIiOQoVQmF0Y2hHZXRVc2Vyc1Jlc3BvbnNlEiAKBXVzZXJzGAEgAygLMhEuYnl0ZWJhc2UudjEuVXNlciJfChBMaXN0VXNlcnNSZXF1ZXN0EhEKCXBhZ2Vfc2l6ZRgBIAEoBRISCgpwYWdlX3Rva2VuGAIgASgJEhQKDHNob3dfZGVsZXRlZBgDIAEoCBIOCgZmaWx0ZXIYBCABKAkiTgoRTGlzdFVzZXJzUmVzcG9uc2USIAoFdXNlcnMYASADKAsyES5ieXRlYmFzZS52MS5Vc2VyEhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSI5ChFDcmVhdGVVc2VyUmVxdWVzdBIkCgR1c2VyGAEgASgLMhEuYnl0ZWJhc2UudjEuVXNlckID4EECIuwBChFVcGRhdGVVc2VyUmVxdWVzdBIkCgR1c2VyGAEgASgLMhEuYnl0ZWJhc2UudjEuVXNlckID4EECEi8KC3VwZGF0ZV9tYXNrGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFzaxIVCghvdHBfY29kZRgDIAEoCUgAiAEBEiIKGnJlZ2VuZXJhdGVfdGVtcF9tZmFfc2VjcmV0GAQgASgIEiEKGXJlZ2VuZXJhdGVfcmVjb3ZlcnlfY29kZXMYBSABKAgSFQoNYWxsb3dfbWlzc2luZxgGIAEoCEILCglfb3RwX2NvZGUiPAoRRGVsZXRlVXNlclJlcXVlc3QSJwoEbmFtZRgBIAEoCUIZ4EEC+kETChFieXRlYmFzZS5jb20vVXNlciI+ChNVbmRlbGV0ZVVzZXJSZXF1ZXN0EicKBG5hbWUYASABKAlCGeBBAvpBEwoRYnl0ZWJhc2UuY29tL1VzZXIiUQoSVXBkYXRlRW1haWxSZXF1ZXN0EicKBG5hbWUYASABKAlCGeBBAvpBEwoRYnl0ZWJhc2UuY29tL1VzZXISEgoFZW1haWwYAiABKAlCA+BBAiKaBQoEVXNlchIRCgRuYW1lGAEgASgJQgPgQQMSIQoFc3RhdGUYAiABKA4yEi5ieXRlYmFzZS52MS5TdGF0ZRINCgVlbWFpbBgDIAEoCRIXCgV0aXRsZRgEIAEoCUIIukgFcgMYyAESKAoJdXNlcl90eXBlGAUgASgOMhUuYnl0ZWJhc2UudjEuVXNlclR5cGUSFQoIcGFzc3dvcmQYBiABKAlCA+BBBBIYCgtzZXJ2aWNlX2tleRgHIAEoCUID4EEEEhMKC21mYV9lbmFibGVkGAggASgIEhcKD3RlbXBfb3RwX3NlY3JldBgJIAEoCRIbChN0ZW1wX3JlY292ZXJ5X2NvZGVzGAogAygJEkAKHHRlbXBfb3RwX3NlY3JldF9jcmVhdGVkX3RpbWUYCyABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEg0KBXBob25lGAwgASgJEioKB3Byb2ZpbGUYDSABKAsyGS5ieXRlYmFzZS52MS5Vc2VyLlByb2ZpbGUSEwoGZ3JvdXBzGA4gAygJQgPgQQMSRQoYd29ya2xvYWRfaWRlbnRpdHlfY29uZmlnGA8gASgLMiMuYnl0ZWJhc2UudjEuV29ya2xvYWRJZGVudGl0eUNvbmZpZxqNAQoHUHJvZmlsZRIzCg9sYXN0X2xvZ2luX3RpbWUYASABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEj0KGWxhc3RfY2hhbmdlX3Bhc3N3b3JkX3RpbWUYAiABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEg4KBnNvdXJjZRgDIAEoCTol6kEiChFieXRlYmFzZS5jb20vVXNlchINdXNlcnMve2VtYWlsfSLwAQoWV29ya2xvYWRJZGVudGl0eUNvbmZpZxJHCg1wcm92aWRlcl90eXBlGAEgASgOMjAuYnl0ZWJhc2UudjEuV29ya2xvYWRJZGVudGl0eUNvbmZpZy5Qcm92aWRlclR5cGUSEgoKaXNzdWVyX3VybBgCIAEoCRIZChFhbGxvd2VkX2F1ZGllbmNlcxgDIAMoCRIXCg9zdWJqZWN0X3BhdHRlcm4YBCABKAkiRQoMUHJvdmlkZXJUeXBlEh0KGVBST1ZJREVSX1RZUEVfVU5TUEVDSUZJRUQQABIKCgZHSVRIVUIQARIKCgZHSVRMQUIQAipbCghVc2VyVHlwZRIZChVVU0VSX1RZUEVfVU5TUEVDSUZJRUQQABIICgRVU0VSEAESFQoRV09SS0xPQURfSURFTlRJVFkQAhITCg9TRVJWSUNFX0FDQ09VTlQQAzLTCAoLVXNlclNlcnZpY2UScAoHR2V0VXNlchIbLmJ5dGViYXNlLnYxLkdldFVzZXJSZXF1ZXN0GhEuYnl0ZWJhc2UudjEuVXNlciI12kEEbmFtZYrqMAxiYi51c2Vycy5nZXSQ6jABgtPkkwIUEhIvdjEve25hbWU9dXNlcnMvKn0ShgEKDUJhdGNoR2V0VXNlcnMSIS5ieXRlYmFzZS52MS5CYXRjaEdldFVzZXJzUmVxdWVzdBoiLmJ5dGViYXNlLnYxLkJhdGNoR2V0VXNlcnNSZXNwb25zZSIuiuowDGJiLnVzZXJzLmdldJDqMAGC0+STAhQSEi92MS91c2VyczpiYXRjaEdldBJZCg5HZXRDdXJyZW50VXNlchIWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eRoRLmJ5dGViYXNlLnYxLlVzZXIiHIDqMAGQ6jACgtPkkwIOEgwvdjEvdXNlcnMvbWUSewoJTGlzdFVzZXJzEh0uYnl0ZWJhc2UudjEuTGlzdFVzZXJzUmVxdWVzdBoeLmJ5dGViYXNlLnYxLkxpc3RVc2Vyc1Jlc3BvbnNlIi/aQQZwYXJlbnSK6jANYmIudXNlcnMubGlzdJDqMAGC0+STAgsSCS92MS91c2VycxJrCgpDcmVhdGVVc2VyEh4uYnl0ZWJhc2UudjEuQ3JlYXRlVXNlclJlcXVlc3QaES5ieXRlYmFzZS52MS5Vc2VyIiraQQR1c2VygOowAZDqMAKY6jABgtPkkwIROgR1c2VyIgkvdjEvdXNlcnMSgQEKClVwZGF0ZVVzZXISHi5ieXRlYmFzZS52MS5VcGRhdGVVc2VyUmVxdWVzdBoRLmJ5dGViYXNlLnYxLlVzZXIiQNpBEHVzZXIsdXBkYXRlX21hc2uQ6jACmOowAYLT5JMCHzoEdXNlcjIXL3YxL3t1c2VyLm5hbWU9dXNlcnMvKn0SbwoKRGVsZXRlVXNlchIeLmJ5dGViYXNlLnYxLkRlbGV0ZVVzZXJSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IinaQQRuYW1lkOowApjqMAGC0+STAhQqEi92MS97bmFtZT11c2Vycy8qfRJzCgxVbmRlbGV0ZVVzZXISIC5ieXRlYmFzZS52MS5VbmRlbGV0ZVVzZXJSZXF1ZXN0GhEuYnl0ZWJhc2UudjEuVXNlciIukOowApjqMAGC0+STAiA6ASoiGy92MS97bmFtZT11c2Vycy8qfTp1bmRlbGV0ZRKZAQoLVXBkYXRlRW1haWwSHy5ieXRlYmFzZS52MS5VcGRhdGVFbWFpbFJlcXVlc3QaES5ieXRlYmFzZS52MS5Vc2VyIlbaQQpuYW1lLGVtYWlsiuowFGJiLnVzZXJzLnVwZGF0ZUVtYWlskOowAZjqMAGC0+STAiM6ASoiHi92MS97bmFtZT11c2Vycy8qfTp1cGRhdGVFbWFpbEKmAQoPY29tLmJ5dGViYXNlLnYxQhBVc2VyU2VydmljZVByb3RvUAFaNGdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvYmFja2VuZC9nZW5lcmF0ZWQtZ28vdjGiAgNCWFiqAgtCeXRlYmFzZS5WMcoCC0J5dGViYXNlXFYx4gIXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [file_buf_validate_validate, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common]);+ fileDesc("ChV2MS91c2VyX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIjkKDkdldFVzZXJSZXF1ZXN0EicKBG5hbWUYASABKAlCGeBBAvpBEwoRYnl0ZWJhc2UuY29tL1VzZXIiQAoUQmF0Y2hHZXRVc2Vyc1JlcXVlc3QSKAoFbmFtZXMYASADKAlCGeBBAvpBEwoRYnl0ZWJhc2UuY29tL1VzZXIiOQoVQmF0Y2hHZXRVc2Vyc1Jlc3BvbnNlEiAKBXVzZXJzGAEgAygLMhEuYnl0ZWJhc2UudjEuVXNlciJfChBMaXN0VXNlcnNSZXF1ZXN0EhEKCXBhZ2Vfc2l6ZRgBIAEoBRISCgpwYWdlX3Rva2VuGAIgASgJEhQKDHNob3dfZGVsZXRlZBgDIAEoCBIOCgZmaWx0ZXIYBCABKAkiTgoRTGlzdFVzZXJzUmVzcG9uc2USIAoFdXNlcnMYASADKAsyES5ieXRlYmFzZS52MS5Vc2VyEhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSI5ChFDcmVhdGVVc2VyUmVxdWVzdBIkCgR1c2VyGAEgASgLMhEuYnl0ZWJhc2UudjEuVXNlckID4EECIuwBChFVcGRhdGVVc2VyUmVxdWVzdBIkCgR1c2VyGAEgASgLMhEuYnl0ZWJhc2UudjEuVXNlckID4EECEi8KC3VwZGF0ZV9tYXNrGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFzaxIVCghvdHBfY29kZRgDIAEoCUgAiAEBEiIKGnJlZ2VuZXJhdGVfdGVtcF9tZmFfc2VjcmV0GAQgASgIEiEKGXJlZ2VuZXJhdGVfcmVjb3ZlcnlfY29kZXMYBSABKAgSFQoNYWxsb3dfbWlzc2luZxgGIAEoCEILCglfb3RwX2NvZGUiPAoRRGVsZXRlVXNlclJlcXVlc3QSJwoEbmFtZRgBIAEoCUIZ4EEC+kETChFieXRlYmFzZS5jb20vVXNlciI+ChNVbmRlbGV0ZVVzZXJSZXF1ZXN0EicKBG5hbWUYASABKAlCGeBBAvpBEwoRYnl0ZWJhc2UuY29tL1VzZXIiUQoSVXBkYXRlRW1haWxSZXF1ZXN0EicKBG5hbWUYASABKAlCGeBBAvpBEwoRYnl0ZWJhc2UuY29tL1VzZXISEgoFZW1haWwYAiABKAlCA+BBAiK1BAoEVXNlchIRCgRuYW1lGAEgASgJQgPgQQMSIQoFc3RhdGUYAiABKA4yEi5ieXRlYmFzZS52MS5TdGF0ZRINCgVlbWFpbBgDIAEoCRIXCgV0aXRsZRgEIAEoCUIIukgFcgMYyAESFQoIcGFzc3dvcmQYBiABKAlCA+BBBBIYCgtzZXJ2aWNlX2tleRgHIAEoCUID4EEEEhMKC21mYV9lbmFibGVkGAggASgIEhcKD3RlbXBfb3RwX3NlY3JldBgJIAEoCRIbChN0ZW1wX3JlY292ZXJ5X2NvZGVzGAogAygJEkAKHHRlbXBfb3RwX3NlY3JldF9jcmVhdGVkX3RpbWUYCyABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEg0KBXBob25lGAwgASgJEioKB3Byb2ZpbGUYDSABKAsyGS5ieXRlYmFzZS52MS5Vc2VyLlByb2ZpbGUSEwoGZ3JvdXBzGA4gAygJQgPgQQMajQEKB1Byb2ZpbGUSMwoPbGFzdF9sb2dpbl90aW1lGAEgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBI9ChlsYXN0X2NoYW5nZV9wYXNzd29yZF90aW1lGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIOCgZzb3VyY2UYAyABKAk6JepBIgoRYnl0ZWJhc2UuY29tL1VzZXISDXVzZXJzL3tlbWFpbH1KBAgFEAZKBAgPEBAy0wgKC1VzZXJTZXJ2aWNlEnAKB0dldFVzZXISGy5ieXRlYmFzZS52MS5HZXRVc2VyUmVxdWVzdBoRLmJ5dGViYXNlLnYxLlVzZXIiNdpBBG5hbWWK6jAMYmIudXNlcnMuZ2V0kOowAYLT5JMCFBISL3YxL3tuYW1lPXVzZXJzLyp9EoYBCg1CYXRjaEdldFVzZXJzEiEuYnl0ZWJhc2UudjEuQmF0Y2hHZXRVc2Vyc1JlcXVlc3QaIi5ieXRlYmFzZS52MS5CYXRjaEdldFVzZXJzUmVzcG9uc2UiLorqMAxiYi51c2Vycy5nZXSQ6jABgtPkkwIUEhIvdjEvdXNlcnM6YmF0Y2hHZXQSWQoOR2V0Q3VycmVudFVzZXISFi5nb29nbGUucHJvdG9idWYuRW1wdHkaES5ieXRlYmFzZS52MS5Vc2VyIhyA6jABkOowAoLT5JMCDhIML3YxL3VzZXJzL21lEnsKCUxpc3RVc2VycxIdLmJ5dGViYXNlLnYxLkxpc3RVc2Vyc1JlcXVlc3QaHi5ieXRlYmFzZS52MS5MaXN0VXNlcnNSZXNwb25zZSIv2kEGcGFyZW50iuowDWJiLnVzZXJzLmxpc3SQ6jABgtPkkwILEgkvdjEvdXNlcnMSawoKQ3JlYXRlVXNlchIeLmJ5dGViYXNlLnYxLkNyZWF0ZVVzZXJSZXF1ZXN0GhEuYnl0ZWJhc2UudjEuVXNlciIq2kEEdXNlcoDqMAGQ6jACmOowAYLT5JMCEToEdXNlciIJL3YxL3VzZXJzEoEBCgpVcGRhdGVVc2VyEh4uYnl0ZWJhc2UudjEuVXBkYXRlVXNlclJlcXVlc3QaES5ieXRlYmFzZS52MS5Vc2VyIkDaQRB1c2VyLHVwZGF0ZV9tYXNrkOowApjqMAGC0+STAh86BHVzZXIyFy92MS97dXNlci5uYW1lPXVzZXJzLyp9Em8KCkRlbGV0ZVVzZXISHi5ieXRlYmFzZS52MS5EZWxldGVVc2VyUmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIp2kEEbmFtZZDqMAKY6jABgtPkkwIUKhIvdjEve25hbWU9dXNlcnMvKn0ScwoMVW5kZWxldGVVc2VyEiAuYnl0ZWJhc2UudjEuVW5kZWxldGVVc2VyUmVxdWVzdBoRLmJ5dGViYXNlLnYxLlVzZXIiLpDqMAKY6jABgtPkkwIgOgEqIhsvdjEve25hbWU9dXNlcnMvKn06dW5kZWxldGUSmQEKC1VwZGF0ZUVtYWlsEh8uYnl0ZWJhc2UudjEuVXBkYXRlRW1haWxSZXF1ZXN0GhEuYnl0ZWJhc2UudjEuVXNlciJW2kEKbmFtZSxlbWFpbIrqMBRiYi51c2Vycy51cGRhdGVFbWFpbJDqMAGY6jABgtPkkwIjOgEqIh4vdjEve25hbWU9dXNlcnMvKn06dXBkYXRlRW1haWxCpgEKD2NvbS5ieXRlYmFzZS52MUIQVXNlclNlcnZpY2VQcm90b1ABWjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxogIDQlhYqgILQnl0ZWJhc2UuVjHKAgtCeXRlYmFzZVxWMeICF0J5dGViYXNlXFYxXEdQQk1ldGFkYXRh6gIMQnl0ZWJhc2U6OlYxYgZwcm90bzM", [file_buf_validate_validate, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common]);/*** Describes the message bytebase.v1.GetUserRequest.@@ -102,39 +102,6 @@ export const UserSchema = /*@__PURE__*/export const User_ProfileSchema = /*@__PURE__*/messageDesc(file_v1_user_service, 10, 0);-/**- * Describes the message bytebase.v1.WorkloadIdentityConfig.- * Use `create(WorkloadIdentityConfigSchema)` to create a new message.- */-export const WorkloadIdentityConfigSchema = /*@__PURE__*/- messageDesc(file_v1_user_service, 11);--/**- * Describes the enum bytebase.v1.WorkloadIdentityConfig.ProviderType.- */-export const WorkloadIdentityConfig_ProviderTypeSchema = /*@__PURE__*/- enumDesc(file_v1_user_service, 11, 0);--/**- * ProviderType identifies the CI/CD platform.- *- * @generated from enum bytebase.v1.WorkloadIdentityConfig.ProviderType- */-export const WorkloadIdentityConfig_ProviderType = /*@__PURE__*/- tsEnum(WorkloadIdentityConfig_ProviderTypeSchema);--/**- * Describes the enum bytebase.v1.UserType.- */-export const UserTypeSchema = /*@__PURE__*/- enumDesc(file_v1_user_service, 0);--/**- * @generated from enum bytebase.v1.UserType- */-export const UserType = /*@__PURE__*/- tsEnum(UserTypeSchema);-/*** UserService manages user accounts and authentication.*diff --git a/frontend/src/types/proto-es/v1/workload_identity_service_pb.d.ts b/frontend/src/types/proto-es/v1/workload_identity_service_pb.d.tsindex b744164361..ebc85300ea 100644--- a/frontend/src/types/proto-es/v1/workload_identity_service_pb.d.ts+++ b/frontend/src/types/proto-es/v1/workload_identity_service_pb.d.ts@@ -2,11 +2,10 @@// @generated from file v1/workload_identity_service.proto (package bytebase.v1, syntax proto3)/* eslint-disable */-import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";+import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";import type { Message } from "@bufbuild/protobuf";import type { State } from "./common_pb";import type { EmptySchema, FieldMask, Timestamp } from "@bufbuild/protobuf/wkt";-import type { WorkloadIdentityConfig } from "./user_service_pb";/*** Describes the file v1/workload_identity_service.proto.@@ -71,6 +70,74 @@ export declare type WorkloadIdentity = Message<"bytebase.v1.WorkloadIdentity"> &*/export declare const WorkloadIdentitySchema: GenMessage<WorkloadIdentity>;+/**+ * WorkloadIdentityConfig for API layer+ *+ * @generated from message bytebase.v1.WorkloadIdentityConfig+ */+export declare type WorkloadIdentityConfig = Message<"bytebase.v1.WorkloadIdentityConfig"> & {+ /**+ * Platform type (currently only GITHUB is supported)+ *+ * @generated from field: bytebase.v1.WorkloadIdentityConfig.ProviderType provider_type = 1;+ */+ providerType: WorkloadIdentityConfig_ProviderType;++ /**+ * OIDC Issuer URL (auto-filled based on provider_type, can be overridden)+ *+ * @generated from field: string issuer_url = 2;+ */+ issuerUrl: string;++ /**+ * Allowed audiences for token validation+ *+ * @generated from field: repeated string allowed_audiences = 3;+ */+ allowedAudiences: string[];++ /**+ * Subject pattern to match (e.g., "repo:owner/repo:ref:refs/heads/main")+ *+ * @generated from field: string subject_pattern = 4;+ */+ subjectPattern: string;+};++/**+ * Describes the message bytebase.v1.WorkloadIdentityConfig.+ * Use `create(WorkloadIdentityConfigSchema)` to create a new message.+ */+export declare const WorkloadIdentityConfigSchema: GenMessage<WorkloadIdentityConfig>;++/**+ * ProviderType identifies the CI/CD platform.+ *+ * @generated from enum bytebase.v1.WorkloadIdentityConfig.ProviderType+ */+export enum WorkloadIdentityConfig_ProviderType {+ /**+ * @generated from enum value: PROVIDER_TYPE_UNSPECIFIED = 0;+ */+ PROVIDER_TYPE_UNSPECIFIED = 0,++ /**+ * @generated from enum value: GITHUB = 1;+ */+ GITHUB = 1,++ /**+ * @generated from enum value: GITLAB = 2;+ */+ GITLAB = 2,+}++/**+ * Describes the enum bytebase.v1.WorkloadIdentityConfig.ProviderType.+ */+export declare const WorkloadIdentityConfig_ProviderTypeSchema: GenEnum<WorkloadIdentityConfig_ProviderType>;+/*** Request message for creating a workload identity.*diff --git a/frontend/src/types/proto-es/v1/workload_identity_service_pb.js b/frontend/src/types/proto-es/v1/workload_identity_service_pb.jsindex 7c0df4c1ba..7b109f86d8 100644--- a/frontend/src/types/proto-es/v1/workload_identity_service_pb.js+++ b/frontend/src/types/proto-es/v1/workload_identity_service_pb.js@@ -2,7 +2,7 @@// @generated from file v1/workload_identity_service.proto (package bytebase.v1, syntax proto3)/* eslint-disable */-import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2";+import { enumDesc, fileDesc, messageDesc, serviceDesc, tsEnum } from "@bufbuild/protobuf/codegenv2";import { file_buf_validate_validate } from "../buf/validate/validate_pb";import { file_google_api_annotations } from "../google/api/annotations_pb";import { file_google_api_client } from "../google/api/client_pb";@@ -11,13 +11,12 @@ import { file_google_api_resource } from "../google/api/resource_pb";import { file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt";import { file_v1_annotation } from "./annotation_pb";import { file_v1_common } from "./common_pb";-import { file_v1_user_service } from "./user_service_pb";/*** Describes the file v1/workload_identity_service.proto.*/export const file_v1_workload_identity_service = /*@__PURE__*/- fileDesc("CiJ2MS93b3JrbG9hZF9pZGVudGl0eV9zZXJ2aWNlLnByb3RvEgtieXRlYmFzZS52MSKyAgoQV29ya2xvYWRJZGVudGl0eRIRCgRuYW1lGAEgASgJQgPgQQMSIQoFc3RhdGUYAiABKA4yEi5ieXRlYmFzZS52MS5TdGF0ZRISCgVlbWFpbBgDIAEoCUID4EEDEhcKBXRpdGxlGAQgASgJQgi6SAVyAxjIARI0CgtjcmVhdGVfdGltZRgFIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAxJFChh3b3JrbG9hZF9pZGVudGl0eV9jb25maWcYBiABKAsyIy5ieXRlYmFzZS52MS5Xb3JrbG9hZElkZW50aXR5Q29uZmlnOj7qQTsKHWJ5dGViYXNlLmNvbS9Xb3JrbG9hZElkZW50aXR5Ehp3b3JrbG9hZElkZW50aXRpZXMve2VtYWlsfSKsAQodQ3JlYXRlV29ya2xvYWRJZGVudGl0eVJlcXVlc3QSKQoGcGFyZW50GAEgASgJQhn6QRYKFGJ5dGViYXNlLmNvbS9Qcm9qZWN0EiEKFHdvcmtsb2FkX2lkZW50aXR5X2lkGAIgASgJQgPgQQISPQoRd29ya2xvYWRfaWRlbnRpdHkYAyABKAsyHS5ieXRlYmFzZS52MS5Xb3JrbG9hZElkZW50aXR5QgPgQQIiUQoaR2V0V29ya2xvYWRJZGVudGl0eVJlcXVlc3QSMwoEbmFtZRgBIAEoCUIl4EEC+kEfCh1ieXRlYmFzZS5jb20vV29ya2xvYWRJZGVudGl0eSKXAQodTGlzdFdvcmtsb2FkSWRlbnRpdGllc1JlcXVlc3QSKQoGcGFyZW50GAEgASgJQhn6QRYKFGJ5dGViYXNlLmNvbS9Qcm9qZWN0EhEKCXBhZ2Vfc2l6ZRgCIAEoBRISCgpwYWdlX3Rva2VuGAMgASgJEhQKDHNob3dfZGVsZXRlZBgEIAEoCBIOCgZmaWx0ZXIYBSABKAkidQoeTGlzdFdvcmtsb2FkSWRlbnRpdGllc1Jlc3BvbnNlEjoKE3dvcmtsb2FkX2lkZW50aXRpZXMYASADKAsyHS5ieXRlYmFzZS52MS5Xb3JrbG9hZElkZW50aXR5EhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSKPAQodVXBkYXRlV29ya2xvYWRJZGVudGl0eVJlcXVlc3QSPQoRd29ya2xvYWRfaWRlbnRpdHkYASABKAsyHS5ieXRlYmFzZS52MS5Xb3JrbG9hZElkZW50aXR5QgPgQQISLwoLdXBkYXRlX21hc2sYAiABKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRNYXNrIlQKHURlbGV0ZVdvcmtsb2FkSWRlbnRpdHlSZXF1ZXN0EjMKBG5hbWUYASABKAlCJeBBAvpBHwodYnl0ZWJhc2UuY29tL1dvcmtsb2FkSWRlbnRpdHkiVgofVW5kZWxldGVXb3JrbG9hZElkZW50aXR5UmVxdWVzdBIzCgRuYW1lGAEgASgJQiXgQQL6QR8KHWJ5dGViYXNlLmNvbS9Xb3JrbG9hZElkZW50aXR5MpULChdXb3JrbG9hZElkZW50aXR5U2VydmljZRLHAgoWQ3JlYXRlV29ya2xvYWRJZGVudGl0eRIqLmJ5dGViYXNlLnYxLkNyZWF0ZVdvcmtsb2FkSWRlbnRpdHlSZXF1ZXN0Gh0uYnl0ZWJhc2UudjEuV29ya2xvYWRJZGVudGl0eSLhAdpBLXBhcmVudCx3b3JrbG9hZF9pZGVudGl0eSx3b3JrbG9hZF9pZGVudGl0eV9pZIrqMBxiYi53b3JrbG9hZElkZW50aXRpZXMuY3JlYXRlkOowAZjqMAGC0+STAoIBOhF3b3JrbG9hZF9pZGVudGl0eVpBOhF3b3JrbG9hZF9pZGVudGl0eSIsL3YxL3twYXJlbnQ9d29ya3NwYWNlcy8qfS93b3JrbG9hZElkZW50aXRpZXMiKi92MS97cGFyZW50PXByb2plY3RzLyp9L3dvcmtsb2FkSWRlbnRpdGllcxKuAQoTR2V0V29ya2xvYWRJZGVudGl0eRInLmJ5dGViYXNlLnYxLkdldFdvcmtsb2FkSWRlbnRpdHlSZXF1ZXN0Gh0uYnl0ZWJhc2UudjEuV29ya2xvYWRJZGVudGl0eSJP2kEEbmFtZYrqMBliYi53b3JrbG9hZElkZW50aXRpZXMuZ2V0kOowAYLT5JMCIRIfL3YxL3tuYW1lPXdvcmtsb2FkSWRlbnRpdGllcy8qfRKBAgoWTGlzdFdvcmtsb2FkSWRlbnRpdGllcxIqLmJ5dGViYXNlLnYxLkxpc3RXb3JrbG9hZElkZW50aXRpZXNSZXF1ZXN0GisuYnl0ZWJhc2UudjEuTGlzdFdvcmtsb2FkSWRlbnRpdGllc1Jlc3BvbnNlIo0B2kEGcGFyZW50iuowGmJiLndvcmtsb2FkSWRlbnRpdGllcy5saXN0kOowAYLT5JMCXFouEiwvdjEve3BhcmVudD13b3Jrc3BhY2VzLyp9L3dvcmtsb2FkSWRlbnRpdGllcxIqL3YxL3twYXJlbnQ9cHJvamVjdHMvKn0vd29ya2xvYWRJZGVudGl0aWVzEvoBChZVcGRhdGVXb3JrbG9hZElkZW50aXR5EiouYnl0ZWJhc2UudjEuVXBkYXRlV29ya2xvYWRJZGVudGl0eVJlcXVlc3QaHS5ieXRlYmFzZS52MS5Xb3JrbG9hZElkZW50aXR5IpQB2kEdd29ya2xvYWRfaWRlbnRpdHksdXBkYXRlX21hc2uK6jAcYmIud29ya2xvYWRJZGVudGl0aWVzLnVwZGF0ZZDqMAGY6jABgtPkkwJGOhF3b3JrbG9hZF9pZGVudGl0eTIxL3YxL3t3b3JrbG9hZF9pZGVudGl0eS5uYW1lPXdvcmtsb2FkSWRlbnRpdGllcy8qfRK0AQoWRGVsZXRlV29ya2xvYWRJZGVudGl0eRIqLmJ5dGViYXNlLnYxLkRlbGV0ZVdvcmtsb2FkSWRlbnRpdHlSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IlbaQQRuYW1liuowHGJiLndvcmtsb2FkSWRlbnRpdGllcy5kZWxldGWQ6jABmOowAYLT5JMCISofL3YxL3tuYW1lPXdvcmtsb2FkSWRlbnRpdGllcy8qfRLGAQoYVW5kZWxldGVXb3JrbG9hZElkZW50aXR5EiwuYnl0ZWJhc2UudjEuVW5kZWxldGVXb3JrbG9hZElkZW50aXR5UmVxdWVzdBodLmJ5dGViYXNlLnYxLldvcmtsb2FkSWRlbnRpdHkiXYrqMB5iYi53b3JrbG9hZElkZW50aXRpZXMudW5kZWxldGWQ6jABmOowAYLT5JMCLToBKiIoL3YxL3tuYW1lPXdvcmtsb2FkSWRlbnRpdGllcy8qfTp1bmRlbGV0ZUKyAQoPY29tLmJ5dGViYXNlLnYxQhxXb3JrbG9hZElkZW50aXR5U2VydmljZVByb3RvUAFaNGdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvYmFja2VuZC9nZW5lcmF0ZWQtZ28vdjGiAgNCWFiqAgtCeXRlYmFzZS5WMcoCC0J5dGViYXNlXFYx4gIXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [file_buf_validate_validate, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common, file_v1_user_service]);+ fileDesc("CiJ2MS93b3JrbG9hZF9pZGVudGl0eV9zZXJ2aWNlLnByb3RvEgtieXRlYmFzZS52MSKyAgoQV29ya2xvYWRJZGVudGl0eRIRCgRuYW1lGAEgASgJQgPgQQMSIQoFc3RhdGUYAiABKA4yEi5ieXRlYmFzZS52MS5TdGF0ZRISCgVlbWFpbBgDIAEoCUID4EEDEhcKBXRpdGxlGAQgASgJQgi6SAVyAxjIARI0CgtjcmVhdGVfdGltZRgFIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAxJFChh3b3JrbG9hZF9pZGVudGl0eV9jb25maWcYBiABKAsyIy5ieXRlYmFzZS52MS5Xb3JrbG9hZElkZW50aXR5Q29uZmlnOj7qQTsKHWJ5dGViYXNlLmNvbS9Xb3JrbG9hZElkZW50aXR5Ehp3b3JrbG9hZElkZW50aXRpZXMve2VtYWlsfSLwAQoWV29ya2xvYWRJZGVudGl0eUNvbmZpZxJHCg1wcm92aWRlcl90eXBlGAEgASgOMjAuYnl0ZWJhc2UudjEuV29ya2xvYWRJZGVudGl0eUNvbmZpZy5Qcm92aWRlclR5cGUSEgoKaXNzdWVyX3VybBgCIAEoCRIZChFhbGxvd2VkX2F1ZGllbmNlcxgDIAMoCRIXCg9zdWJqZWN0X3BhdHRlcm4YBCABKAkiRQoMUHJvdmlkZXJUeXBlEh0KGVBST1ZJREVSX1RZUEVfVU5TUEVDSUZJRUQQABIKCgZHSVRIVUIQARIKCgZHSVRMQUIQAiKsAQodQ3JlYXRlV29ya2xvYWRJZGVudGl0eVJlcXVlc3QSKQoGcGFyZW50GAEgASgJQhn6QRYKFGJ5dGViYXNlLmNvbS9Qcm9qZWN0EiEKFHdvcmtsb2FkX2lkZW50aXR5X2lkGAIgASgJQgPgQQISPQoRd29ya2xvYWRfaWRlbnRpdHkYAyABKAsyHS5ieXRlYmFzZS52MS5Xb3JrbG9hZElkZW50aXR5QgPgQQIiUQoaR2V0V29ya2xvYWRJZGVudGl0eVJlcXVlc3QSMwoEbmFtZRgBIAEoCUIl4EEC+kEfCh1ieXRlYmFzZS5jb20vV29ya2xvYWRJZGVudGl0eSKXAQodTGlzdFdvcmtsb2FkSWRlbnRpdGllc1JlcXVlc3QSKQoGcGFyZW50GAEgASgJQhn6QRYKFGJ5dGViYXNlLmNvbS9Qcm9qZWN0EhEKCXBhZ2Vfc2l6ZRgCIAEoBRISCgpwYWdlX3Rva2VuGAMgASgJEhQKDHNob3dfZGVsZXRlZBgEIAEoCBIOCgZmaWx0ZXIYBSABKAkidQoeTGlzdFdvcmtsb2FkSWRlbnRpdGllc1Jlc3BvbnNlEjoKE3dvcmtsb2FkX2lkZW50aXRpZXMYASADKAsyHS5ieXRlYmFzZS52MS5Xb3JrbG9hZElkZW50aXR5EhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSKPAQodVXBkYXRlV29ya2xvYWRJZGVudGl0eVJlcXVlc3QSPQoRd29ya2xvYWRfaWRlbnRpdHkYASABKAsyHS5ieXRlYmFzZS52MS5Xb3JrbG9hZElkZW50aXR5QgPgQQISLwoLdXBkYXRlX21hc2sYAiABKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRNYXNrIlQKHURlbGV0ZVdvcmtsb2FkSWRlbnRpdHlSZXF1ZXN0EjMKBG5hbWUYASABKAlCJeBBAvpBHwodYnl0ZWJhc2UuY29tL1dvcmtsb2FkSWRlbnRpdHkiVgofVW5kZWxldGVXb3JrbG9hZElkZW50aXR5UmVxdWVzdBIzCgRuYW1lGAEgASgJQiXgQQL6QR8KHWJ5dGViYXNlLmNvbS9Xb3JrbG9hZElkZW50aXR5MpULChdXb3JrbG9hZElkZW50aXR5U2VydmljZRLHAgoWQ3JlYXRlV29ya2xvYWRJZGVudGl0eRIqLmJ5dGViYXNlLnYxLkNyZWF0ZVdvcmtsb2FkSWRlbnRpdHlSZXF1ZXN0Gh0uYnl0ZWJhc2UudjEuV29ya2xvYWRJZGVudGl0eSLhAdpBLXBhcmVudCx3b3JrbG9hZF9pZGVudGl0eSx3b3JrbG9hZF9pZGVudGl0eV9pZIrqMBxiYi53b3JrbG9hZElkZW50aXRpZXMuY3JlYXRlkOowAZjqMAGC0+STAoIBOhF3b3JrbG9hZF9pZGVudGl0eVpBOhF3b3JrbG9hZF9pZGVudGl0eSIsL3YxL3twYXJlbnQ9d29ya3NwYWNlcy8qfS93b3JrbG9hZElkZW50aXRpZXMiKi92MS97cGFyZW50PXByb2plY3RzLyp9L3dvcmtsb2FkSWRlbnRpdGllcxKuAQoTR2V0V29ya2xvYWRJZGVudGl0eRInLmJ5dGViYXNlLnYxLkdldFdvcmtsb2FkSWRlbnRpdHlSZXF1ZXN0Gh0uYnl0ZWJhc2UudjEuV29ya2xvYWRJZGVudGl0eSJP2kEEbmFtZYrqMBliYi53b3JrbG9hZElkZW50aXRpZXMuZ2V0kOowAYLT5JMCIRIfL3YxL3tuYW1lPXdvcmtsb2FkSWRlbnRpdGllcy8qfRKBAgoWTGlzdFdvcmtsb2FkSWRlbnRpdGllcxIqLmJ5dGViYXNlLnYxLkxpc3RXb3JrbG9hZElkZW50aXRpZXNSZXF1ZXN0GisuYnl0ZWJhc2UudjEuTGlzdFdvcmtsb2FkSWRlbnRpdGllc1Jlc3BvbnNlIo0B2kEGcGFyZW50iuowGmJiLndvcmtsb2FkSWRlbnRpdGllcy5saXN0kOowAYLT5JMCXFouEiwvdjEve3BhcmVudD13b3Jrc3BhY2VzLyp9L3dvcmtsb2FkSWRlbnRpdGllcxIqL3YxL3twYXJlbnQ9cHJvamVjdHMvKn0vd29ya2xvYWRJZGVudGl0aWVzEvoBChZVcGRhdGVXb3JrbG9hZElkZW50aXR5EiouYnl0ZWJhc2UudjEuVXBkYXRlV29ya2xvYWRJZGVudGl0eVJlcXVlc3QaHS5ieXRlYmFzZS52MS5Xb3JrbG9hZElkZW50aXR5IpQB2kEdd29ya2xvYWRfaWRlbnRpdHksdXBkYXRlX21hc2uK6jAcYmIud29ya2xvYWRJZGVudGl0aWVzLnVwZGF0ZZDqMAGY6jABgtPkkwJGOhF3b3JrbG9hZF9pZGVudGl0eTIxL3YxL3t3b3JrbG9hZF9pZGVudGl0eS5uYW1lPXdvcmtsb2FkSWRlbnRpdGllcy8qfRK0AQoWRGVsZXRlV29ya2xvYWRJZGVudGl0eRIqLmJ5dGViYXNlLnYxLkRlbGV0ZVdvcmtsb2FkSWRlbnRpdHlSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IlbaQQRuYW1liuowHGJiLndvcmtsb2FkSWRlbnRpdGllcy5kZWxldGWQ6jABmOowAYLT5JMCISofL3YxL3tuYW1lPXdvcmtsb2FkSWRlbnRpdGllcy8qfRLGAQoYVW5kZWxldGVXb3JrbG9hZElkZW50aXR5EiwuYnl0ZWJhc2UudjEuVW5kZWxldGVXb3JrbG9hZElkZW50aXR5UmVxdWVzdBodLmJ5dGViYXNlLnYxLldvcmtsb2FkSWRlbnRpdHkiXYrqMB5iYi53b3JrbG9hZElkZW50aXRpZXMudW5kZWxldGWQ6jABmOowAYLT5JMCLToBKiIoL3YxL3tuYW1lPXdvcmtsb2FkSWRlbnRpdGllcy8qfTp1bmRlbGV0ZUKyAQoPY29tLmJ5dGViYXNlLnYxQhxXb3JrbG9hZElkZW50aXR5U2VydmljZVByb3RvUAFaNGdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvYmFja2VuZC9nZW5lcmF0ZWQtZ28vdjGiAgNCWFiqAgtCeXRlYmFzZS5WMcoCC0J5dGViYXNlXFYx4gIXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [file_buf_validate_validate, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common]);/*** Describes the message bytebase.v1.WorkloadIdentity.@@ -26,54 +25,75 @@ export const file_v1_workload_identity_service = /*@__PURE__*/export const WorkloadIdentitySchema = /*@__PURE__*/messageDesc(file_v1_workload_identity_service, 0);+/**+ * Describes the message bytebase.v1.WorkloadIdentityConfig.+ * Use `create(WorkloadIdentityConfigSchema)` to create a new message.+ */+export const WorkloadIdentityConfigSchema = /*@__PURE__*/+ messageDesc(file_v1_workload_identity_service, 1);++/**+ * Describes the enum bytebase.v1.WorkloadIdentityConfig.ProviderType.+ */+export const WorkloadIdentityConfig_ProviderTypeSchema = /*@__PURE__*/+ enumDesc(file_v1_workload_identity_service, 1, 0);++/**+ * ProviderType identifies the CI/CD platform.+ *+ * @generated from enum bytebase.v1.WorkloadIdentityConfig.ProviderType+ */+export const WorkloadIdentityConfig_ProviderType = /*@__PURE__*/+ tsEnum(WorkloadIdentityConfig_ProviderTypeSchema);+/*** Describes the message bytebase.v1.CreateWorkloadIdentityRequest.* Use `create(CreateWorkloadIdentityRequestSchema)` to create a new message.*/export const CreateWorkloadIdentityRequestSchema = /*@__PURE__*/- messageDesc(file_v1_workload_identity_service, 1);+ messageDesc(file_v1_workload_identity_service, 2);/*** Describes the message bytebase.v1.GetWorkloadIdentityRequest.* Use `create(GetWorkloadIdentityRequestSchema)` to create a new message.*/export const GetWorkloadIdentityRequestSchema = /*@__PURE__*/- messageDesc(file_v1_workload_identity_service, 2);+ messageDesc(file_v1_workload_identity_service, 3);/*** Describes the message bytebase.v1.ListWorkloadIdentitiesRequest.* Use `create(ListWorkloadIdentitiesRequestSchema)` to create a new message.*/export const ListWorkloadIdentitiesRequestSchema = /*@__PURE__*/- messageDesc(file_v1_workload_identity_service, 3);+ messageDesc(file_v1_workload_identity_service, 4);/*** Describes the message bytebase.v1.ListWorkloadIdentitiesResponse.* Use `create(ListWorkloadIdentitiesResponseSchema)` to create a new message.*/export const ListWorkloadIdentitiesResponseSchema = /*@__PURE__*/- messageDesc(file_v1_workload_identity_service, 4);+ messageDesc(file_v1_workload_identity_service, 5);/*** Describes the message bytebase.v1.UpdateWorkloadIdentityRequest.* Use `create(UpdateWorkloadIdentityRequestSchema)` to create a new message.*/export const UpdateWorkloadIdentityRequestSchema = /*@__PURE__*/- messageDesc(file_v1_workload_identity_service, 5);+ messageDesc(file_v1_workload_identity_service, 6);/*** Describes the message bytebase.v1.DeleteWorkloadIdentityRequest.* Use `create(DeleteWorkloadIdentityRequestSchema)` to create a new message.*/export const DeleteWorkloadIdentityRequestSchema = /*@__PURE__*/- messageDesc(file_v1_workload_identity_service, 6);+ messageDesc(file_v1_workload_identity_service, 7);/*** Describes the message bytebase.v1.UndeleteWorkloadIdentityRequest.* Use `create(UndeleteWorkloadIdentityRequestSchema)` to create a new message.*/export const UndeleteWorkloadIdentityRequestSchema = /*@__PURE__*/- messageDesc(file_v1_workload_identity_service, 7);+ messageDesc(file_v1_workload_identity_service, 8);/*** WorkloadIdentityService manages workload identities for external CI/CD integrations.diff --git a/frontend/src/types/v1/user.ts b/frontend/src/types/v1/user.tsindex 26221d0939..5f8ff57db6 100644--- a/frontend/src/types/v1/user.ts+++ b/frontend/src/types/v1/user.ts@@ -8,7 +8,16 @@ import {import { UNKNOWN_ID } from "../const";import { State } from "../proto-es/v1/common_pb";import type { User } from "../proto-es/v1/user_service_pb";-import { UserSchema, UserType } from "../proto-es/v1/user_service_pb";+import { UserSchema } from "../proto-es/v1/user_service_pb";++// Local AccountType enum for UI routing/display. AccountType was removed from the+// User proto message because it is now implied by the resource table, but the+// frontend still needs to distinguish account types for UI purposes.+export enum AccountType {+ USER = 1,+ WORKLOAD_IDENTITY = 2,+ SERVICE_ACCOUNT = 3,+}export const UNKNOWN_USER_NAME = `users/${UNKNOWN_ID}`;@@ -16,7 +25,6 @@ export const unknownUser = (name: string = ""): User => {const user = create(UserSchema, {name: UNKNOWN_USER_NAME,state: State.ACTIVE,- userType: UserType.USER,title: t("common.unknown"),});if (name) {@@ -36,7 +44,6 @@ export const allUsersUser = (): User => {state: State.ACTIVE,title: t("settings.members.all-users"),email: ALL_USERS_USER_EMAIL,- userType: UserType.USER,});};@@ -92,26 +99,22 @@ export const isValidUserName = (name: string) => {);};-export const getUserTypeByEmail = (email: string): UserType => {- if (email.endsWith(serviceAccountSuffix)) {- return UserType.SERVICE_ACCOUNT;+export const getAccountTypeByFullname = (fullname: string): AccountType => {+ if (fullname.startsWith(serviceAccountNamePrefix)) {+ return AccountType.SERVICE_ACCOUNT;}- if (email.endsWith(workloadIdentitySuffix)) {- return UserType.WORKLOAD_IDENTITY;+ if (fullname.startsWith(workloadIdentityNamePrefix)) {+ return AccountType.WORKLOAD_IDENTITY;}- return UserType.USER;+ return AccountType.USER;};-// getUserTypeByFullname determines the user type by the fullname prefix.-// This is more reliable than checking email suffix, as it works for-// legacy service accounts/workload identities with non-standard email formats.-// Supported formats: serviceAccounts/{email}, workloadIdentities/{email}, users/{email}-export const getUserTypeByFullname = (fullname: string): UserType => {- if (fullname.startsWith(serviceAccountNamePrefix)) {- return UserType.SERVICE_ACCOUNT;+export const getAccountTypeByEmail = (email: string): AccountType => {+ if (email.endsWith(serviceAccountSuffix)) {+ return AccountType.SERVICE_ACCOUNT;}- if (fullname.startsWith(workloadIdentityNamePrefix)) {- return UserType.WORKLOAD_IDENTITY;+ if (email.endsWith(workloadIdentitySuffix)) {+ return AccountType.WORKLOAD_IDENTITY;}- return UserType.USER;+ return AccountType.USER;};diff --git a/frontend/src/utils/workloadIdentity.ts b/frontend/src/utils/workloadIdentity.tsindex 4499b88c06..0c525dd8fd 100644--- a/frontend/src/utils/workloadIdentity.ts+++ b/frontend/src/utils/workloadIdentity.ts@@ -1,4 +1,4 @@-import { WorkloadIdentityConfig_ProviderType } from "@/types/proto-es/v1/user_service_pb";+import { WorkloadIdentityConfig_ProviderType } from "@/types/proto-es/v1/workload_identity_service_pb";// Parse subject pattern and extract owner/repo/branch/refTypeexport const parseWorkloadIdentitySubjectPattern = (wi: {diff --git a/frontend/src/views/ProfileDashboard.vue b/frontend/src/views/ProfileDashboard.vueindex 85278e3e67..192fd61ebc 100644--- a/frontend/src/views/ProfileDashboard.vue+++ b/frontend/src/views/ProfileDashboard.vue@@ -103,7 +103,7 @@</dd></div>- <div v-if="user.userType === UserType.USER" class="sm:col-span-1">+ <div v-if="getAccountTypeByEmail(user.email) === AccountType.USER" class="sm:col-span-1"><dt class="text-sm font-medium text-control-light">{{ $t("settings.profile.phone") }}</dt>@@ -259,18 +259,16 @@ import {useWorkspaceV1Store,} from "@/store";import {+ AccountType,ALL_USERS_USER_EMAIL,- getUserTypeByEmail,+ getAccountTypeByEmail,isValidUserName,unknownUser,} from "@/types";import { State } from "@/types/proto-es/v1/common_pb";import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";import type { User } from "@/types/proto-es/v1/user_service_pb";-import {- UpdateUserRequestSchema,- UserType,-} from "@/types/proto-es/v1/user_service_pb";+import { UpdateUserRequestSchema } from "@/types/proto-es/v1/user_service_pb";import {displayRoleTitle,hasWorkspacePermissionV2,@@ -312,8 +310,8 @@ const state = reactive<LocalState>({onBeforeMount(() => {if (props.principalEmail) {- const userType = getUserTypeByEmail(props.principalEmail);- if (userType !== UserType.USER) {+ const userType = getAccountTypeByEmail(props.principalEmail);+ if (userType !== AccountType.USER) {router.replace({name: WORKSPACE_ROUTE_404,});@@ -393,7 +391,7 @@ const allowGet = computed(const allowEdit = computed(() => {if (user.value.email === ALL_USERS_USER_EMAIL ||- user.value.userType !== UserType.USER+ getAccountTypeByEmail(user.value.email) !== AccountType.USER) {return false;}diff --git a/frontend/src/views/SettingWorkspaceSubscription.vue b/frontend/src/views/SettingWorkspaceSubscription.vueindex be13a8714a..de844f6ee8 100644--- a/frontend/src/views/SettingWorkspaceSubscription.vue+++ b/frontend/src/views/SettingWorkspaceSubscription.vue@@ -162,9 +162,7 @@ import {useActuatorV1Store,useSubscriptionV1Store,} from "@/store";-import { State } from "@/types/proto-es/v1/common_pb";import { PlanType } from "@/types/proto-es/v1/subscription_service_pb";-import { UserType } from "@/types/proto-es/v1/user_service_pb";import { hasWorkspacePermissionV2 } from "@/utils";interface LocalState {@@ -189,12 +187,7 @@ const disabled = computed((): boolean => {return state.loading || !state.license;});-const activeUserCountWithoutBot = computed(() =>- actuatorStore.countUser({- state: State.ACTIVE,- userTypes: [UserType.USER],- })-);+const activeUserCountWithoutBot = computed(() => actuatorStore.activeUserCount);const userLimit = computed((): string => {if (subscriptionStore.userCountLimit === Number.MAX_VALUE) {diff --git a/frontend/src/views/SettingWorkspaceUsers.vue b/frontend/src/views/SettingWorkspaceUsers.vueindex 32b82d9ff7..7ac558ff5f 100644--- a/frontend/src/views/SettingWorkspaceUsers.vue+++ b/frontend/src/views/SettingWorkspaceUsers.vue@@ -110,7 +110,7 @@type="primary"class="capitalize":disabled="slotProps.disabled"- @click="() => handleCreateUser(UserType.USER)"+ @click="handleCreateUser"><template #icon><PlusIcon class="h-5 w-5" />@@ -292,7 +292,7 @@ import { unknownUser } from "@/types";import { State } from "@/types/proto-es/v1/common_pb";import type { Group } from "@/types/proto-es/v1/group_service_pb";import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";-import { type User, UserType } from "@/types/proto-es/v1/user_service_pb";+import { type User } from "@/types/proto-es/v1/user_service_pb";import { hasWorkspacePermissionV2 } from "@/utils";const tabList = ["USERS", "GROUPS"] as const;@@ -443,20 +443,13 @@ onMounted(async () => {});const activeUserCount = computed(() => {- return actuatorStore.countUser({- state: State.ACTIVE,- userTypes: [UserType.USER],- });+ return actuatorStore.activeUserCount;});const remainingUserCount = computed((): number => {return Math.max(0,- subscriptionV1Store.userCountLimit -- actuatorStore.countUser({- state: State.ACTIVE,- userTypes: [UserType.USER],- })+ subscriptionV1Store.userCountLimit - actuatorStore.activeUserCount);});@@ -501,10 +494,9 @@ const handleGroupRemoved = (group: Group) => {groupPagedTable.value?.removeCache(group);};-const handleCreateUser = (userType: UserType) => {+const handleCreateUser = () => {state.editingUser = {...unknownUser(),- userType,title: "",};state.showCreateUserDrawer = true;diff --git a/frontend/src/views/project/ProjectGitOpsDashboard.vue b/frontend/src/views/project/ProjectGitOpsDashboard.vueindex 9cab802cef..2455a60b9d 100644--- a/frontend/src/views/project/ProjectGitOpsDashboard.vue+++ b/frontend/src/views/project/ProjectGitOpsDashboard.vue@@ -398,11 +398,12 @@ import {useActuatorV1Store,useProjectByName,useWorkloadIdentityStore,- workloadIdentityNamePrefix,} from "@/store";import { projectNamePrefix } from "@/store/modules/v1/common";-import type { User } from "@/types/proto-es/v1/user_service_pb";-import { WorkloadIdentityConfig_ProviderType } from "@/types/proto-es/v1/user_service_pb";+import {+ type WorkloadIdentity,+ WorkloadIdentityConfig_ProviderType,+} from "@/types/proto-es/v1/workload_identity_service_pb";import {getWorkloadIdentityProviderText,parseWorkloadIdentitySubjectPattern,@@ -725,7 +726,7 @@ ${gitlabExchangeScript}- bytebase-action rollout --url=$BYTEBASE_URL --access-token=$BYTEBASE_ACCESS_TOKEN --project=$BYTEBASE_PROJECT --target-stage=environments/prod --plan=$PLAN`;});-const handleWorkloadIdentityCreated = (user: User) => {- selectedIdentityName.value = `${workloadIdentityNamePrefix}${user.email}`;+const handleWorkloadIdentityCreated = (wi: WorkloadIdentity) => {+ selectedIdentityName.value = wi.name;};</script>diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yamlindex 7e0cf2df13..1c4da4ed96 100644--- a/proto/gen/grpc-doc/openapi.yaml+++ b/proto/gen/grpc-doc/openapi.yaml@@ -2695,6 +2695,38 @@ paths:required: trueschema:type: string+ requestBody:+ content:+ application/json:+ schema:+ type: object+ allOf:+ - {}+ - oneOf:+ - type: object+ properties:+ changelog:+ type: string+ title: changelog+ description: |-+ The resource name of the changelog+ Format:+ instances/{instance}/databases/{database}/changelogs/{changelog}+ title: changelog+ required:+ - changelog+ - type: object+ properties:+ schema:+ type: string+ title: schema+ description: The target schema.+ title: schema+ required:+ - schema+ title: DiffSchemaRequest+ additionalProperties: false+ required: trueresponses:"200":description: Success@@ -5062,6 +5094,38 @@ paths:required: trueschema:type: string+ requestBody:+ content:+ application/json:+ schema:+ type: object+ allOf:+ - {}+ - oneOf:+ - type: object+ properties:+ changelog:+ type: string+ title: changelog+ description: |-+ The resource name of the changelog+ Format:+ instances/{instance}/databases/{database}/changelogs/{changelog}+ title: changelog+ required:+ - changelog+ - type: object+ properties:+ schema:+ type: string+ title: schema+ description: The target schema.+ title: schema+ required:+ - schema+ title: DiffSchemaRequest+ additionalProperties: false+ required: trueresponses:"200":description: Success@@ -15994,7 +16058,8 @@ components:type: stringtitle: reason- oneOf:- - properties:+ - type: object+ properties:expireTime:title: expire_timedescription: The expiration time of the access grant.@@ -16002,7 +16067,8 @@ components:title: expire_timerequired:- expireTime- - properties:+ - type: object+ properties:ttl:title: ttldescription: |-@@ -16127,12 +16193,11 @@ components:title: dockerdescription: Whether the Bytebase instance is running in Docker.readOnly: true- userStats:- type: array- items:- $ref: '#/components/schemas/bytebase.v1.ActuatorInfo.StatUser'- title: user_stats- description: Statistics about users in the system.+ activatedUserCount:+ type: integer+ title: activated_user_count+ format: int32+ description: The number of activated users.readOnly: trueactivatedInstanceCount:type: integer@@ -16171,25 +16236,6 @@ components:description: |-System information and configuration for the Bytebase instance.Actuator concept is similar to the Spring Boot Actuator.- bytebase.v1.ActuatorInfo.StatUser:- type: object- properties:- userType:- title: user_type- description: The type of user.- $ref: '#/components/schemas/bytebase.v1.UserType'- state:- title: state- description: The state of the user.- $ref: '#/components/schemas/bytebase.v1.State'- count:- type: integer- title: count- format: int32- description: The count of users matching this type and state.- title: StatUser- additionalProperties: false- description: User statistics by type and state.bytebase.v1.AddDataSourceRequest:type: objectproperties:@@ -16336,28 +16382,32 @@ components:bytebase.v1.Algorithm:type: objectoneOf:- - properties:+ - type: object+ properties:fullMask:title: full_mask$ref: '#/components/schemas/bytebase.v1.Algorithm.FullMask'title: full_maskrequired:- fullMask- - properties:+ - type: object+ properties:innerOuterMask:title: inner_outer_mask$ref: '#/components/schemas/bytebase.v1.Algorithm.InnerOuterMask'title: inner_outer_maskrequired:- innerOuterMask- - properties:+ - type: object+ properties:md5Mask:title: md5_mask$ref: '#/components/schemas/bytebase.v1.Algorithm.MD5Mask'title: md5_maskrequired:- md5Mask- - properties:+ - type: object+ properties:rangeMask:title: range_mask$ref: '#/components/schemas/bytebase.v1.Algorithm.RangeMask'@@ -16523,42 +16573,48 @@ components:title: type$ref: '#/components/schemas/bytebase.v1.WebhookType'- oneOf:- - properties:+ - type: object+ properties:dingtalk:title: dingtalk$ref: '#/components/schemas/bytebase.v1.AppIMSetting.DingTalk'title: dingtalkrequired:- dingtalk- - properties:+ - type: object+ properties:feishu:title: feishu$ref: '#/components/schemas/bytebase.v1.AppIMSetting.Feishu'title: feishurequired:- feishu- - properties:+ - type: object+ properties:lark:title: lark$ref: '#/components/schemas/bytebase.v1.AppIMSetting.Lark'title: larkrequired:- lark- - properties:+ - type: object+ properties:slack:title: slack$ref: '#/components/schemas/bytebase.v1.AppIMSetting.Slack'title: slackrequired:- slack- - properties:+ - type: object+ properties:teams:title: teams$ref: '#/components/schemas/bytebase.v1.AppIMSetting.Teams'title: teamsrequired:- teams- - properties:+ - type: object+ properties:wecom:title: wecom$ref: '#/components/schemas/bytebase.v1.AppIMSetting.Wecom'@@ -18367,21 +18423,24 @@ components:Extra connection parameters for the database connection.For PostgreSQL HA, this can be used to set target_session_attrs=read-write- oneOf:- - properties:+ - type: object+ properties:awsCredential:title: aws_credential$ref: '#/components/schemas/bytebase.v1.DataSource.AWSCredential'title: aws_credentialrequired:- awsCredential- - properties:+ - type: object+ properties:azureCredential:title: azure_credential$ref: '#/components/schemas/bytebase.v1.DataSource.AzureCredential'title: azure_credentialrequired:- azureCredential- - properties:+ - type: object+ properties:gcpCredential:title: gcp_credential$ref: '#/components/schemas/bytebase.v1.DataSource.GCPCredential'@@ -18537,7 +18596,8 @@ components:description: Client private key for mutual TLS authentication with Vault.writeOnly: true- oneOf:- - properties:+ - type: object+ properties:appRole:title: app_roledescription: AppRole authentication configuration.@@ -18545,7 +18605,8 @@ components:title: app_rolerequired:- appRole- - properties:+ - type: object+ properties:token:type: stringtitle: token@@ -19154,7 +19215,8 @@ components:database: instances/{instance}/databases/{database}changelog: instances/{instance}/databases/{database}/changelogs/{changelog}- oneOf:- - properties:+ - type: object+ properties:changelog:type: stringtitle: changelog@@ -19165,7 +19227,8 @@ components:title: changelogrequired:- changelog- - properties:+ - type: object+ properties:schema:type: stringtitle: schema@@ -20409,7 +20472,8 @@ components:bytebase.v1.IdentityProviderConfig:type: objectoneOf:- - properties:+ - type: object+ properties:ldapConfig:title: ldap_configdescription: LDAP protocol configuration.@@ -20417,7 +20481,8 @@ components:title: ldap_configrequired:- ldapConfig- - properties:+ - type: object+ properties:oauth2Config:title: oauth2_configdescription: OAuth2 protocol configuration.@@ -20425,7 +20490,8 @@ components:title: oauth2_configrequired:- oauth2Config- - properties:+ - type: object+ properties:oidcConfig:title: oidc_configdescription: OIDC protocol configuration.@@ -20438,7 +20504,8 @@ components:bytebase.v1.IdentityProviderContext:type: objectoneOf:- - properties:+ - type: object+ properties:oauth2Context:title: oauth2_contextdescription: OAuth2 authentication context.@@ -20446,7 +20513,8 @@ components:title: oauth2_contextrequired:- oauth2Context- - properties:+ - type: object+ properties:oidcContext:title: oidc_contextdescription: OpenID Connect authentication context.@@ -20903,7 +20971,8 @@ components:description: 'Format: users/{email}'readOnly: true- oneOf:- - properties:+ - type: object+ properties:approval:title: approvaldescription: Approval event.@@ -20911,7 +20980,8 @@ components:title: approvalrequired:- approval- - properties:+ - type: object+ properties:issueUpdate:title: issue_updatedescription: Issue update event.@@ -20919,7 +20989,8 @@ components:title: issue_updaterequired:- issueUpdate- - properties:+ - type: object+ properties:planSpecUpdate:title: plan_spec_updatedescription: Plan spec update event.@@ -22837,7 +22908,8 @@ components:title: semantic_typedescription: The semantic type of this object.- oneOf:- - properties:+ - type: object+ properties:arrayKind:title: array_kinddescription: Array schema.@@ -22845,7 +22917,8 @@ components:title: array_kindrequired:- arrayKind- - properties:+ - type: object+ properties:structKind:title: struct_kinddescription: Struct schema.@@ -23141,21 +23214,24 @@ components:title: iddescription: A UUID4 string that uniquely identifies the Spec.- oneOf:- - properties:+ - type: object+ properties:changeDatabaseConfig:title: change_database_config$ref: '#/components/schemas/bytebase.v1.Plan.ChangeDatabaseConfig'title: change_database_configrequired:- changeDatabaseConfig- - properties:+ - type: object+ properties:createDatabaseConfig:title: create_database_config$ref: '#/components/schemas/bytebase.v1.Plan.CreateDatabaseConfig'title: create_database_configrequired:- createDatabaseConfig- - properties:+ - type: object+ properties:exportDataConfig:title: export_data_config$ref: '#/components/schemas/bytebase.v1.Plan.ExportDataConfig'@@ -23216,14 +23292,16 @@ components:title: type$ref: '#/components/schemas/bytebase.v1.PlanCheckRun.Result.Type'- oneOf:- - properties:+ - type: object+ properties:sqlReviewReport:title: sql_review_report$ref: '#/components/schemas/bytebase.v1.PlanCheckRun.Result.SqlReviewReport'title: sql_review_reportrequired:- sqlReviewReport- - properties:+ - type: object+ properties:sqlSummaryReport:title: sql_summary_report$ref: '#/components/schemas/bytebase.v1.PlanCheckRun.Result.SqlSummaryReport'@@ -23433,35 +23511,40 @@ components:readOnly: true$ref: '#/components/schemas/bytebase.v1.PolicyResourceType'- oneOf:- - properties:+ - type: object+ properties:maskingExemptionPolicy:title: masking_exemption_policy$ref: '#/components/schemas/bytebase.v1.MaskingExemptionPolicy'title: masking_exemption_policyrequired:- maskingExemptionPolicy- - properties:+ - type: object+ properties:maskingRulePolicy:title: masking_rule_policy$ref: '#/components/schemas/bytebase.v1.MaskingRulePolicy'title: masking_rule_policyrequired:- maskingRulePolicy- - properties:+ - type: object+ properties:queryDataPolicy:title: query_data_policy$ref: '#/components/schemas/bytebase.v1.QueryDataPolicy'title: query_data_policyrequired:- queryDataPolicy- - properties:+ - type: object+ properties:rolloutPolicy:title: rollout_policy$ref: '#/components/schemas/bytebase.v1.RolloutPolicy'title: rollout_policyrequired:- rolloutPolicy- - properties:+ - type: object+ properties:tagPolicy:title: tag_policy$ref: '#/components/schemas/bytebase.v1.TagPolicy'@@ -23950,28 +24033,32 @@ components:title: maskeddescription: Masking reasons for each column (empty for non-masked columns).- oneOf:- - properties:+ - type: object+ properties:commandError:title: command_error$ref: '#/components/schemas/bytebase.v1.QueryResult.CommandError'title: command_errorrequired:- commandError- - properties:+ - type: object+ properties:permissionDenied:title: permission_denied$ref: '#/components/schemas/bytebase.v1.PermissionDeniedDetail'title: permission_deniedrequired:- permissionDenied- - properties:+ - type: object+ properties:postgresError:title: postgres_error$ref: '#/components/schemas/bytebase.v1.QueryResult.PostgresError'title: postgres_errorrequired:- postgresError- - properties:+ - type: object+ properties:syntaxError:title: syntax_error$ref: '#/components/schemas/bytebase.v1.QueryResult.SyntaxError'@@ -24563,14 +24650,16 @@ components:bytebase.v1.RowValue:type: objectoneOf:- - properties:+ - type: object+ properties:boolValue:type: booleantitle: bool_valuetitle: bool_valuerequired:- boolValue- - properties:+ - type: object+ properties:bytesValue:type: stringtitle: bytes_value@@ -24578,7 +24667,8 @@ components:title: bytes_valuerequired:- bytesValue- - properties:+ - type: object+ properties:doubleValue:type: numbertitle: double_value@@ -24586,7 +24676,8 @@ components:title: double_valuerequired:- doubleValue- - properties:+ - type: object+ properties:floatValue:type: numbertitle: float_value@@ -24594,7 +24685,8 @@ components:title: float_valuerequired:- floatValue- - properties:+ - type: object+ properties:int32Value:type: integertitle: int32_value@@ -24602,7 +24694,8 @@ components:title: int32_valuerequired:- int32Value- - properties:+ - type: object+ properties:int64Value:type:- integer@@ -24612,21 +24705,24 @@ components:title: int64_valuerequired:- int64Value- - properties:+ - type: object+ properties:nullValue:title: null_value$ref: '#/components/schemas/google.protobuf.NullValue'title: null_valuerequired:- nullValue- - properties:+ - type: object+ properties:stringValue:type: stringtitle: string_valuetitle: string_valuerequired:- stringValue- - properties:+ - type: object+ properties:timestampTzValue:title: timestamp_tz_valuedescription: |-@@ -24636,7 +24732,8 @@ components:title: timestamp_tz_valuerequired:- timestampTzValue- - properties:+ - type: object+ properties:timestampValue:title: timestamp_valuedescription: |-@@ -24648,14 +24745,16 @@ components:title: timestamp_valuerequired:- timestampValue- - properties:+ - type: object+ properties:uint32Value:type: integertitle: uint32_valuetitle: uint32_valuerequired:- uint32Value- - properties:+ - type: object+ properties:uint64Value:type:- integer@@ -24665,7 +24764,8 @@ components:title: uint64_valuerequired:- uint64Value- - properties:+ - type: object+ properties:valueValue:title: value_valuedescription: value_value is used for Spanner and TUPLE ARRAY MAP in Clickhouse only.@@ -24744,7 +24844,8 @@ components:bytebase.v1.SASLConfig:type: objectoneOf:- - properties:+ - type: object+ properties:krbConfig:title: krb_configdescription: Kerberos authentication configuration.@@ -24771,42 +24872,48 @@ components:description: The database engine this rule applies to.$ref: '#/components/schemas/bytebase.v1.Engine'- oneOf:- - properties:+ - type: object+ properties:commentConventionPayload:title: comment_convention_payload$ref: '#/components/schemas/bytebase.v1.SQLReviewRule.CommentConventionRulePayload'title: comment_convention_payloadrequired:- commentConventionPayload- - properties:+ - type: object+ properties:namingCasePayload:title: naming_case_payload$ref: '#/components/schemas/bytebase.v1.SQLReviewRule.NamingCaseRulePayload'title: naming_case_payloadrequired:- namingCasePayload- - properties:+ - type: object+ properties:namingPayload:title: naming_payload$ref: '#/components/schemas/bytebase.v1.SQLReviewRule.NamingRulePayload'title: naming_payloadrequired:- namingPayload- - properties:+ - type: object+ properties:numberPayload:title: number_payload$ref: '#/components/schemas/bytebase.v1.SQLReviewRule.NumberRulePayload'title: number_payloadrequired:- numberPayload- - properties:+ - type: object+ properties:stringArrayPayload:title: string_array_payload$ref: '#/components/schemas/bytebase.v1.SQLReviewRule.StringArrayRulePayload'title: string_array_payloadrequired:- stringArrayPayload- - properties:+ - type: object+ properties:stringPayload:title: string_payload$ref: '#/components/schemas/bytebase.v1.SQLReviewRule.StringRulePayload'@@ -25674,49 +25781,56 @@ components:bytebase.v1.SettingValue:type: objectoneOf:- - properties:+ - type: object+ properties:ai:title: ai$ref: '#/components/schemas/bytebase.v1.AISetting'title: airequired:- ai- - properties:+ - type: object+ properties:appIm:title: app_im$ref: '#/components/schemas/bytebase.v1.AppIMSetting'title: app_imrequired:- appIm- - properties:+ - type: object+ properties:dataClassification:title: data_classification$ref: '#/components/schemas/bytebase.v1.DataClassificationSetting'title: data_classificationrequired:- dataClassification- - properties:+ - type: object+ properties:environment:title: environment$ref: '#/components/schemas/bytebase.v1.EnvironmentSetting'title: environmentrequired:- environment- - properties:+ - type: object+ properties:semanticType:title: semantic_type$ref: '#/components/schemas/bytebase.v1.SemanticTypeSetting'title: semantic_typerequired:- semanticType- - properties:+ - type: object+ properties:workspaceApproval:title: workspace_approval$ref: '#/components/schemas/bytebase.v1.WorkspaceApprovalSetting'title: workspace_approvalrequired:- workspaceApproval- - properties:+ - type: object+ properties:workspaceProfile:title: workspace_profile$ref: '#/components/schemas/bytebase.v1.WorkspaceProfileSetting'@@ -26087,7 +26201,8 @@ components:title: classificationdescription: The data classification level for this table.- oneOf:- - properties:+ - type: object+ properties:columns:title: columnsdescription: Regular table columns.@@ -26095,7 +26210,8 @@ components:title: columnsrequired:- columns- - properties:+ - type: object+ properties:objectSchema:title: object_schemadescription: Object schema for JSON/XML columns.@@ -26397,21 +26513,24 @@ components:If there are no task runs or the task run is not scheduled, it will be empty.readOnly: true- oneOf:- - properties:+ - type: object+ properties:databaseCreate:title: database_create$ref: '#/components/schemas/bytebase.v1.Task.DatabaseCreate'title: database_createrequired:- databaseCreate- - properties:+ - type: object+ properties:databaseDataExport:title: database_data_export$ref: '#/components/schemas/bytebase.v1.Task.DatabaseDataExport'title: database_data_exportrequired:- databaseDataExport- - properties:+ - type: object+ properties:databaseUpdate:title: database_update$ref: '#/components/schemas/bytebase.v1.Task.DatabaseUpdate'@@ -26445,7 +26564,8 @@ components:bytebase.v1.Task.DatabaseUpdate:type: objectoneOf:- - properties:+ - type: object+ properties:release:type: stringtitle: release@@ -26453,7 +26573,8 @@ components:title: releaserequired:- release- - properties:+ - type: object+ properties:sheet:type: stringtitle: sheet@@ -26626,7 +26747,8 @@ components:bytebase.v1.TaskRun.SchedulerInfo.WaitingCause:type: objectoneOf:- - properties:+ - type: object+ properties:parallelTasksLimit:type: booleantitle: parallel_tasks_limit@@ -26979,7 +27101,8 @@ components:title: namedescription: 'Format: projects/{project}/plans/{plan}/rollout/stages/{stage}/tasks/{task}/taskRuns/{taskRun}/session'- oneOf:- - properties:+ - type: object+ properties:postgres:title: postgresdescription: PostgreSQL session information.@@ -27127,14 +27250,16 @@ components:description: The identity provider to test connection including uncreated.$ref: '#/components/schemas/bytebase.v1.IdentityProvider'- oneOf:- - properties:+ - type: object+ properties:oauth2Context:title: oauth2_context$ref: '#/components/schemas/bytebase.v1.OAuth2IdentityProviderTestRequestContext'title: oauth2_contextrequired:- oauth2Context- - properties:+ - type: object+ properties:oidcContext:title: oidc_contextdescription: OIDC authentication context for test connection.@@ -27952,10 +28077,6 @@ components:title: titlemaxLength: 200description: The display title or full name of the user.- userType:- title: user_type- description: The type of user account.- $ref: '#/components/schemas/bytebase.v1.UserType'password:type: stringtitle: password@@ -28004,10 +28125,6 @@ components:The groups for the user.Format: groups/{email}readOnly: true- workloadIdentityConfig:- title: workload_identity_config- description: Workload Identity configuration (only for WORKLOAD_IDENTITY type)- $ref: '#/components/schemas/bytebase.v1.WorkloadIdentityConfig'title: UseradditionalProperties: falsebytebase.v1.User.Profile:@@ -28027,14 +28144,6 @@ components:description: source means where the user comes from. For now we support Entra ID SCIM sync, so the source could be Entra ID.title: ProfileadditionalProperties: false- bytebase.v1.UserType:- type: string- title: UserType- enum:- - USER_TYPE_UNSPECIFIED- - USER- - WORKLOAD_IDENTITY- - SERVICE_ACCOUNTbytebase.v1.VCSType:type: stringtitle: VCSType@@ -28532,7 +28641,8 @@ components:google.api.expr.v1alpha1.Constant:type: objectoneOf:- - properties:+ - type: object+ properties:boolValue:type: booleantitle: bool_value@@ -28540,7 +28650,8 @@ components:title: bool_valuerequired:- boolValue- - properties:+ - type: object+ properties:bytesValue:type: stringtitle: bytes_value@@ -28549,7 +28660,8 @@ components:title: bytes_valuerequired:- bytesValue- - properties:+ - type: object+ properties:doubleValue:type: numbertitle: double_value@@ -28558,7 +28670,8 @@ components:title: double_valuerequired:- doubleValue- - properties:+ - type: object+ properties:durationValue:title: duration_valuedescription: |-@@ -28570,7 +28683,8 @@ components:title: duration_valuerequired:- durationValue- - properties:+ - type: object+ properties:int64Value:type:- integer@@ -28581,7 +28695,8 @@ components:title: int64_valuerequired:- int64Value- - properties:+ - type: object+ properties:nullValue:title: null_valuedescription: null value.@@ -28589,7 +28704,8 @@ components:title: null_valuerequired:- nullValue- - properties:+ - type: object+ properties:stringValue:type: stringtitle: string_value@@ -28597,7 +28713,8 @@ components:title: string_valuerequired:- stringValue- - properties:+ - type: object+ properties:timestampValue:title: timestamp_valuedescription: |-@@ -28609,7 +28726,8 @@ components:title: timestamp_valuerequired:- timestampValue- - properties:+ - type: object+ properties:uint64Value:type:- integer@@ -28652,7 +28770,8 @@ components:given expression tree. This is used to associate type information and otherattributes to a node in the parse tree.- oneOf:- - properties:+ - type: object+ properties:callExpr:title: call_exprdescription: A call expression, including calls to predefined functions and operators.@@ -28660,7 +28779,8 @@ components:title: call_exprrequired:- callExpr- - properties:+ - type: object+ properties:comprehensionExpr:title: comprehension_exprdescription: A comprehension expression.@@ -28668,7 +28788,8 @@ components:title: comprehension_exprrequired:- comprehensionExpr- - properties:+ - type: object+ properties:constExpr:title: const_exprdescription: A literal expression.@@ -28676,7 +28797,8 @@ components:title: const_exprrequired:- constExpr- - properties:+ - type: object+ properties:identExpr:title: ident_exprdescription: An identifier expression.@@ -28684,7 +28806,8 @@ components:title: ident_exprrequired:- identExpr- - properties:+ - type: object+ properties:listExpr:title: list_exprdescription: A list creation expression.@@ -28692,7 +28815,8 @@ components:title: list_exprrequired:- listExpr- - properties:+ - type: object+ properties:selectExpr:title: select_exprdescription: A field selection expression, e.g. `request.auth`.@@ -28700,7 +28824,8 @@ components:title: select_exprrequired:- selectExpr- - properties:+ - type: object+ properties:structExpr:title: struct_exprdescription: A map or message creation expression.@@ -28944,7 +29069,8 @@ components:title: optional_entrydescription: Whether the key-value pair is optional.- oneOf:- - properties:+ - type: object+ properties:fieldKey:type: stringtitle: field_key@@ -28952,7 +29078,8 @@ components:title: field_keyrequired:- fieldKey- - properties:+ - type: object+ properties:mapKey:title: map_keydescription: The key expression for a map creation statement.@@ -29558,12 +29685,12 @@ tags:description: IssueService manages issues for tracking database changes and tasks.- name: SettingServicedescription: SettingService manages workspace-level settings and configurations.- - name: UserService- description: UserService manages user accounts and authentication.- name: ActuatorServicedescription: ActuatorService manages system health and operational information.- name: AuditLogServicedescription: AuditLogService manages audit logs for system activities and API calls.+ - name: UserService+ description: UserService manages user accounts and authentication.- name: AuthServicedescription: AuthService handles user authentication operations.- name: CelServicediff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.mdindex bcc3c7f71a..32503bb9eb 100644--- a/proto/gen/grpc-doc/store/README.md+++ b/proto/gen/grpc-doc/store/README.md@@ -5176,7 +5176,6 @@ MFAConfig is the MFA configuration for a user.| last_login_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | || last_change_password_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | || source | [string](#string) | | The source indicates where the user comes from. For now we support Entra ID SCIM sync, so the source could be Entra ID. |-| workload_identity_config | [WorkloadIdentityConfig](#bytebase-store-WorkloadIdentityConfig) | | Workload identity configuration (only for WORKLOAD_IDENTITY type) |diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.htmlindex bb870350f2..6380bcabdb 100644--- a/proto/gen/grpc-doc/store/index.html+++ b/proto/gen/grpc-doc/store/index.html@@ -13879,13 +13879,6 @@ Example: For "SELECT 你好;" in a UTF-8 sheet, range [0, 13) represents<td><p>The source indicates where the user comes from. For now we support Entra ID SCIM sync, so the source could be Entra ID. </p></td></tr>- <tr>- <td>workload_identity_config</td>- <td><a href="#bytebase.store.WorkloadIdentityConfig">WorkloadIdentityConfig</a></td>- <td></td>- <td><p>Workload identity configuration (only for WORKLOAD_IDENTITY type) </p></td>- </tr>-</tbody></table>diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.mdindex 9dd482f955..cac83de90d 100644--- a/proto/gen/grpc-doc/v1/README.md+++ b/proto/gen/grpc-doc/v1/README.md@@ -122,29 +122,8 @@- [SettingService](#bytebase-v1-SettingService)-- [v1/user_service.proto](#v1_user_service-proto)- - [BatchGetUsersRequest](#bytebase-v1-BatchGetUsersRequest)- - [BatchGetUsersResponse](#bytebase-v1-BatchGetUsersResponse)- - [CreateUserRequest](#bytebase-v1-CreateUserRequest)- - [DeleteUserRequest](#bytebase-v1-DeleteUserRequest)- - [GetUserRequest](#bytebase-v1-GetUserRequest)- - [ListUsersRequest](#bytebase-v1-ListUsersRequest)- - [ListUsersResponse](#bytebase-v1-ListUsersResponse)- - [UndeleteUserRequest](#bytebase-v1-UndeleteUserRequest)- - [UpdateEmailRequest](#bytebase-v1-UpdateEmailRequest)- - [UpdateUserRequest](#bytebase-v1-UpdateUserRequest)- - [User](#bytebase-v1-User)- - [User.Profile](#bytebase-v1-User-Profile)- - [WorkloadIdentityConfig](#bytebase-v1-WorkloadIdentityConfig)-- - [UserType](#bytebase-v1-UserType)- - [WorkloadIdentityConfig.ProviderType](#bytebase-v1-WorkloadIdentityConfig-ProviderType)-- - [UserService](#bytebase-v1-UserService)-- [v1/actuator_service.proto](#v1_actuator_service-proto)- [ActuatorInfo](#bytebase-v1-ActuatorInfo)- - [ActuatorInfo.StatUser](#bytebase-v1-ActuatorInfo-StatUser)- [DeleteCacheRequest](#bytebase-v1-DeleteCacheRequest)- [GetActuatorInfoRequest](#bytebase-v1-GetActuatorInfoRequest)- [GetResourcePackageRequest](#bytebase-v1-GetResourcePackageRequest)@@ -177,6 +156,22 @@- [AuditLogService](#bytebase-v1-AuditLogService)+- [v1/user_service.proto](#v1_user_service-proto)+ - [BatchGetUsersRequest](#bytebase-v1-BatchGetUsersRequest)+ - [BatchGetUsersResponse](#bytebase-v1-BatchGetUsersResponse)+ - [CreateUserRequest](#bytebase-v1-CreateUserRequest)+ - [DeleteUserRequest](#bytebase-v1-DeleteUserRequest)+ - [GetUserRequest](#bytebase-v1-GetUserRequest)+ - [ListUsersRequest](#bytebase-v1-ListUsersRequest)+ - [ListUsersResponse](#bytebase-v1-ListUsersResponse)+ - [UndeleteUserRequest](#bytebase-v1-UndeleteUserRequest)+ - [UpdateEmailRequest](#bytebase-v1-UpdateEmailRequest)+ - [UpdateUserRequest](#bytebase-v1-UpdateUserRequest)+ - [User](#bytebase-v1-User)+ - [User.Profile](#bytebase-v1-User-Profile)++ - [UserService](#bytebase-v1-UserService)+- [v1/auth_service.proto](#v1_auth_service-proto)- [ExchangeTokenRequest](#bytebase-v1-ExchangeTokenRequest)- [ExchangeTokenResponse](#bytebase-v1-ExchangeTokenResponse)@@ -680,6 +675,9 @@- [UndeleteWorkloadIdentityRequest](#bytebase-v1-UndeleteWorkloadIdentityRequest)- [UpdateWorkloadIdentityRequest](#bytebase-v1-UpdateWorkloadIdentityRequest)- [WorkloadIdentity](#bytebase-v1-WorkloadIdentity)+ - [WorkloadIdentityConfig](#bytebase-v1-WorkloadIdentityConfig)++ - [WorkloadIdentityConfig.ProviderType](#bytebase-v1-WorkloadIdentityConfig-ProviderType)- [WorkloadIdentityService](#bytebase-v1-WorkloadIdentityService)@@ -2514,239 +2512,246 @@ SettingService manages workspace-level settings and configurations.-<a name="v1_user_service-proto"></a>+<a name="v1_actuator_service-proto"></a><p align="right"><a href="#top">Top</a></p>-## v1/user_service.proto-+## v1/actuator_service.proto-<a name="bytebase-v1-BatchGetUsersRequest"></a>-### BatchGetUsersRequest+<a name="bytebase-v1-ActuatorInfo"></a>+### ActuatorInfo+System information and configuration for the Bytebase instance.+Actuator concept is similar to the Spring Boot Actuator.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| names | [string](#string) | repeated | The user names to retrieve. Format: users/{email} |+| version | [string](#string) | | The Bytebase server version. |+| git_commit | [string](#string) | | The git commit hash of the build. |+| readonly | [bool](#bool) | | Whether the Bytebase instance is running in read-only mode. |+| saas | [bool](#bool) | | Whether the Bytebase instance is running in SaaS mode where some features cannot be edited by users. |+| demo | [bool](#bool) | | Whether the Bytebase instance is running in demo mode. |+| host | [string](#string) | | The host address of the Bytebase instance. |+| port | [string](#string) | | The port number of the Bytebase instance. |+| external_url | [string](#string) | | The external URL where users or webhook callbacks access Bytebase. |+| need_admin_setup | [bool](#bool) | | Whether the Bytebase instance requires initial admin setup. |+| last_active_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The last time any API call was made, refreshed on each request. |+| workspace_id | [string](#string) | | The unique identifier for the workspace. |+| unlicensed_features | [string](#string) | repeated | List of features that are not licensed. |+| docker | [bool](#bool) | | Whether the Bytebase instance is running in Docker. |+| activated_user_count | [int32](#int32) | | The number of activated users. |+| activated_instance_count | [int32](#int32) | | The number of activated database instances. |+| total_instance_count | [int32](#int32) | | The total number of database instances. |+| enable_sample | [bool](#bool) | | Whether sample data setup is enabled. |+| external_url_from_flag | [bool](#bool) | | Whether the external URL is set via command-line flag (and thus cannot be changed via UI). |+| replica_count | [int32](#int32) | | The number of active replicas (servers sharing the same database). |+| restriction | [Restriction](#bytebase-v1-Restriction) | | |-<a name="bytebase-v1-BatchGetUsersResponse"></a>+<a name="bytebase-v1-DeleteCacheRequest"></a>-### BatchGetUsersResponse+### DeleteCacheRequest+Request message for deleting cache.-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| users | [User](#bytebase-v1-User) | repeated | The users from the specified request. |+<a name="bytebase-v1-GetActuatorInfoRequest"></a>+### GetActuatorInfoRequest+Request message for getting actuator information.-<a name="bytebase-v1-CreateUserRequest"></a>-### CreateUserRequest-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| user | [User](#bytebase-v1-User) | | The user to create. |+<a name="bytebase-v1-GetResourcePackageRequest"></a>+### GetResourcePackageRequest+Request message for getting branding resources.-<a name="bytebase-v1-DeleteUserRequest"></a>-### DeleteUserRequest+<a name="bytebase-v1-ResourcePackage"></a>+### ResourcePackage+Custom branding resources for the Bytebase instance.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the user to delete. Format: users/{email} |+| logo | [bytes](#bytes) | | The branding logo. |-<a name="bytebase-v1-GetUserRequest"></a>+<a name="bytebase-v1-Restriction"></a>-### GetUserRequest+### Restriction| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the user to retrieve. Format: users/{email} |--+| disallow_signup | [bool](#bool) | | Whether self-service user signup is disabled. |+| disallow_password_signin | [bool](#bool) | | Whether password-based signin is disabled (except for workspace admins). |+| password_restriction | [WorkspaceProfileSetting.PasswordRestriction](#bytebase-v1-WorkspaceProfileSetting-PasswordRestriction) | | Password complexity and restriction requirements. |-<a name="bytebase-v1-ListUsersRequest"></a>-### ListUsersRequest+<a name="bytebase-v1-SetupSampleRequest"></a>+### SetupSampleRequest+Request message for setting up sample data.-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| page_size | [int32](#int32) | | The maximum number of users to return. The service may return fewer than this value. If unspecified, at most 10 users will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |-| page_token | [string](#string) | | 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. |-| show_deleted | [bool](#bool) | | Show deleted users if specified. |-| filter | [string](#string) | | Filter is used to filter users returned in the list. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec--Supported filter: - name: the user name, support "==" and ".matches()" operator. - email: the user email, support "==" and ".matches()" operator. - state: check State enum for values, support "==" operator. - project: the project full name in "projects/{id}" format, support "==" operator.-For example: name == "ed" name.matches("ed") email == "[email protected]" email.matches("ed") state == "DELETED" project == "projects/sample-project" You can combine filter conditions like: name.matches("ed") && project == "projects/sample-project" (name == "ed" || email == "[email protected]") && project == "projects/sample-project" |+++-<a name="bytebase-v1-ListUsersResponse"></a>-### ListUsersResponse+<a name="bytebase-v1-ActuatorService"></a>+### ActuatorService+ActuatorService manages system health and operational information.+| Method Name | Request Type | Response Type | Description |+| ----------- | ------------ | ------------- | ------------|+| GetActuatorInfo | [GetActuatorInfoRequest](#bytebase-v1-GetActuatorInfoRequest) | [ActuatorInfo](#bytebase-v1-ActuatorInfo) | Gets system information and health status of the Bytebase instance. Permissions required: None |+| SetupSample | [SetupSampleRequest](#bytebase-v1-SetupSampleRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | Sets up sample data for demonstration and testing purposes. Permissions required: bb.projects.create |+| DeleteCache | [DeleteCacheRequest](#bytebase-v1-DeleteCacheRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | Clears the system cache to force data refresh. Permissions required: None |+| GetResourcePackage | [GetResourcePackageRequest](#bytebase-v1-GetResourcePackageRequest) | [ResourcePackage](#bytebase-v1-ResourcePackage) | Gets custom branding resources such as logos. Permissions required: None |-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| users | [User](#bytebase-v1-User) | repeated | The users from the specified request. |-| next_page_token | [string](#string) | | A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |++<a name="v1_iam_policy-proto"></a>+<p align="right"><a href="#top">Top</a></p>+## v1/iam_policy.proto-<a name="bytebase-v1-UndeleteUserRequest"></a>-### UndeleteUserRequest+<a name="bytebase-v1-Binding"></a>+### Binding+Binding associates members with a role and optional conditions.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the deleted user. Format: users/{email} |+| role | [string](#string) | | The role that is assigned to the members. Format: roles/{role} |+| members | [string](#string) | repeated | Specifies the principals requesting access for a Bytebase resource. For users, the member should be: user:{email} For groups, the member should be: group:{email} For service accounts, the member should be: serviceAccount:{email} For workload identities, the member should be: workloadIdentity:{email} |+| condition | [google.type.Expr](#google-type-Expr) | | The condition that is associated with this binding, only used in the project IAM policy. If the condition evaluates to true, then this binding applies to the current request. If the condition evaluates to false, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec+Support variables: resource.database: the database full name in "instances/{instance}/databases/{database}" format, used by the "roles/sqlEditorUser" and "roles/sqlEditorReadUser" roles, support "==" operator. resource.schema_name: the schema name, used by the "roles/sqlEditorUser" and "roles/sqlEditorReadUser" roles, support "==" operator. resource.table_name: the table name, used by the "roles/sqlEditorUser" and "roles/sqlEditorReadUser" roles, support "==" operator. resource.environment_id: the environment to allow the DDL/DML operation in the SQL Editor, only works for the role with bb.sql.ddl or bb.sql.dml permissions. Support "in" operator. request.time: the expiration. Only support "<" operation in `request.time < timestamp("{ISO datetime string format}")`.+For example: resource.database == "instances/local-pg/databases/postgres" && resource.schema_name in ["public","another_schema"] resource.database == "instances/local-pg/databases/bytebase" && resource.schema_name == "public" && resource.table_name in ["audit_log"] resource.database == "instances/local-pg/databases/postgres" && resource.environment_id in ["test"] request.time < timestamp("2025-04-26T11:24:48.655Z") |+| parsed_expr | [google.api.expr.v1alpha1.Expr](#google-api-expr-v1alpha1-Expr) | | The parsed expression of the condition. |-<a name="bytebase-v1-UpdateEmailRequest"></a>-### UpdateEmailRequest+<a name="bytebase-v1-BindingDelta"></a>++### BindingDelta+A single change to a binding.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the user whose email to update. Format: users/{email} Note: This is the current (old) email address. The new email is specified in the 'email' field. |-| email | [string](#string) | | The new email address. |-+| action | [BindingDelta.Action](#bytebase-v1-BindingDelta-Action) | | The action that was performed on a Binding. |+| role | [string](#string) | | Role that is assigned to `members`. For example, `roles/projectOwner`. |+| member | [string](#string) | | Follows the same format of Binding.members. |+| condition | [google.type.Expr](#google-type-Expr) | | The condition that is associated with this binding. |-<a name="bytebase-v1-UpdateUserRequest"></a>-### UpdateUserRequest+<a name="bytebase-v1-GetIamPolicyRequest"></a>+### GetIamPolicyRequest+Request message for getting an IAM policy.| 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/{email} |-| 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. |-| allow_missing | [bool](#bool) | | If set to true, and the user is not found, a new user will be created. In this situation, `update_mask` is ignored. |-+| resource | [string](#string) | | The name of the resource to get the IAM policy. Format: projects/{project} Format: workspaces/{workspace} |-<a name="bytebase-v1-User"></a>-### User+<a name="bytebase-v1-IamPolicy"></a>+### IamPolicy+IAM policy that binds members to roles.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the user. Format: users/{email} |-| state | [State](#bytebase-v1-State) | | The lifecycle state of the user account. |-| email | [string](#string) | | The email address of the user, used for login and notifications. |-| title | [string](#string) | | The display title or full name of the user. |-| user_type | [UserType](#bytebase-v1-UserType) | | The type of user account. |-| password | [string](#string) | | The password for authentication. Only used during user creation or password updates. |-| service_key | [string](#string) | | The service key for service account authentication. Only used for service accounts. |-| mfa_enabled | [bool](#bool) | | The mfa_enabled flag means if the user has enabled MFA. |-| temp_otp_secret | [string](#string) | | Temporary OTP secret used during MFA setup and regeneration. |-| temp_recovery_codes | [string](#string) | repeated | Temporary recovery codes used during MFA setup and regeneration. |-| temp_otp_secret_created_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | Timestamp when temp_otp_secret was created. Used by frontend to show countdown timer. |-| phone | [string](#string) | | Should be a valid E.164 compliant phone number. Could be empty. |-| profile | [User.Profile](#bytebase-v1-User-Profile) | | User profile metadata. |-| groups | [string](#string) | repeated | The groups for the user. Format: groups/{email} |-| workload_identity_config | [WorkloadIdentityConfig](#bytebase-v1-WorkloadIdentityConfig) | | Workload Identity configuration (only for WORKLOAD_IDENTITY type) |+| bindings | [Binding](#bytebase-v1-Binding) | repeated | Collection of binding. A binding binds one or more project members to a single project role. |+| etag | [string](#string) | | The current etag of the policy. If an etag is provided and does not match the current etag of the policy, the call will be blocked and an ABORTED error will be returned. |-<a name="bytebase-v1-User-Profile"></a>--### User.Profile+<a name="bytebase-v1-PolicyDelta"></a>+### PolicyDelta+Describes changes between two IAM policies.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| last_login_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The last time the user successfully logged in. |-| last_change_password_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The last time the user changed their password. |-| 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. |+| binding_deltas | [BindingDelta](#bytebase-v1-BindingDelta) | repeated | The delta for Bindings between two policies. |-<a name="bytebase-v1-WorkloadIdentityConfig"></a>+<a name="bytebase-v1-SetIamPolicyRequest"></a>-### WorkloadIdentityConfig-WorkloadIdentityConfig for API layer+### SetIamPolicyRequest+Request message for setting an IAM policy.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| provider_type | [WorkloadIdentityConfig.ProviderType](#bytebase-v1-WorkloadIdentityConfig-ProviderType) | | Platform type (currently only GITHUB is supported) |-| issuer_url | [string](#string) | | OIDC Issuer URL (auto-filled based on provider_type, can be overridden) |-| allowed_audiences | [string](#string) | repeated | Allowed audiences for token validation |-| subject_pattern | [string](#string) | | Subject pattern to match (e.g., "repo:owner/repo:ref:refs/heads/main") |+| resource | [string](#string) | | The name of the resource to set the IAM policy. Format: projects/{project} Format: workspaces/{workspace} |+| policy | [IamPolicy](#bytebase-v1-IamPolicy) | | |+| etag | [string](#string) | | The current etag of the policy. |@@ -2755,476 +2760,417 @@ WorkloadIdentityConfig for API layer-<a name="bytebase-v1-UserType"></a>--### UserType---| Name | Number | Description |-| ---- | ------ | ----------- |-| USER_TYPE_UNSPECIFIED | 0 | Unspecified user type. |-| USER | 1 | Regular human user account. |-| WORKLOAD_IDENTITY | 2 | External CI/CD workload identity. |-| SERVICE_ACCOUNT | 3 | Service account for API integrations. |----<a name="bytebase-v1-WorkloadIdentityConfig-ProviderType"></a>+<a name="bytebase-v1-BindingDelta-Action"></a>-### WorkloadIdentityConfig.ProviderType-ProviderType identifies the CI/CD platform.+### BindingDelta.Action+Type of action performed on a binding.| Name | Number | Description || ---- | ------ | ----------- |-| PROVIDER_TYPE_UNSPECIFIED | 0 | |-| GITHUB | 1 | |-| GITLAB | 2 | |+| ACTION_UNSPECIFIED | 0 | Unspecified action. |+| ADD | 1 | Add a binding. |+| REMOVE | 2 | Remove a binding. |--<a name="bytebase-v1-UserService"></a>--### UserService-UserService manages user accounts and authentication.--| 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. Permissions required: bb.users.get |-| BatchGetUsers | [BatchGetUsersRequest](#bytebase-v1-BatchGetUsersRequest) | [BatchGetUsersResponse](#bytebase-v1-BatchGetUsersResponse) | Get the users in batch. Any authenticated user can batch get users. Permissions required: bb.users.get |-| GetCurrentUser | [.google.protobuf.Empty](#google-protobuf-Empty) | [User](#bytebase-v1-User) | Get the current authenticated user. Permissions required: None |-| ListUsers | [ListUsersRequest](#bytebase-v1-ListUsersRequest) | [ListUsersResponse](#bytebase-v1-ListUsersResponse) | List all users. Any authenticated user can list users. Permissions required: bb.users.list |-| CreateUser | [CreateUserRequest](#bytebase-v1-CreateUserRequest) | [User](#bytebase-v1-User) | Creates a user. When Disallow Signup is enabled, requires bb.users.create permission; otherwise any user can sign up. Permissions required: bb.users.create (only when Disallow Signup is enabled) |-| UpdateUser | [UpdateUserRequest](#bytebase-v1-UpdateUserRequest) | [User](#bytebase-v1-User) | Updates a user. Users can update their own profile, or users with bb.users.update permission can update any user. Note: Email updates are not supported through this API. Use UpdateEmail instead. Permissions required: bb.users.update (or self) |-| DeleteUser | [DeleteUserRequest](#bytebase-v1-DeleteUserRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | Deletes a user. Requires bb.users.delete permission with additional validation: the last remaining workspace admin cannot be deleted. Permissions required: bb.users.delete |-| UndeleteUser | [UndeleteUserRequest](#bytebase-v1-UndeleteUserRequest) | [User](#bytebase-v1-User) | Restores a deleted user. Permissions required: bb.users.undelete |-| UpdateEmail | [UpdateEmailRequest](#bytebase-v1-UpdateEmailRequest) | [User](#bytebase-v1-User) | Updates a user's email address. Permissions required: bb.users.updateEmail |--<a name="v1_actuator_service-proto"></a>+<a name="v1_audit_log_service-proto"></a><p align="right"><a href="#top">Top</a></p>-## v1/actuator_service.proto+## v1/audit_log_service.proto-<a name="bytebase-v1-ActuatorInfo"></a>+<a name="bytebase-v1-AuditData"></a>-### ActuatorInfo-System information and configuration for the Bytebase instance.-Actuator concept is similar to the Spring Boot Actuator.+### AuditData+Additional audit data specific to certain operations.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| version | [string](#string) | | The Bytebase server version. |-| git_commit | [string](#string) | | The git commit hash of the build. |-| readonly | [bool](#bool) | | Whether the Bytebase instance is running in read-only mode. |-| saas | [bool](#bool) | | Whether the Bytebase instance is running in SaaS mode where some features cannot be edited by users. |-| demo | [bool](#bool) | | Whether the Bytebase instance is running in demo mode. |-| host | [string](#string) | | The host address of the Bytebase instance. |-| port | [string](#string) | | The port number of the Bytebase instance. |-| external_url | [string](#string) | | The external URL where users or webhook callbacks access Bytebase. |-| need_admin_setup | [bool](#bool) | | Whether the Bytebase instance requires initial admin setup. |-| last_active_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The last time any API call was made, refreshed on each request. |-| workspace_id | [string](#string) | | The unique identifier for the workspace. |-| unlicensed_features | [string](#string) | repeated | List of features that are not licensed. |-| docker | [bool](#bool) | | Whether the Bytebase instance is running in Docker. |-| user_stats | [ActuatorInfo.StatUser](#bytebase-v1-ActuatorInfo-StatUser) | repeated | Statistics about users in the system. |-| activated_instance_count | [int32](#int32) | | The number of activated database instances. |-| total_instance_count | [int32](#int32) | | The total number of database instances. |-| enable_sample | [bool](#bool) | | Whether sample data setup is enabled. |-| external_url_from_flag | [bool](#bool) | | Whether the external URL is set via command-line flag (and thus cannot be changed via UI). |-| replica_count | [int32](#int32) | | The number of active replicas (servers sharing the same database). |-| restriction | [Restriction](#bytebase-v1-Restriction) | | |+| policy_delta | [PolicyDelta](#bytebase-v1-PolicyDelta) | | Changes to IAM policies. |-<a name="bytebase-v1-ActuatorInfo-StatUser"></a>+<a name="bytebase-v1-AuditLog"></a>-### ActuatorInfo.StatUser-User statistics by type and state.+### AuditLog+Audit log entry recording system activity or API call.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| user_type | [UserType](#bytebase-v1-UserType) | | The type of user. |-| state | [State](#bytebase-v1-State) | | The state of the user. |-| count | [int32](#int32) | | The count of users matching this type and state. |---+| name | [string](#string) | | The name of the log. Formats: - projects/{project}/auditLogs/{uid} - workspaces/{workspace}/auditLogs/{uid} |+| create_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The timestamp when the audit log was created. |+| user | [string](#string) | | The user who performed the action. Format: users/{email} |+| method | [string](#string) | | The method or action being audited. For example: /bytebase.v1.SQLService/Query or bb.project.repository.push |+| severity | [AuditLog.Severity](#bytebase-v1-AuditLog-Severity) | | The severity level of this audit log entry. |+| resource | [string](#string) | | The resource associated with this audit log. |+| request | [string](#string) | | The request payload in JSON format. |+| response | [string](#string) | | The response payload in JSON format. Some fields may be omitted if they are too large or contain sensitive information. |+| status | [google.rpc.Status](#google-rpc-Status) | | The status of the operation. |+| latency | [google.protobuf.Duration](#google-protobuf-Duration) | | The duration of the operation. |+| service_data | [google.protobuf.Any](#google-protobuf-Any) | | Service-specific metadata about the request, response, and activities. |+| request_metadata | [RequestMetadata](#bytebase-v1-RequestMetadata) | | Metadata about the request context. |-<a name="bytebase-v1-DeleteCacheRequest"></a>-### DeleteCacheRequest-Request message for deleting cache.+<a name="bytebase-v1-ExportAuditLogsRequest"></a>+### ExportAuditLogsRequest+Request message for exporting audit logs.+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| parent | [string](#string) | | |+| filter | [string](#string) | | The filter of the log. It should be a valid CEL expression. Check the filter field in the SearchAuditLogsRequest message. |+| order_by | [string](#string) | | The order by of the log. Only support order by create_time. The default sorting order is ascending. For example: - order_by = "create_time asc" - order_by = "create_time desc" |+| format | [ExportFormat](#bytebase-v1-ExportFormat) | | The export format. |+| page_size | [int32](#int32) | | The maximum number of logs to return. The service may return fewer than this value. If unspecified, at most 10 log entries will be returned. The maximum value is 5000; values above 5000 will be coerced to 5000. |+| page_token | [string](#string) | | A page token, received from a previous `ExportAuditLogs` call. Provide this to retrieve the subsequent page. |-<a name="bytebase-v1-GetActuatorInfoRequest"></a>-### GetActuatorInfoRequest-Request message for getting actuator information.+<a name="bytebase-v1-ExportAuditLogsResponse"></a>+### ExportAuditLogsResponse+Response message for exporting audit logs.-<a name="bytebase-v1-GetResourcePackageRequest"></a>-### GetResourcePackageRequest-Request message for getting branding resources.+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| content | [bytes](#bytes) | | The exported audit log content in the requested format. |+| next_page_token | [string](#string) | | A token to retrieve next page of log entities. Pass this value in the page_token field in the subsequent call to retrieve the next page of log entities. |-<a name="bytebase-v1-ResourcePackage"></a>+<a name="bytebase-v1-RequestMetadata"></a>-### ResourcePackage-Custom branding resources for the Bytebase instance.+### RequestMetadata+Metadata about the incoming request.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| logo | [bytes](#bytes) | | The branding logo. |+| caller_ip | [string](#string) | | The IP address of the request originator. |+| caller_supplied_user_agent | [string](#string) | | The user agent string provided by the caller. This is supplied by the client and is not authenticated. |-<a name="bytebase-v1-Restriction"></a>--### Restriction+<a name="bytebase-v1-SearchAuditLogsRequest"></a>+### SearchAuditLogsRequest+Request message for searching audit logs.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| disallow_signup | [bool](#bool) | | Whether self-service user signup is disabled. |-| disallow_password_signin | [bool](#bool) | | Whether password-based signin is disabled (except for workspace admins). |-| password_restriction | [WorkspaceProfileSetting.PasswordRestriction](#bytebase-v1-WorkspaceProfileSetting-PasswordRestriction) | | Password complexity and restriction requirements. |---+| parent | [string](#string) | | |+| filter | [string](#string) | | The filter of the log. It should be a valid CEL expression. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec+Supported filter: - method: the API name, can be found in the docs, should start with "/bytebase.v1." prefix. For example "/bytebase.v1.UserService/CreateUser". Support "==" operator. - severity: support "==" operator, check Severity enum in AuditLog message for values. - user: the actor, should in "users/{email}" format, support "==" operator. - create_time: support ">=" and "<=" operator.+For example: - filter = "method == '/bytebase.v1.SQLService/Query'" - filter = "method == '/bytebase.v1.SQLService/Query' && severity == 'ERROR'" - filter = "method == '/bytebase.v1.SQLService/Query' && severity == 'ERROR' && user == 'users/[email protected]'" - filter = "method == '/bytebase.v1.SQLService/Query' && severity == 'ERROR' && create_time <= '2021-01-01T00:00:00Z' && create_time >= '2020-01-01T00:00:00Z'" |+| order_by | [string](#string) | | The order by of the log. Only support order by create_time. The default sorting order is ascending. For example: - order_by = "create_time asc" - order_by = "create_time desc" |+| page_size | [int32](#int32) | | The maximum number of logs to return. The service may return fewer than this value. If unspecified, at most 10 log entries will be returned. The maximum value is 5000; values above 5000 will be coerced to 5000. |+| page_token | [string](#string) | | A page token, received from a previous `SearchLogs` call. Provide this to retrieve the subsequent page. |-<a name="bytebase-v1-SetupSampleRequest"></a>-### SetupSampleRequest-Request message for setting up sample data.+<a name="bytebase-v1-SearchAuditLogsResponse"></a>-+### SearchAuditLogsResponse+Response message for searching audit logs.--+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| audit_logs | [AuditLog](#bytebase-v1-AuditLog) | repeated | |+| next_page_token | [string](#string) | | A token to retrieve next page of log entities. Pass this value in the page_token field in the subsequent call to retrieve the next page of log entities. |-<a name="bytebase-v1-ActuatorService"></a>-### ActuatorService-ActuatorService manages system health and operational information.-| Method Name | Request Type | Response Type | Description |-| ----------- | ------------ | ------------- | ------------|-| GetActuatorInfo | [GetActuatorInfoRequest](#bytebase-v1-GetActuatorInfoRequest) | [ActuatorInfo](#bytebase-v1-ActuatorInfo) | Gets system information and health status of the Bytebase instance. Permissions required: None |-| SetupSample | [SetupSampleRequest](#bytebase-v1-SetupSampleRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | Sets up sample data for demonstration and testing purposes. Permissions required: bb.projects.create |-| DeleteCache | [DeleteCacheRequest](#bytebase-v1-DeleteCacheRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | Clears the system cache to force data refresh. Permissions required: None |-| GetResourcePackage | [GetResourcePackageRequest](#bytebase-v1-GetResourcePackageRequest) | [ResourcePackage](#bytebase-v1-ResourcePackage) | Gets custom branding resources such as logos. Permissions required: None |+<a name="bytebase-v1-AuditLog-Severity"></a>-<a name="v1_iam_policy-proto"></a>-<p align="right"><a href="#top">Top</a></p>--## v1/iam_policy.proto----<a name="bytebase-v1-Binding"></a>--### Binding-Binding associates members with a role and optional conditions.---| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| role | [string](#string) | | The role that is assigned to the members. Format: roles/{role} |-| members | [string](#string) | repeated | Specifies the principals requesting access for a Bytebase resource. For users, the member should be: user:{email} For groups, the member should be: group:{email} For service accounts, the member should be: serviceAccount:{email} For workload identities, the member should be: workloadIdentity:{email} |-| condition | [google.type.Expr](#google-type-Expr) | | The condition that is associated with this binding, only used in the project IAM policy. If the condition evaluates to true, then this binding applies to the current request. If the condition evaluates to false, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec+### AuditLog.Severity+Severity level for audit log entries.-Support variables: resource.database: the database full name in "instances/{instance}/databases/{database}" format, used by the "roles/sqlEditorUser" and "roles/sqlEditorReadUser" roles, support "==" operator. resource.schema_name: the schema name, used by the "roles/sqlEditorUser" and "roles/sqlEditorReadUser" roles, support "==" operator. resource.table_name: the table name, used by the "roles/sqlEditorUser" and "roles/sqlEditorReadUser" roles, support "==" operator. resource.environment_id: the environment to allow the DDL/DML operation in the SQL Editor, only works for the role with bb.sql.ddl or bb.sql.dml permissions. Support "in" operator. request.time: the expiration. Only support "<" operation in `request.time < timestamp("{ISO datetime string format}")`.+| Name | Number | Description |+| ---- | ------ | ----------- |+| SEVERITY_UNSPECIFIED | 0 | Unspecified severity level. |+| DEBUG | 1 | Debug-level information. |+| INFO | 2 | Informational messages. |+| NOTICE | 3 | Notable events. |+| WARNING | 4 | Warning conditions. |+| ERROR | 5 | Error conditions. |+| CRITICAL | 6 | Critical conditions. |+| ALERT | 7 | Action must be taken immediately. |+| EMERGENCY | 8 | System is unusable. |-For example: resource.database == "instances/local-pg/databases/postgres" && resource.schema_name in ["public","another_schema"] resource.database == "instances/local-pg/databases/bytebase" && resource.schema_name == "public" && resource.table_name in ["audit_log"] resource.database == "instances/local-pg/databases/postgres" && resource.environment_id in ["test"] request.time < timestamp("2025-04-26T11:24:48.655Z") |-| parsed_expr | [google.api.expr.v1alpha1.Expr](#google-api-expr-v1alpha1-Expr) | | The parsed expression of the condition. |+++<a name="bytebase-v1-AuditLogService"></a>+### AuditLogService+AuditLogService manages audit logs for system activities and API calls.-<a name="bytebase-v1-BindingDelta"></a>+| Method Name | Request Type | Response Type | Description |+| ----------- | ------------ | ------------- | ------------|+| SearchAuditLogs | [SearchAuditLogsRequest](#bytebase-v1-SearchAuditLogsRequest) | [SearchAuditLogsResponse](#bytebase-v1-SearchAuditLogsResponse) | Searches audit logs with optional filtering and pagination. Permissions required: bb.auditLogs.search |+| ExportAuditLogs | [ExportAuditLogsRequest](#bytebase-v1-ExportAuditLogsRequest) | [ExportAuditLogsResponse](#bytebase-v1-ExportAuditLogsResponse) | Exports audit logs in a specified format for external analysis. Permissions required: bb.auditLogs.export |-### BindingDelta-A single change to a binding.+-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| action | [BindingDelta.Action](#bytebase-v1-BindingDelta-Action) | | The action that was performed on a Binding. |-| role | [string](#string) | | Role that is assigned to `members`. For example, `roles/projectOwner`. |-| member | [string](#string) | | Follows the same format of Binding.members. |-| condition | [google.type.Expr](#google-type-Expr) | | The condition that is associated with this binding. |+<a name="v1_user_service-proto"></a>+<p align="right"><a href="#top">Top</a></p>+## v1/user_service.proto+<a name="bytebase-v1-BatchGetUsersRequest"></a>-<a name="bytebase-v1-GetIamPolicyRequest"></a>+### BatchGetUsersRequest-### GetIamPolicyRequest-Request message for getting an IAM policy.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| resource | [string](#string) | | The name of the resource to get the IAM policy. Format: projects/{project} Format: workspaces/{workspace} |+| names | [string](#string) | repeated | The user names to retrieve. Format: users/{email} |-<a name="bytebase-v1-IamPolicy"></a>+<a name="bytebase-v1-BatchGetUsersResponse"></a>++### BatchGetUsersResponse-### IamPolicy-IAM policy that binds members to roles.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| bindings | [Binding](#bytebase-v1-Binding) | repeated | Collection of binding. A binding binds one or more project members to a single project role. |-| etag | [string](#string) | | The current etag of the policy. If an etag is provided and does not match the current etag of the policy, the call will be blocked and an ABORTED error will be returned. |+| users | [User](#bytebase-v1-User) | repeated | The users from the specified request. |-<a name="bytebase-v1-PolicyDelta"></a>+<a name="bytebase-v1-CreateUserRequest"></a>++### CreateUserRequest-### PolicyDelta-Describes changes between two IAM policies.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| binding_deltas | [BindingDelta](#bytebase-v1-BindingDelta) | repeated | The delta for Bindings between two policies. |+| user | [User](#bytebase-v1-User) | | The user to create. |-<a name="bytebase-v1-SetIamPolicyRequest"></a>+<a name="bytebase-v1-DeleteUserRequest"></a>++### DeleteUserRequest-### SetIamPolicyRequest-Request message for setting an IAM policy.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| resource | [string](#string) | | The name of the resource to set the IAM policy. Format: projects/{project} Format: workspaces/{workspace} |-| policy | [IamPolicy](#bytebase-v1-IamPolicy) | | |-| etag | [string](#string) | | The current etag of the policy. |+| name | [string](#string) | | The name of the user to delete. Format: users/{email} |-+<a name="bytebase-v1-GetUserRequest"></a>-<a name="bytebase-v1-BindingDelta-Action"></a>+### GetUserRequest-### BindingDelta.Action-Type of action performed on a binding.-| Name | Number | Description |-| ---- | ------ | ----------- |-| ACTION_UNSPECIFIED | 0 | Unspecified action. |-| ADD | 1 | Add a binding. |-| REMOVE | 2 | Remove a binding. |+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| name | [string](#string) | | The name of the user to retrieve. Format: users/{email} |----<a name="v1_audit_log_service-proto"></a>-<p align="right"><a href="#top">Top</a></p>+<a name="bytebase-v1-ListUsersRequest"></a>-## v1/audit_log_service.proto+### ListUsersRequest-<a name="bytebase-v1-AuditData"></a>+| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| page_size | [int32](#int32) | | The maximum number of users to return. The service may return fewer than this value. If unspecified, at most 10 users will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |+| page_token | [string](#string) | | A page token, received from a previous `ListUsers` call. Provide this to retrieve the subsequent page.-### AuditData-Additional audit data specific to certain operations.+When paginating, all other parameters provided to `ListUsers` must match the call that provided the page token. |+| show_deleted | [bool](#bool) | | Show deleted users if specified. |+| filter | [string](#string) | | Filter is used to filter users returned in the list. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec+Supported filter: - name: the user name, support "==" and ".matches()" operator. - email: the user email, support "==" and ".matches()" operator. - state: check State enum for values, support "==" operator. - project: the project full name in "projects/{id}" format, support "==" operator.-| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| policy_delta | [PolicyDelta](#bytebase-v1-PolicyDelta) | | Changes to IAM policies. |+For example: name == "ed" name.matches("ed") email == "[email protected]" email.matches("ed") state == "DELETED" project == "projects/sample-project" You can combine filter conditions like: name.matches("ed") && project == "projects/sample-project" (name == "ed" || email == "[email protected]") && project == "projects/sample-project" |-<a name="bytebase-v1-AuditLog"></a>+<a name="bytebase-v1-ListUsersResponse"></a>++### ListUsersResponse-### AuditLog-Audit log entry recording system activity or API call.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the log. Formats: - projects/{project}/auditLogs/{uid} - workspaces/{workspace}/auditLogs/{uid} |-| create_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The timestamp when the audit log was created. |-| user | [string](#string) | | The user who performed the action. Format: users/{email} |-| method | [string](#string) | | The method or action being audited. For example: /bytebase.v1.SQLService/Query or bb.project.repository.push |-| severity | [AuditLog.Severity](#bytebase-v1-AuditLog-Severity) | | The severity level of this audit log entry. |-| resource | [string](#string) | | The resource associated with this audit log. |-| request | [string](#string) | | The request payload in JSON format. |-| response | [string](#string) | | The response payload in JSON format. Some fields may be omitted if they are too large or contain sensitive information. |-| status | [google.rpc.Status](#google-rpc-Status) | | The status of the operation. |-| latency | [google.protobuf.Duration](#google-protobuf-Duration) | | The duration of the operation. |-| service_data | [google.protobuf.Any](#google-protobuf-Any) | | Service-specific metadata about the request, response, and activities. |-| request_metadata | [RequestMetadata](#bytebase-v1-RequestMetadata) | | Metadata about the request context. |+| users | [User](#bytebase-v1-User) | repeated | The users from the specified request. |+| next_page_token | [string](#string) | | A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |-<a name="bytebase-v1-ExportAuditLogsRequest"></a>+<a name="bytebase-v1-UndeleteUserRequest"></a>++### UndeleteUserRequest-### ExportAuditLogsRequest-Request message for exporting audit logs.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| parent | [string](#string) | | |-| filter | [string](#string) | | The filter of the log. It should be a valid CEL expression. Check the filter field in the SearchAuditLogsRequest message. |-| order_by | [string](#string) | | The order by of the log. Only support order by create_time. The default sorting order is ascending. For example: - order_by = "create_time asc" - order_by = "create_time desc" |-| format | [ExportFormat](#bytebase-v1-ExportFormat) | | The export format. |-| page_size | [int32](#int32) | | The maximum number of logs to return. The service may return fewer than this value. If unspecified, at most 10 log entries will be returned. The maximum value is 5000; values above 5000 will be coerced to 5000. |-| page_token | [string](#string) | | A page token, received from a previous `ExportAuditLogs` call. Provide this to retrieve the subsequent page. |+| name | [string](#string) | | The name of the deleted user. Format: users/{email} |-<a name="bytebase-v1-ExportAuditLogsResponse"></a>+<a name="bytebase-v1-UpdateEmailRequest"></a>++### UpdateEmailRequest-### ExportAuditLogsResponse-Response message for exporting audit logs.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| content | [bytes](#bytes) | | The exported audit log content in the requested format. |-| next_page_token | [string](#string) | | A token to retrieve next page of log entities. Pass this value in the page_token field in the subsequent call to retrieve the next page of log entities. |+| name | [string](#string) | | The name of the user whose email to update. Format: users/{email} Note: This is the current (old) email address. The new email is specified in the 'email' field. |+| email | [string](#string) | | The new email address. |-<a name="bytebase-v1-RequestMetadata"></a>+<a name="bytebase-v1-UpdateUserRequest"></a>++### UpdateUserRequest-### RequestMetadata-Metadata about the incoming request.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| caller_ip | [string](#string) | | The IP address of the request originator. |-| caller_supplied_user_agent | [string](#string) | | The user agent string provided by the caller. This is supplied by the client and is not authenticated. |+| user | [User](#bytebase-v1-User) | | The user to update.+The user's `name` field is used to identify the user to update. Format: users/{email} |+| 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. |+| allow_missing | [bool](#bool) | | If set to true, and the user is not found, a new user will be created. In this situation, `update_mask` is ignored. |-<a name="bytebase-v1-SearchAuditLogsRequest"></a>-### SearchAuditLogsRequest-Request message for searching audit logs.+<a name="bytebase-v1-User"></a>++### User+| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| parent | [string](#string) | | |-| filter | [string](#string) | | The filter of the log. It should be a valid CEL expression. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec--Supported filter: - method: the API name, can be found in the docs, should start with "/bytebase.v1." prefix. For example "/bytebase.v1.UserService/CreateUser". Support "==" operator. - severity: support "==" operator, check Severity enum in AuditLog message for values. - user: the actor, should in "users/{email}" format, support "==" operator. - create_time: support ">=" and "<=" operator.+| name | [string](#string) | | The name of the user. Format: users/{email} |+| state | [State](#bytebase-v1-State) | | The lifecycle state of the user account. |+| email | [string](#string) | | The email address of the user, used for login and notifications. |+| title | [string](#string) | | The display title or full name of the user. |+| password | [string](#string) | | The password for authentication. Only used during user creation or password updates. |+| service_key | [string](#string) | | The service key for service account authentication. Only used for service accounts. |+| mfa_enabled | [bool](#bool) | | The mfa_enabled flag means if the user has enabled MFA. |+| temp_otp_secret | [string](#string) | | Temporary OTP secret used during MFA setup and regeneration. |+| temp_recovery_codes | [string](#string) | repeated | Temporary recovery codes used during MFA setup and regeneration. |+| temp_otp_secret_created_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | Timestamp when temp_otp_secret was created. Used by frontend to show countdown timer. |+| phone | [string](#string) | | Should be a valid E.164 compliant phone number. Could be empty. |+| profile | [User.Profile](#bytebase-v1-User-Profile) | | User profile metadata. |+| groups | [string](#string) | repeated | The groups for the user. Format: groups/{email} |-For example: - filter = "method == '/bytebase.v1.SQLService/Query'" - filter = "method == '/bytebase.v1.SQLService/Query' && severity == 'ERROR'" - filter = "method == '/bytebase.v1.SQLService/Query' && severity == 'ERROR' && user == 'users/[email protected]'" - filter = "method == '/bytebase.v1.SQLService/Query' && severity == 'ERROR' && create_time <= '2021-01-01T00:00:00Z' && create_time >= '2020-01-01T00:00:00Z'" |-| order_by | [string](#string) | | The order by of the log. Only support order by create_time. The default sorting order is ascending. For example: - order_by = "create_time asc" - order_by = "create_time desc" |-| page_size | [int32](#int32) | | The maximum number of logs to return. The service may return fewer than this value. If unspecified, at most 10 log entries will be returned. The maximum value is 5000; values above 5000 will be coerced to 5000. |-| page_token | [string](#string) | | A page token, received from a previous `SearchLogs` call. Provide this to retrieve the subsequent page. |+<a name="bytebase-v1-User-Profile"></a>-<a name="bytebase-v1-SearchAuditLogsResponse"></a>+### User.Profile-### SearchAuditLogsResponse-Response message for searching audit logs.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| audit_logs | [AuditLog](#bytebase-v1-AuditLog) | repeated | |-| next_page_token | [string](#string) | | A token to retrieve next page of log entities. Pass this value in the page_token field in the subsequent call to retrieve the next page of log entities. |+| last_login_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The last time the user successfully logged in. |+| last_change_password_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The last time the user changed their password. |+| 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. |@@ -3232,39 +3178,27 @@ Response message for searching audit logs.--<a name="bytebase-v1-AuditLog-Severity"></a>--### AuditLog.Severity-Severity level for audit log entries.--| Name | Number | Description |-| ---- | ------ | ----------- |-| SEVERITY_UNSPECIFIED | 0 | Unspecified severity level. |-| DEBUG | 1 | Debug-level information. |-| INFO | 2 | Informational messages. |-| NOTICE | 3 | Notable events. |-| WARNING | 4 | Warning conditions. |-| ERROR | 5 | Error conditions. |-| CRITICAL | 6 | Critical conditions. |-| ALERT | 7 | Action must be taken immediately. |-| EMERGENCY | 8 | System is unusable. |---<a name="bytebase-v1-AuditLogService"></a>+<a name="bytebase-v1-UserService"></a>-### AuditLogService-AuditLogService manages audit logs for system activities and API calls.+### UserService+UserService manages user accounts and authentication.| Method Name | Request Type | Response Type | Description || ----------- | ------------ | ------------- | ------------|-| SearchAuditLogs | [SearchAuditLogsRequest](#bytebase-v1-SearchAuditLogsRequest) | [SearchAuditLogsResponse](#bytebase-v1-SearchAuditLogsResponse) | Searches audit logs with optional filtering and pagination. Permissions required: bb.auditLogs.search |-| ExportAuditLogs | [ExportAuditLogsRequest](#bytebase-v1-ExportAuditLogsRequest) | [ExportAuditLogsResponse](#bytebase-v1-ExportAuditLogsResponse) | Exports audit logs in a specified format for external analysis. Permissions required: bb.auditLogs.export |+| GetUser | [GetUserRequest](#bytebase-v1-GetUserRequest) | [User](#bytebase-v1-User) | Get the user. Any authenticated user can get the user. Permissions required: bb.users.get |+| BatchGetUsers | [BatchGetUsersRequest](#bytebase-v1-BatchGetUsersRequest) | [BatchGetUsersResponse](#bytebase-v1-BatchGetUsersResponse) | Get the users in batch. Any authenticated user can batch get users. Permissions required: bb.users.get |+| GetCurrentUser | [.google.protobuf.Empty](#google-protobuf-Empty) | [User](#bytebase-v1-User) | Get the current authenticated user. Permissions required: None |+| ListUsers | [ListUsersRequest](#bytebase-v1-ListUsersRequest) | [ListUsersResponse](#bytebase-v1-ListUsersResponse) | List all users. Any authenticated user can list users. Permissions required: bb.users.list |+| CreateUser | [CreateUserRequest](#bytebase-v1-CreateUserRequest) | [User](#bytebase-v1-User) | Creates a user. When Disallow Signup is enabled, requires bb.users.create permission; otherwise any user can sign up. Permissions required: bb.users.create (only when Disallow Signup is enabled) |+| UpdateUser | [UpdateUserRequest](#bytebase-v1-UpdateUserRequest) | [User](#bytebase-v1-User) | Updates a user. Users can update their own profile, or users with bb.users.update permission can update any user. Note: Email updates are not supported through this API. Use UpdateEmail instead. Permissions required: bb.users.update (or self) |+| DeleteUser | [DeleteUserRequest](#bytebase-v1-DeleteUserRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | Deletes a user. Requires bb.users.delete permission with additional validation: the last remaining workspace admin cannot be deleted. Permissions required: bb.users.delete |+| UndeleteUser | [UndeleteUserRequest](#bytebase-v1-UndeleteUserRequest) | [User](#bytebase-v1-User) | Restores a deleted user. Permissions required: bb.users.undelete |+| UpdateEmail | [UpdateEmailRequest](#bytebase-v1-UpdateEmailRequest) | [User](#bytebase-v1-User) | Updates a user's email address. Permissions required: bb.users.updateEmail |@@ -11029,8 +10963,39 @@ WorkloadIdentity represents an external CI/CD workload identity.++<a name="bytebase-v1-WorkloadIdentityConfig"></a>++### WorkloadIdentityConfig+WorkloadIdentityConfig for API layer+++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| provider_type | [WorkloadIdentityConfig.ProviderType](#bytebase-v1-WorkloadIdentityConfig-ProviderType) | | Platform type (currently only GITHUB is supported) |+| issuer_url | [string](#string) | | OIDC Issuer URL (auto-filled based on provider_type, can be overridden) |+| allowed_audiences | [string](#string) | repeated | Allowed audiences for token validation |+| subject_pattern | [string](#string) | | Subject pattern to match (e.g., "repo:owner/repo:ref:refs/heads/main") |+++++++<a name="bytebase-v1-WorkloadIdentityConfig-ProviderType"></a>++### WorkloadIdentityConfig.ProviderType+ProviderType identifies the CI/CD platform.++| Name | Number | Description |+| ---- | ------ | ----------- |+| PROVIDER_TYPE_UNSPECIFIED | 0 | |+| GITHUB | 1 | |+| GITLAB | 2 | |++diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.htmlindex 4df4b9ecbc..a5f0b494e4 100644--- a/proto/gen/grpc-doc/v1/index.html+++ b/proto/gen/grpc-doc/v1/index.html@@ -634,121 +634,128 @@<li>- <a href="#v1%2fuser_service.proto">v1/user_service.proto</a>+ <a href="#v1%2factuator_service.proto">v1/actuator_service.proto</a><ul><li>- <a href="#bytebase.v1.BatchGetUsersRequest"><span class="badge">M</span>BatchGetUsersRequest</a>+ <a href="#bytebase.v1.ActuatorInfo"><span class="badge">M</span>ActuatorInfo</a></li><li>- <a href="#bytebase.v1.BatchGetUsersResponse"><span class="badge">M</span>BatchGetUsersResponse</a>+ <a href="#bytebase.v1.DeleteCacheRequest"><span class="badge">M</span>DeleteCacheRequest</a></li><li>- <a href="#bytebase.v1.CreateUserRequest"><span class="badge">M</span>CreateUserRequest</a>+ <a href="#bytebase.v1.GetActuatorInfoRequest"><span class="badge">M</span>GetActuatorInfoRequest</a></li><li>- <a href="#bytebase.v1.DeleteUserRequest"><span class="badge">M</span>DeleteUserRequest</a>+ <a href="#bytebase.v1.GetResourcePackageRequest"><span class="badge">M</span>GetResourcePackageRequest</a></li><li>- <a href="#bytebase.v1.GetUserRequest"><span class="badge">M</span>GetUserRequest</a>+ <a href="#bytebase.v1.ResourcePackage"><span class="badge">M</span>ResourcePackage</a></li><li>- <a href="#bytebase.v1.ListUsersRequest"><span class="badge">M</span>ListUsersRequest</a>+ <a href="#bytebase.v1.Restriction"><span class="badge">M</span>Restriction</a></li><li>- <a href="#bytebase.v1.ListUsersResponse"><span class="badge">M</span>ListUsersResponse</a>+ <a href="#bytebase.v1.SetupSampleRequest"><span class="badge">M</span>SetupSampleRequest</a></li>- <li>- <a href="#bytebase.v1.UndeleteUserRequest"><span class="badge">M</span>UndeleteUserRequest</a>- </li>++<li>- <a href="#bytebase.v1.UpdateEmailRequest"><span class="badge">M</span>UpdateEmailRequest</a>+ <a href="#bytebase.v1.ActuatorService"><span class="badge">S</span>ActuatorService</a></li>+ </ul>+ </li>+++ <li>+ <a href="#v1%2fiam_policy.proto">v1/iam_policy.proto</a>+ <ul>+<li>- <a href="#bytebase.v1.UpdateUserRequest"><span class="badge">M</span>UpdateUserRequest</a>+ <a href="#bytebase.v1.Binding"><span class="badge">M</span>Binding</a></li><li>- <a href="#bytebase.v1.User"><span class="badge">M</span>User</a>+ <a href="#bytebase.v1.BindingDelta"><span class="badge">M</span>BindingDelta</a></li><li>- <a href="#bytebase.v1.User.Profile"><span class="badge">M</span>User.Profile</a>+ <a href="#bytebase.v1.GetIamPolicyRequest"><span class="badge">M</span>GetIamPolicyRequest</a></li><li>- <a href="#bytebase.v1.WorkloadIdentityConfig"><span class="badge">M</span>WorkloadIdentityConfig</a>+ <a href="#bytebase.v1.IamPolicy"><span class="badge">M</span>IamPolicy</a></li>-<li>- <a href="#bytebase.v1.UserType"><span class="badge">E</span>UserType</a>+ <a href="#bytebase.v1.PolicyDelta"><span class="badge">M</span>PolicyDelta</a></li><li>- <a href="#bytebase.v1.WorkloadIdentityConfig.ProviderType"><span class="badge">E</span>WorkloadIdentityConfig.ProviderType</a>+ <a href="#bytebase.v1.SetIamPolicyRequest"><span class="badge">M</span>SetIamPolicyRequest</a></li>-<li>- <a href="#bytebase.v1.UserService"><span class="badge">S</span>UserService</a>+ <a href="#bytebase.v1.BindingDelta.Action"><span class="badge">E</span>BindingDelta.Action</a></li>++</ul></li><li>- <a href="#v1%2factuator_service.proto">v1/actuator_service.proto</a>+ <a href="#v1%2faudit_log_service.proto">v1/audit_log_service.proto</a><ul><li>- <a href="#bytebase.v1.ActuatorInfo"><span class="badge">M</span>ActuatorInfo</a>+ <a href="#bytebase.v1.AuditData"><span class="badge">M</span>AuditData</a></li><li>- <a href="#bytebase.v1.ActuatorInfo.StatUser"><span class="badge">M</span>ActuatorInfo.StatUser</a>+ <a href="#bytebase.v1.AuditLog"><span class="badge">M</span>AuditLog</a></li><li>- <a href="#bytebase.v1.DeleteCacheRequest"><span class="badge">M</span>DeleteCacheRequest</a>+ <a href="#bytebase.v1.ExportAuditLogsRequest"><span class="badge">M</span>ExportAuditLogsRequest</a></li><li>- <a href="#bytebase.v1.GetActuatorInfoRequest"><span class="badge">M</span>GetActuatorInfoRequest</a>+ <a href="#bytebase.v1.ExportAuditLogsResponse"><span class="badge">M</span>ExportAuditLogsResponse</a></li><li>- <a href="#bytebase.v1.GetResourcePackageRequest"><span class="badge">M</span>GetResourcePackageRequest</a>+ <a href="#bytebase.v1.RequestMetadata"><span class="badge">M</span>RequestMetadata</a></li><li>- <a href="#bytebase.v1.ResourcePackage"><span class="badge">M</span>ResourcePackage</a>+ <a href="#bytebase.v1.SearchAuditLogsRequest"><span class="badge">M</span>SearchAuditLogsRequest</a></li><li>- <a href="#bytebase.v1.Restriction"><span class="badge">M</span>Restriction</a>+ <a href="#bytebase.v1.SearchAuditLogsResponse"><span class="badge">M</span>SearchAuditLogsResponse</a></li>+<li>- <a href="#bytebase.v1.SetupSampleRequest"><span class="badge">M</span>SetupSampleRequest</a>+ <a href="#bytebase.v1.AuditLog.Severity"><span class="badge">E</span>AuditLog.Severity</a></li>-<li>- <a href="#bytebase.v1.ActuatorService"><span class="badge">S</span>ActuatorService</a>+ <a href="#bytebase.v1.AuditLogService"><span class="badge">S</span>AuditLogService</a></li></ul>@@ -756,85 +763,62 @@<li>- <a href="#v1%2fiam_policy.proto">v1/iam_policy.proto</a>+ <a href="#v1%2fuser_service.proto">v1/user_service.proto</a><ul><li>- <a href="#bytebase.v1.Binding"><span class="badge">M</span>Binding</a>- </li>-- <li>- <a href="#bytebase.v1.BindingDelta"><span class="badge">M</span>BindingDelta</a>- </li>-- <li>- <a href="#bytebase.v1.GetIamPolicyRequest"><span class="badge">M</span>GetIamPolicyRequest</a>+ <a href="#bytebase.v1.BatchGetUsersRequest"><span class="badge">M</span>BatchGetUsersRequest</a></li><li>- <a href="#bytebase.v1.IamPolicy"><span class="badge">M</span>IamPolicy</a>+ <a href="#bytebase.v1.BatchGetUsersResponse"><span class="badge">M</span>BatchGetUsersResponse</a></li><li>- <a href="#bytebase.v1.PolicyDelta"><span class="badge">M</span>PolicyDelta</a>+ <a href="#bytebase.v1.CreateUserRequest"><span class="badge">M</span>CreateUserRequest</a></li><li>- <a href="#bytebase.v1.SetIamPolicyRequest"><span class="badge">M</span>SetIamPolicyRequest</a>+ <a href="#bytebase.v1.DeleteUserRequest"><span class="badge">M</span>DeleteUserRequest</a></li>-<li>- <a href="#bytebase.v1.BindingDelta.Action"><span class="badge">E</span>BindingDelta.Action</a>+ <a href="#bytebase.v1.GetUserRequest"><span class="badge">M</span>GetUserRequest</a></li>--- </ul>- </li>--- <li>- <a href="#v1%2faudit_log_service.proto">v1/audit_log_service.proto</a>- <ul>-<li>- <a href="#bytebase.v1.AuditData"><span class="badge">M</span>AuditData</a>+ <a href="#bytebase.v1.ListUsersRequest"><span class="badge">M</span>ListUsersRequest</a></li><li>- <a href="#bytebase.v1.AuditLog"><span class="badge">M</span>AuditLog</a>+ <a href="#bytebase.v1.ListUsersResponse"><span class="badge">M</span>ListUsersResponse</a></li><li>- <a href="#bytebase.v1.ExportAuditLogsRequest"><span class="badge">M</span>ExportAuditLogsRequest</a>+ <a href="#bytebase.v1.UndeleteUserRequest"><span class="badge">M</span>UndeleteUserRequest</a></li><li>- <a href="#bytebase.v1.ExportAuditLogsResponse"><span class="badge">M</span>ExportAuditLogsResponse</a>+ <a href="#bytebase.v1.UpdateEmailRequest"><span class="badge">M</span>UpdateEmailRequest</a></li><li>- <a href="#bytebase.v1.RequestMetadata"><span class="badge">M</span>RequestMetadata</a>+ <a href="#bytebase.v1.UpdateUserRequest"><span class="badge">M</span>UpdateUserRequest</a></li><li>- <a href="#bytebase.v1.SearchAuditLogsRequest"><span class="badge">M</span>SearchAuditLogsRequest</a>+ <a href="#bytebase.v1.User"><span class="badge">M</span>User</a></li><li>- <a href="#bytebase.v1.SearchAuditLogsResponse"><span class="badge">M</span>SearchAuditLogsResponse</a>+ <a href="#bytebase.v1.User.Profile"><span class="badge">M</span>User.Profile</a></li>- <li>- <a href="#bytebase.v1.AuditLog.Severity"><span class="badge">E</span>AuditLog.Severity</a>- </li>-<li>- <a href="#bytebase.v1.AuditLogService"><span class="badge">S</span>AuditLogService</a>+ <a href="#bytebase.v1.UserService"><span class="badge">S</span>UserService</a></li></ul>@@ -2768,6 +2752,14 @@<a href="#bytebase.v1.WorkloadIdentity"><span class="badge">M</span>WorkloadIdentity</a></li>+ <li>+ <a href="#bytebase.v1.WorkloadIdentityConfig"><span class="badge">M</span>WorkloadIdentityConfig</a>+ </li>+++ <li>+ <a href="#bytebase.v1.WorkloadIdentityConfig.ProviderType"><span class="badge">E</span>WorkloadIdentityConfig.ProviderType</a>+ </li>@@ -7733,13 +7725,13 @@ Permissions required: bb.settings.set</p></td><div class="file-heading">- <h2 id="v1/user_service.proto">v1/user_service.proto</h2><a href="#title">Top</a>+ <h2 id="v1/actuator_service.proto">v1/actuator_service.proto</h2><a href="#title">Top</a></div><p></p>- <h3 id="bytebase.v1.BatchGetUsersRequest">BatchGetUsersRequest</h3>- <p></p>+ <h3 id="bytebase.v1.ActuatorInfo">ActuatorInfo</h3>+ <p>System information and configuration for the Bytebase instance.</p><p>Actuator concept is similar to the Spring Boot Actuator.</p><table class="field-table">@@ -7749,211 +7741,143 @@ Permissions required: bb.settings.set</p></td><tbody><tr>- <td>names</td>+ <td>version</td><td><a href="#string">string</a></td>- <td>repeated</td>- <td><p>The user names to retrieve.-Format: users/{email} </p></td>+ <td></td>+ <td><p>The Bytebase server version. </p></td></tr>- </tbody>- </table>------ <h3 id="bytebase.v1.BatchGetUsersResponse">BatchGetUsersResponse</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>users</td>- <td><a href="#bytebase.v1.User">User</a></td>- <td>repeated</td>- <td><p>The users from the specified request. </p></td>+ <td>git_commit</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>The git commit hash of the build. </p></td></tr>- </tbody>- </table>------ <h3 id="bytebase.v1.CreateUserRequest">CreateUserRequest</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>readonly</td>+ <td><a href="#bool">bool</a></td>+ <td></td>+ <td><p>Whether the Bytebase instance is running in read-only mode. </p></td>+ </tr><tr>- <td>user</td>- <td><a href="#bytebase.v1.User">User</a></td>+ <td>saas</td>+ <td><a href="#bool">bool</a></td><td></td>- <td><p>The user to create. </p></td>+ <td><p>Whether the Bytebase instance is running in SaaS mode where some features cannot be edited by users. </p></td></tr>- </tbody>- </table>------ <h3 id="bytebase.v1.DeleteUserRequest">DeleteUserRequest</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>demo</td>+ <td><a href="#bool">bool</a></td>+ <td></td>+ <td><p>Whether the Bytebase instance is running in demo mode. </p></td>+ </tr><tr>- <td>name</td>+ <td>host</td><td><a href="#string">string</a></td><td></td>- <td><p>The name of the user to delete.-Format: users/{email} </p></td>+ <td><p>The host address of the Bytebase instance. </p></td></tr>- </tbody>- </table>------ <h3 id="bytebase.v1.GetUserRequest">GetUserRequest</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>port</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>The port number of the Bytebase instance. </p></td>+ </tr><tr>- <td>name</td>+ <td>external_url</td><td><a href="#string">string</a></td><td></td>- <td><p>The name of the user to retrieve.-Format: users/{email} </p></td>+ <td><p>The external URL where users or webhook callbacks access Bytebase. </p></td></tr>- </tbody>- </table>------ <h3 id="bytebase.v1.ListUsersRequest">ListUsersRequest</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>need_admin_setup</td>+ <td><a href="#bool">bool</a></td>+ <td></td>+ <td><p>Whether the Bytebase instance requires initial admin setup. </p></td>+ </tr><tr>- <td>page_size</td>- <td><a href="#int32">int32</a></td>+ <td>last_active_time</td>+ <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td><td></td>- <td><p>The maximum number of users to return. The service may return fewer than-this value.-If unspecified, at most 10 users will be returned.-The maximum value is 1000; values above 1000 will be coerced to 1000. </p></td>+ <td><p>The last time any API call was made, refreshed on each request. </p></td></tr><tr>- <td>page_token</td>+ <td>workspace_id</td><td><a href="#string">string</a></td><td></td>- <td><p>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. </p></td>+ <td><p>The unique identifier for the workspace. </p></td></tr><tr>- <td>show_deleted</td>+ <td>unlicensed_features</td>+ <td><a href="#string">string</a></td>+ <td>repeated</td>+ <td><p>List of features that are not licensed. </p></td>+ </tr>++ <tr>+ <td>docker</td><td><a href="#bool">bool</a></td><td></td>- <td><p>Show deleted users if specified. </p></td>+ <td><p>Whether the Bytebase instance is running in Docker. </p></td></tr><tr>- <td>filter</td>- <td><a href="#string">string</a></td>+ <td>activated_user_count</td>+ <td><a href="#int32">int32</a></td><td></td>- <td><p>Filter is used to filter users returned in the list.-The syntax and semantics of CEL are documented at https://github.com/google/cel-spec--Supported filter:-- name: the user name, support "==" and ".matches()" operator.-- email: the user email, support "==" and ".matches()" operator.-- state: check State enum for values, support "==" operator.-- project: the project full name in "projects/{id}" format, support "==" operator.--For example:-name == "ed"-name.matches("ed")-email == "[email protected]"-email.matches("ed")-state == "DELETED"-project == "projects/sample-project"-You can combine filter conditions like:-name.matches("ed") && project == "projects/sample-project"-(name == "ed" || email == "[email protected]") && project == "projects/sample-project" </p></td>+ <td><p>The number of activated users. </p></td></tr>- </tbody>- </table>------ <h3 id="bytebase.v1.ListUsersResponse">ListUsersResponse</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>activated_instance_count</td>+ <td><a href="#int32">int32</a></td>+ <td></td>+ <td><p>The number of activated database instances. </p></td>+ </tr><tr>- <td>users</td>- <td><a href="#bytebase.v1.User">User</a></td>- <td>repeated</td>- <td><p>The users from the specified request. </p></td>+ <td>total_instance_count</td>+ <td><a href="#int32">int32</a></td>+ <td></td>+ <td><p>The total number of database instances. </p></td></tr><tr>- <td>next_page_token</td>- <td><a href="#string">string</a></td>+ <td>enable_sample</td>+ <td><a href="#bool">bool</a></td><td></td>- <td><p>A token, which can be sent as `page_token` to retrieve the next page.-If this field is omitted, there are no subsequent pages. </p></td>+ <td><p>Whether sample data setup is enabled. </p></td>+ </tr>++ <tr>+ <td>external_url_from_flag</td>+ <td><a href="#bool">bool</a></td>+ <td></td>+ <td><p>Whether the external URL is set via command-line flag (and thus cannot be changed via UI). </p></td>+ </tr>++ <tr>+ <td>replica_count</td>+ <td><a href="#int32">int32</a></td>+ <td></td>+ <td><p>The number of active replicas (servers sharing the same database). </p></td>+ </tr>++ <tr>+ <td>restriction</td>+ <td><a href="#bytebase.v1.Restriction">Restriction</a></td>+ <td></td>+ <td><p> </p></td></tr></tbody>@@ -7963,33 +7887,29 @@ If this field is omitted, there are no subsequent pages. </p></td>- <h3 id="bytebase.v1.UndeleteUserRequest">UndeleteUserRequest</h3>- <p></p>+ <h3 id="bytebase.v1.DeleteCacheRequest">DeleteCacheRequest</h3>+ <p>Request message for deleting cache.</p>- <table class="field-table">- <thead>- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>- </thead>- <tbody>-- <tr>- <td>name</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>The name of the deleted user.-Format: users/{email} </p></td>- </tr>-- </tbody>- </table>-+++ <h3 id="bytebase.v1.GetActuatorInfoRequest">GetActuatorInfoRequest</h3>+ <p>Request message for getting actuator information.</p>++- <h3 id="bytebase.v1.UpdateEmailRequest">UpdateEmailRequest</h3>- <p></p>+ <h3 id="bytebase.v1.GetResourcePackageRequest">GetResourcePackageRequest</h3>+ <p>Request message for getting branding resources.</p>++++++ <h3 id="bytebase.v1.ResourcePackage">ResourcePackage</h3>+ <p>Custom branding resources for the Bytebase instance.</p><table class="field-table">@@ -7999,19 +7919,10 @@ Format: users/{email} </p></td><tbody><tr>- <td>name</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>The name of the user whose email to update.-Format: users/{email}-Note: This is the current (old) email address. The new email is specified in the 'email' field. </p></td>- </tr>-- <tr>- <td>email</td>- <td><a href="#string">string</a></td>+ <td>logo</td>+ <td><a href="#bytes">bytes</a></td><td></td>- <td><p>The new email address. </p></td>+ <td><p>The branding logo. </p></td></tr></tbody>@@ -8021,7 +7932,7 @@ Note: This is the current (old) email address. The new email is specified in the- <h3 id="bytebase.v1.UpdateUserRequest">UpdateUserRequest</h3>+ <h3 id="bytebase.v1.Restriction">Restriction</h3><p></p>@@ -8032,50 +7943,24 @@ Note: This is the current (old) email address. The new email is specified in the<tbody><tr>- <td>user</td>- <td><a href="#bytebase.v1.User">User</a></td>- <td></td>- <td><p>The user to update.--The user's `name` field is used to identify the user to update.-Format: users/{email} </p></td>- </tr>-- <tr>- <td>update_mask</td>- <td><a href="#google.protobuf.FieldMask">google.protobuf.FieldMask</a></td>- <td></td>- <td><p>The list of fields to update. </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>regenerate_temp_mfa_secret</td>+ <td>disallow_signup</td><td><a href="#bool">bool</a></td><td></td>- <td><p>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. </p></td>+ <td><p>Whether self-service user signup is disabled. </p></td></tr><tr>- <td>regenerate_recovery_codes</td>+ <td>disallow_password_signin</td><td><a href="#bool">bool</a></td><td></td>- <td><p>The regenerate_recovery_codes flag means to regenerate recovery codes for user. </p></td>+ <td><p>Whether password-based signin is disabled (except for workspace admins). </p></td></tr><tr>- <td>allow_missing</td>- <td><a href="#bool">bool</a></td>+ <td>password_restriction</td>+ <td><a href="#bytebase.v1.WorkspaceProfileSetting.PasswordRestriction">WorkspaceProfileSetting.PasswordRestriction</a></td><td></td>- <td><p>If set to true, and the user is not found, a new user will be created.-In this situation, `update_mask` is ignored. </p></td>+ <td><p>Password complexity and restriction requirements. </p></td></tr></tbody>@@ -8085,133 +7970,131 @@ In this situation, `update_mask` is ignored. </p></td>- <h3 id="bytebase.v1.User">User</h3>- <p></p>+ <h3 id="bytebase.v1.SetupSampleRequest">SetupSampleRequest</h3>+ <p>Request message for setting up sample data.</p>- <table class="field-table">- <thead>- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>- </thead>- <tbody>-- <tr>- <td>name</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>The name of the user.-Format: users/{email} </p></td>- </tr>-- <tr>- <td>state</td>- <td><a href="#bytebase.v1.State">State</a></td>- <td></td>- <td><p>The lifecycle state of the user account. </p></td>- </tr>-- <tr>- <td>email</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>The email address of the user, used for login and notifications. </p></td>- </tr>-- <tr>- <td>title</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>The display title or full name of the user. </p></td>- </tr>-- <tr>- <td>user_type</td>- <td><a href="#bytebase.v1.UserType">UserType</a></td>- <td></td>- <td><p>The type of user account. </p></td>- </tr>++++++++++ <h3 id="bytebase.v1.ActuatorService">ActuatorService</h3>+ <p>ActuatorService manages system health and operational information.</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>GetActuatorInfo</td>+ <td><a href="#bytebase.v1.GetActuatorInfoRequest">GetActuatorInfoRequest</a></td>+ <td><a href="#bytebase.v1.ActuatorInfo">ActuatorInfo</a></td>+ <td><p>Gets system information and health status of the Bytebase instance.+Permissions required: None</p></td>+ </tr>++ <tr>+ <td>SetupSample</td>+ <td><a href="#bytebase.v1.SetupSampleRequest">SetupSampleRequest</a></td>+ <td><a href="#google.protobuf.Empty">.google.protobuf.Empty</a></td>+ <td><p>Sets up sample data for demonstration and testing purposes.+Permissions required: bb.projects.create</p></td>+ </tr>++ <tr>+ <td>DeleteCache</td>+ <td><a href="#bytebase.v1.DeleteCacheRequest">DeleteCacheRequest</a></td>+ <td><a href="#google.protobuf.Empty">.google.protobuf.Empty</a></td>+ <td><p>Clears the system cache to force data refresh.+Permissions required: None</p></td>+ </tr>++ <tr>+ <td>GetResourcePackage</td>+ <td><a href="#bytebase.v1.GetResourcePackageRequest">GetResourcePackageRequest</a></td>+ <td><a href="#bytebase.v1.ResourcePackage">ResourcePackage</a></td>+ <td><p>Gets custom branding resources such as logos.+Permissions required: None</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>- <td>password</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>The password for authentication. Only used during user creation or password updates. </p></td>- </tr>- <tr>- <td>service_key</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>The service key for service account authentication. Only used for service accounts. </p></td>- </tr>+ <tr>+ <td>GetActuatorInfo</td>+ <td>GET</td>+ <td>/v1/actuator/info</td>+ <td></td>+ </tr>- <tr>- <td>mfa_enabled</td>- <td><a href="#bool">bool</a></td>- <td></td>- <td><p>The mfa_enabled flag means if the user has enabled MFA. </p></td>- </tr>+- <tr>- <td>temp_otp_secret</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>Temporary OTP secret used during MFA setup and regeneration. </p></td>- </tr>- <tr>- <td>temp_recovery_codes</td>- <td><a href="#string">string</a></td>- <td>repeated</td>- <td><p>Temporary recovery codes used during MFA setup and regeneration. </p></td>- </tr>+ <tr>+ <td>SetupSample</td>+ <td>POST</td>+ <td>/v1/actuator:setupSample</td>+ <td></td>+ </tr>- <tr>- <td>temp_otp_secret_created_time</td>- <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>- <td></td>- <td><p>Timestamp when temp_otp_secret was created. Used by frontend to show countdown timer. </p></td>- </tr>+- <tr>- <td>phone</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>Should be a valid E.164 compliant phone number.-Could be empty. </p></td>- </tr>- <tr>- <td>profile</td>- <td><a href="#bytebase.v1.User.Profile">User.Profile</a></td>- <td></td>- <td><p>User profile metadata. </p></td>- </tr>+ <tr>+ <td>DeleteCache</td>+ <td>DELETE</td>+ <td>/v1/actuator/cache</td>+ <td></td>+ </tr>- <tr>- <td>groups</td>- <td><a href="#string">string</a></td>- <td>repeated</td>- <td><p>The groups for the user.-Format: groups/{email} </p></td>- </tr>+- <tr>- <td>workload_identity_config</td>- <td><a href="#bytebase.v1.WorkloadIdentityConfig">WorkloadIdentityConfig</a></td>- <td></td>- <td><p>Workload Identity configuration (only for WORKLOAD_IDENTITY type) </p></td>- </tr>+ <tr>+ <td>GetResourcePackage</td>+ <td>GET</td>+ <td>/v1/actuator/resources</td>+ <td></td>+ </tr>++</tbody></table>--+- <h3 id="bytebase.v1.User.Profile">User.Profile</h3>- <p></p>+ <div class="file-heading">+ <h2 id="v1/iam_policy.proto">v1/iam_policy.proto</h2><a href="#title">Top</a>+ </div>+ <p></p>+++ <h3 id="bytebase.v1.Binding">Binding</h3>+ <p>Binding associates members with a role and optional conditions.</p><table class="field-table">@@ -8221,24 +8104,52 @@ Format: groups/{email} </p></td><tbody><tr>- <td>last_login_time</td>- <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>+ <td>role</td>+ <td><a href="#string">string</a></td><td></td>- <td><p>The last time the user successfully logged in. </p></td>+ <td><p>The role that is assigned to the members.+Format: roles/{role} </p></td></tr><tr>- <td>last_change_password_time</td>- <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>+ <td>members</td>+ <td><a href="#string">string</a></td>+ <td>repeated</td>+ <td><p>Specifies the principals requesting access for a Bytebase resource.+For users, the member should be: user:{email}+For groups, the member should be: group:{email}+For service accounts, the member should be: serviceAccount:{email}+For workload identities, the member should be: workloadIdentity:{email} </p></td>+ </tr>++ <tr>+ <td>condition</td>+ <td><a href="#google.type.Expr">google.type.Expr</a></td><td></td>- <td><p>The last time the user changed their password. </p></td>+ <td><p>The condition that is associated with this binding, only used in the project IAM policy.+If the condition evaluates to true, then this binding applies to the current request.+If the condition evaluates to false, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding.+The syntax and semantics of CEL are documented at https://github.com/google/cel-spec++Support variables:+resource.database: the database full name in "instances/{instance}/databases/{database}" format, used by the "roles/sqlEditorUser" and "roles/sqlEditorReadUser" roles, support "==" operator.+resource.schema_name: the schema name, used by the "roles/sqlEditorUser" and "roles/sqlEditorReadUser" roles, support "==" operator.+resource.table_name: the table name, used by the "roles/sqlEditorUser" and "roles/sqlEditorReadUser" roles, support "==" operator.+resource.environment_id: the environment to allow the DDL/DML operation in the SQL Editor, only works for the role with bb.sql.ddl or bb.sql.dml permissions. Support "in" operator.+request.time: the expiration. Only support "<" operation in `request.time < timestamp("{ISO datetime string format}")`.++For example:+resource.database == "instances/local-pg/databases/postgres" && resource.schema_name in ["public","another_schema"]+resource.database == "instances/local-pg/databases/bytebase" && resource.schema_name == "public" && resource.table_name in ["audit_log"]+resource.database == "instances/local-pg/databases/postgres" && resource.environment_id in ["test"]+request.time < timestamp("2025-04-26T11:24:48.655Z") </p></td></tr><tr>- <td>source</td>- <td><a href="#string">string</a></td>+ <td>parsed_expr</td>+ <td><a href="#google.api.expr.v1alpha1.Expr">google.api.expr.v1alpha1.Expr</a></td><td></td>- <td><p>source means where the user comes from. For now we support Entra ID SCIM sync, so the source could be Entra ID. </p></td>+ <td><p>The parsed expression of the condition. </p></td></tr></tbody>@@ -8248,8 +8159,8 @@ Format: groups/{email} </p></td>- <h3 id="bytebase.v1.WorkloadIdentityConfig">WorkloadIdentityConfig</h3>- <p>WorkloadIdentityConfig for API layer</p>+ <h3 id="bytebase.v1.BindingDelta">BindingDelta</h3>+ <p>A single change to a binding.</p><table class="field-table">@@ -8259,31 +8170,32 @@ Format: groups/{email} </p></td><tbody><tr>- <td>provider_type</td>- <td><a href="#bytebase.v1.WorkloadIdentityConfig.ProviderType">WorkloadIdentityConfig.ProviderType</a></td>+ <td>action</td>+ <td><a href="#bytebase.v1.BindingDelta.Action">BindingDelta.Action</a></td><td></td>- <td><p>Platform type (currently only GITHUB is supported) </p></td>+ <td><p>The action that was performed on a Binding. </p></td></tr><tr>- <td>issuer_url</td>+ <td>role</td><td><a href="#string">string</a></td><td></td>- <td><p>OIDC Issuer URL (auto-filled based on provider_type, can be overridden) </p></td>+ <td><p>Role that is assigned to `members`.+For example, `roles/projectOwner`. </p></td></tr><tr>- <td>allowed_audiences</td>+ <td>member</td><td><a href="#string">string</a></td>- <td>repeated</td>- <td><p>Allowed audiences for token validation </p></td>+ <td></td>+ <td><p>Follows the same format of Binding.members. </p></td></tr><tr>- <td>subject_pattern</td>- <td><a href="#string">string</a></td>+ <td>condition</td>+ <td><a href="#google.type.Expr">google.type.Expr</a></td><td></td>- <td><p>Subject pattern to match (e.g., "repo:owner/repo:ref:refs/heads/main") </p></td>+ <td><p>The condition that is associated with this binding. </p></td></tr></tbody>@@ -8293,282 +8205,175 @@ Format: groups/{email} </p></td>+ <h3 id="bytebase.v1.GetIamPolicyRequest">GetIamPolicyRequest</h3>+ <p>Request message for getting an IAM policy.</p>-- <h3 id="bytebase.v1.UserType">UserType</h3>- <p></p>- <table class="enum-table">- <thead>- <tr><td>Name</td><td>Number</td><td>Description</td></tr>- </thead>- <tbody>-- <tr>- <td>USER_TYPE_UNSPECIFIED</td>- <td>0</td>- <td><p>Unspecified user type.</p></td>- </tr>-- <tr>- <td>USER</td>- <td>1</td>- <td><p>Regular human user account.</p></td>- </tr>-- <tr>- <td>WORKLOAD_IDENTITY</td>- <td>2</td>- <td><p>External CI/CD workload identity.</p></td>- </tr>-- <tr>- <td>SERVICE_ACCOUNT</td>- <td>3</td>- <td><p>Service account for API integrations.</p></td>- </tr>-- </tbody>- </table>-- <h3 id="bytebase.v1.WorkloadIdentityConfig.ProviderType">WorkloadIdentityConfig.ProviderType</h3>- <p>ProviderType identifies the CI/CD platform.</p>- <table class="enum-table">- <thead>- <tr><td>Name</td><td>Number</td><td>Description</td></tr>- </thead>- <tbody>-- <tr>- <td>PROVIDER_TYPE_UNSPECIFIED</td>- <td>0</td>- <td><p></p></td>- </tr>-- <tr>- <td>GITHUB</td>- <td>1</td>- <td><p></p></td>- </tr>-- <tr>- <td>GITLAB</td>- <td>2</td>- <td><p></p></td>- </tr>-- </tbody>- </table>-++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>resource</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>The name of the resource to get the IAM policy.+Format: projects/{project}+Format: workspaces/{workspace} </p></td>+ </tr>++ </tbody>+ </table>-++- <h3 id="bytebase.v1.UserService">UserService</h3>- <p>UserService manages user accounts and authentication.</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>GetUser</td>- <td><a href="#bytebase.v1.GetUserRequest">GetUserRequest</a></td>- <td><a href="#bytebase.v1.User">User</a></td>- <td><p>Get the user.-Any authenticated user can get the user.-Permissions required: bb.users.get</p></td>- </tr>-- <tr>- <td>BatchGetUsers</td>- <td><a href="#bytebase.v1.BatchGetUsersRequest">BatchGetUsersRequest</a></td>- <td><a href="#bytebase.v1.BatchGetUsersResponse">BatchGetUsersResponse</a></td>- <td><p>Get the users in batch.-Any authenticated user can batch get users.-Permissions required: bb.users.get</p></td>- </tr>-- <tr>- <td>GetCurrentUser</td>- <td><a href="#google.protobuf.Empty">.google.protobuf.Empty</a></td>- <td><a href="#bytebase.v1.User">User</a></td>- <td><p>Get the current authenticated user.-Permissions required: None</p></td>- </tr>-- <tr>- <td>ListUsers</td>- <td><a href="#bytebase.v1.ListUsersRequest">ListUsersRequest</a></td>- <td><a href="#bytebase.v1.ListUsersResponse">ListUsersResponse</a></td>- <td><p>List all users.-Any authenticated user can list users.-Permissions required: bb.users.list</p></td>- </tr>-- <tr>- <td>CreateUser</td>- <td><a href="#bytebase.v1.CreateUserRequest">CreateUserRequest</a></td>- <td><a href="#bytebase.v1.User">User</a></td>- <td><p>Creates a user. When Disallow Signup is enabled, requires bb.users.create permission; otherwise any user can sign up.-Permissions required: bb.users.create (only when Disallow Signup is enabled)</p></td>- </tr>-- <tr>- <td>UpdateUser</td>- <td><a href="#bytebase.v1.UpdateUserRequest">UpdateUserRequest</a></td>- <td><a href="#bytebase.v1.User">User</a></td>- <td><p>Updates a user. Users can update their own profile, or users with bb.users.update permission can update any user.-Note: Email updates are not supported through this API. Use UpdateEmail instead.-Permissions required: bb.users.update (or self)</p></td>- </tr>-- <tr>- <td>DeleteUser</td>- <td><a href="#bytebase.v1.DeleteUserRequest">DeleteUserRequest</a></td>- <td><a href="#google.protobuf.Empty">.google.protobuf.Empty</a></td>- <td><p>Deletes a user. Requires bb.users.delete permission with additional validation: the last remaining workspace admin cannot be deleted.-Permissions required: bb.users.delete</p></td>- </tr>-- <tr>- <td>UndeleteUser</td>- <td><a href="#bytebase.v1.UndeleteUserRequest">UndeleteUserRequest</a></td>- <td><a href="#bytebase.v1.User">User</a></td>- <td><p>Restores a deleted user.-Permissions required: bb.users.undelete</p></td>- </tr>-- <tr>- <td>UpdateEmail</td>- <td><a href="#bytebase.v1.UpdateEmailRequest">UpdateEmailRequest</a></td>- <td><a href="#bytebase.v1.User">User</a></td>- <td><p>Updates a user's email address.-Permissions required: bb.users.updateEmail</p></td>- </tr>-- </tbody>- </table>+ <h3 id="bytebase.v1.IamPolicy">IamPolicy</h3>+ <p>IAM policy that binds members to roles.</p>--- <h4>Methods with HTTP bindings</h4>- <table>+ <table class="field-table"><thead>- <tr>- <td>Method Name</td>- <td>Method</td>- <td>Pattern</td>- <td>Body</td>- </tr>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr></thead><tbody>---- <tr>- <td>GetUser</td>- <td>GET</td>- <td>/v1/{name=users/*}</td>- <td></td>- </tr>----- <tr>- <td>BatchGetUsers</td>- <td>GET</td>- <td>/v1/users:batchGet</td>- <td></td>- </tr>----- <tr>- <td>GetCurrentUser</td>- <td>GET</td>- <td>/v1/users/me</td>- <td></td>- </tr>--+ <tr>+ <td>bindings</td>+ <td><a href="#bytebase.v1.Binding">Binding</a></td>+ <td>repeated</td>+ <td><p>Collection of binding.+A binding binds one or more project members to a single project role. </p></td>+ </tr>- <tr>- <td>ListUsers</td>- <td>GET</td>- <td>/v1/users</td>- <td></td>- </tr>+ <tr>+ <td>etag</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>The current etag of the policy.+If an etag is provided and does not match the current etag of the policy,+the call will be blocked and an ABORTED error will be returned. </p></td>+ </tr>-+ </tbody>+ </table>++++++ <h3 id="bytebase.v1.PolicyDelta">PolicyDelta</h3>+ <p>Describes changes between two IAM policies.</p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody>+ <tr>+ <td>binding_deltas</td>+ <td><a href="#bytebase.v1.BindingDelta">BindingDelta</a></td>+ <td>repeated</td>+ <td><p>The delta for Bindings between two policies. </p></td>+ </tr>- <tr>- <td>CreateUser</td>- <td>POST</td>- <td>/v1/users</td>- <td>user</td>- </tr>+ </tbody>+ </table>++++++ <h3 id="bytebase.v1.SetIamPolicyRequest">SetIamPolicyRequest</h3>+ <p>Request message for setting an IAM policy.</p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody>-+ <tr>+ <td>resource</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>The name of the resource to set the IAM policy.+Format: projects/{project}+Format: workspaces/{workspace} </p></td>+ </tr>+ <tr>+ <td>policy</td>+ <td><a href="#bytebase.v1.IamPolicy">IamPolicy</a></td>+ <td></td>+ <td><p> </p></td>+ </tr>- <tr>- <td>UpdateUser</td>- <td>PATCH</td>- <td>/v1/{user.name=users/*}</td>- <td>user</td>- </tr>+ <tr>+ <td>etag</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>The current etag of the policy. </p></td>+ </tr>+ </tbody>+ </table>++++++++ <h3 id="bytebase.v1.BindingDelta.Action">BindingDelta.Action</h3>+ <p>Type of action performed on a binding.</p>+ <table class="enum-table">+ <thead>+ <tr><td>Name</td><td>Number</td><td>Description</td></tr>+ </thead>+ <tbody>--<tr>- <td>DeleteUser</td>- <td>DELETE</td>- <td>/v1/{name=users/*}</td>- <td></td>+ <td>ACTION_UNSPECIFIED</td>+ <td>0</td>+ <td><p>Unspecified action.</p></td></tr>---<tr>- <td>UndeleteUser</td>- <td>POST</td>- <td>/v1/{name=users/*}:undelete</td>- <td>*</td>+ <td>ADD</td>+ <td>1</td>+ <td><p>Add a binding.</p></td></tr>---<tr>- <td>UpdateEmail</td>- <td>POST</td>- <td>/v1/{name=users/*}:updateEmail</td>- <td>*</td>+ <td>REMOVE</td>+ <td>2</td>+ <td><p>Remove a binding.</p></td></tr>-- </tbody>- </table>--+ </tbody>+ </table>+++++<div class="file-heading">- <h2 id="v1/actuator_service.proto">v1/actuator_service.proto</h2><a href="#title">Top</a>+ <h2 id="v1/audit_log_service.proto">v1/audit_log_service.proto</h2><a href="#title">Top</a></div><p></p>- <h3 id="bytebase.v1.ActuatorInfo">ActuatorInfo</h3>- <p>System information and configuration for the Bytebase instance.</p><p>Actuator concept is similar to the Spring Boot Actuator.</p>+ <h3 id="bytebase.v1.AuditData">AuditData</h3>+ <p>Additional audit data specific to certain operations.</p><table class="field-table">@@ -8578,143 +8383,185 @@ Permissions required: bb.users.updateEmail</p></td><tbody><tr>- <td>version</td>- <td><a href="#string">string</a></td>+ <td>policy_delta</td>+ <td><a href="#bytebase.v1.PolicyDelta">PolicyDelta</a></td><td></td>- <td><p>The Bytebase server version. </p></td>+ <td><p>Changes to IAM policies. </p></td></tr>- <tr>- <td>git_commit</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>The git commit hash of the build. </p></td>- </tr>+ </tbody>+ </table>++++++ <h3 id="bytebase.v1.AuditLog">AuditLog</h3>+ <p>Audit log entry recording system activity or API call.</p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody><tr>- <td>readonly</td>- <td><a href="#bool">bool</a></td>+ <td>name</td>+ <td><a href="#string">string</a></td><td></td>- <td><p>Whether the Bytebase instance is running in read-only mode. </p></td>+ <td><p>The name of the log.+Formats:+- projects/{project}/auditLogs/{uid}+- workspaces/{workspace}/auditLogs/{uid} </p></td></tr><tr>- <td>saas</td>- <td><a href="#bool">bool</a></td>+ <td>create_time</td>+ <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td><td></td>- <td><p>Whether the Bytebase instance is running in SaaS mode where some features cannot be edited by users. </p></td>+ <td><p>The timestamp when the audit log was created. </p></td></tr><tr>- <td>demo</td>- <td><a href="#bool">bool</a></td>+ <td>user</td>+ <td><a href="#string">string</a></td><td></td>- <td><p>Whether the Bytebase instance is running in demo mode. </p></td>+ <td><p>The user who performed the action.+Format: users/{email} </p></td></tr><tr>- <td>host</td>+ <td>method</td><td><a href="#string">string</a></td><td></td>- <td><p>The host address of the Bytebase instance. </p></td>+ <td><p>The method or action being audited.+For example: /bytebase.v1.SQLService/Query or bb.project.repository.push </p></td></tr><tr>- <td>port</td>- <td><a href="#string">string</a></td>+ <td>severity</td>+ <td><a href="#bytebase.v1.AuditLog.Severity">AuditLog.Severity</a></td><td></td>- <td><p>The port number of the Bytebase instance. </p></td>+ <td><p>The severity level of this audit log entry. </p></td></tr><tr>- <td>external_url</td>+ <td>resource</td><td><a href="#string">string</a></td><td></td>- <td><p>The external URL where users or webhook callbacks access Bytebase. </p></td>+ <td><p>The resource associated with this audit log. </p></td></tr><tr>- <td>need_admin_setup</td>- <td><a href="#bool">bool</a></td>+ <td>request</td>+ <td><a href="#string">string</a></td><td></td>- <td><p>Whether the Bytebase instance requires initial admin setup. </p></td>+ <td><p>The request payload in JSON format. </p></td></tr><tr>- <td>last_active_time</td>- <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>+ <td>response</td>+ <td><a href="#string">string</a></td><td></td>- <td><p>The last time any API call was made, refreshed on each request. </p></td>+ <td><p>The response payload in JSON format.+Some fields may be omitted if they are too large or contain sensitive information. </p></td></tr><tr>- <td>workspace_id</td>- <td><a href="#string">string</a></td>+ <td>status</td>+ <td><a href="#google.rpc.Status">google.rpc.Status</a></td><td></td>- <td><p>The unique identifier for the workspace. </p></td>+ <td><p>The status of the operation. </p></td></tr><tr>- <td>unlicensed_features</td>- <td><a href="#string">string</a></td>- <td>repeated</td>- <td><p>List of features that are not licensed. </p></td>+ <td>latency</td>+ <td><a href="#google.protobuf.Duration">google.protobuf.Duration</a></td>+ <td></td>+ <td><p>The duration of the operation. </p></td></tr><tr>- <td>docker</td>- <td><a href="#bool">bool</a></td>+ <td>service_data</td>+ <td><a href="#google.protobuf.Any">google.protobuf.Any</a></td><td></td>- <td><p>Whether the Bytebase instance is running in Docker. </p></td>+ <td><p>Service-specific metadata about the request, response, and activities. </p></td></tr><tr>- <td>user_stats</td>- <td><a href="#bytebase.v1.ActuatorInfo.StatUser">ActuatorInfo.StatUser</a></td>- <td>repeated</td>- <td><p>Statistics about users in the system. </p></td>+ <td>request_metadata</td>+ <td><a href="#bytebase.v1.RequestMetadata">RequestMetadata</a></td>+ <td></td>+ <td><p>Metadata about the request context. </p></td></tr>+ </tbody>+ </table>++++++ <h3 id="bytebase.v1.ExportAuditLogsRequest">ExportAuditLogsRequest</h3>+ <p>Request message for exporting audit logs.</p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody>+<tr>- <td>activated_instance_count</td>- <td><a href="#int32">int32</a></td>+ <td>parent</td>+ <td><a href="#string">string</a></td><td></td>- <td><p>The number of activated database instances. </p></td>+ <td><p> </p></td></tr><tr>- <td>total_instance_count</td>- <td><a href="#int32">int32</a></td>+ <td>filter</td>+ <td><a href="#string">string</a></td><td></td>- <td><p>The total number of database instances. </p></td>+ <td><p>The filter of the log. It should be a valid CEL expression.+Check the filter field in the SearchAuditLogsRequest message. </p></td></tr><tr>- <td>enable_sample</td>- <td><a href="#bool">bool</a></td>+ <td>order_by</td>+ <td><a href="#string">string</a></td><td></td>- <td><p>Whether sample data setup is enabled. </p></td>+ <td><p>The order by of the log.+Only support order by create_time. The default sorting order is ascending.+For example:+ - order_by = "create_time asc"+ - order_by = "create_time desc" </p></td></tr><tr>- <td>external_url_from_flag</td>- <td><a href="#bool">bool</a></td>+ <td>format</td>+ <td><a href="#bytebase.v1.ExportFormat">ExportFormat</a></td><td></td>- <td><p>Whether the external URL is set via command-line flag (and thus cannot be changed via UI). </p></td>+ <td><p>The export format. </p></td></tr><tr>- <td>replica_count</td>+ <td>page_size</td><td><a href="#int32">int32</a></td><td></td>- <td><p>The number of active replicas (servers sharing the same database). </p></td>+ <td><p>The maximum number of logs to return.+The service may return fewer than this value.+If unspecified, at most 10 log entries will be returned.+The maximum value is 5000; values above 5000 will be coerced to 5000. </p></td></tr><tr>- <td>restriction</td>- <td><a href="#bytebase.v1.Restriction">Restriction</a></td>+ <td>page_token</td>+ <td><a href="#string">string</a></td><td></td>- <td><p> </p></td>+ <td><p>A page token, received from a previous `ExportAuditLogs` call.+Provide this to retrieve the subsequent page. </p></td></tr></tbody>@@ -8724,8 +8571,8 @@ Permissions required: bb.users.updateEmail</p></td>- <h3 id="bytebase.v1.ActuatorInfo.StatUser">ActuatorInfo.StatUser</h3>- <p>User statistics by type and state.</p>+ <h3 id="bytebase.v1.ExportAuditLogsResponse">ExportAuditLogsResponse</h3>+ <p>Response message for exporting audit logs.</p><table class="field-table">@@ -8735,24 +8582,19 @@ Permissions required: bb.users.updateEmail</p></td><tbody><tr>- <td>user_type</td>- <td><a href="#bytebase.v1.UserType">UserType</a></td>- <td></td>- <td><p>The type of user. </p></td>- </tr>-- <tr>- <td>state</td>- <td><a href="#bytebase.v1.State">State</a></td>+ <td>content</td>+ <td><a href="#bytes">bytes</a></td><td></td>- <td><p>The state of the user. </p></td>+ <td><p>The exported audit log content in the requested format. </p></td></tr><tr>- <td>count</td>- <td><a href="#int32">int32</a></td>+ <td>next_page_token</td>+ <td><a href="#string">string</a></td><td></td>- <td><p>The count of users matching this type and state. </p></td>+ <td><p>A token to retrieve next page of log entities.+Pass this value in the page_token field in the subsequent call+to retrieve the next page of log entities. </p></td></tr></tbody>@@ -8762,29 +8604,8 @@ Permissions required: bb.users.updateEmail</p></td>- <h3 id="bytebase.v1.DeleteCacheRequest">DeleteCacheRequest</h3>- <p>Request message for deleting cache.</p>------ <h3 id="bytebase.v1.GetActuatorInfoRequest">GetActuatorInfoRequest</h3>- <p>Request message for getting actuator information.</p>------ <h3 id="bytebase.v1.GetResourcePackageRequest">GetResourcePackageRequest</h3>- <p>Request message for getting branding resources.</p>------ <h3 id="bytebase.v1.ResourcePackage">ResourcePackage</h3>- <p>Custom branding resources for the Bytebase instance.</p>+ <h3 id="bytebase.v1.RequestMetadata">RequestMetadata</h3>+ <p>Metadata about the incoming request.</p><table class="field-table">@@ -8794,10 +8615,18 @@ Permissions required: bb.users.updateEmail</p></td><tbody><tr>- <td>logo</td>- <td><a href="#bytes">bytes</a></td>+ <td>caller_ip</td>+ <td><a href="#string">string</a></td><td></td>- <td><p>The branding logo. </p></td>+ <td><p>The IP address of the request originator. </p></td>+ </tr>++ <tr>+ <td>caller_supplied_user_agent</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>The user agent string provided by the caller.+This is supplied by the client and is not authenticated. </p></td></tr></tbody>@@ -8807,8 +8636,8 @@ Permissions required: bb.users.updateEmail</p></td>- <h3 id="bytebase.v1.Restriction">Restriction</h3>- <p></p>+ <h3 id="bytebase.v1.SearchAuditLogsRequest">SearchAuditLogsRequest</h3>+ <p>Request message for searching audit logs.</p><table class="field-table">@@ -8818,24 +8647,59 @@ Permissions required: bb.users.updateEmail</p></td><tbody><tr>- <td>disallow_signup</td>- <td><a href="#bool">bool</a></td>+ <td>parent</td>+ <td><a href="#string">string</a></td><td></td>- <td><p>Whether self-service user signup is disabled. </p></td>+ <td><p> </p></td></tr><tr>- <td>disallow_password_signin</td>- <td><a href="#bool">bool</a></td>+ <td>filter</td>+ <td><a href="#string">string</a></td><td></td>- <td><p>Whether password-based signin is disabled (except for workspace admins). </p></td>+ <td><p>The filter of the log. It should be a valid CEL expression.+The syntax and semantics of CEL are documented at https://github.com/google/cel-spec++Supported filter:+- method: the API name, can be found in the docs, should start with "/bytebase.v1." prefix. For example "/bytebase.v1.UserService/CreateUser". Support "==" operator.+- severity: support "==" operator, check Severity enum in AuditLog message for values.+- user: the actor, should in "users/{email}" format, support "==" operator.+- create_time: support ">=" and "<=" operator.++For example:+ - filter = "method == '/bytebase.v1.SQLService/Query'"+ - filter = "method == '/bytebase.v1.SQLService/Query' && severity == 'ERROR'"+ - filter = "method == '/bytebase.v1.SQLService/Query' && severity == 'ERROR' && user == 'users/[email protected]'"+ - filter = "method == '/bytebase.v1.SQLService/Query' && severity == 'ERROR' && create_time <= '2021-01-01T00:00:00Z' && create_time >= '2020-01-01T00:00:00Z'" </p></td></tr><tr>- <td>password_restriction</td>- <td><a href="#bytebase.v1.WorkspaceProfileSetting.PasswordRestriction">WorkspaceProfileSetting.PasswordRestriction</a></td>+ <td>order_by</td>+ <td><a href="#string">string</a></td><td></td>- <td><p>Password complexity and restriction requirements. </p></td>+ <td><p>The order by of the log.+Only support order by create_time. The default sorting order is ascending.+For example:+ - order_by = "create_time asc"+ - order_by = "create_time desc" </p></td>+ </tr>++ <tr>+ <td>page_size</td>+ <td><a href="#int32">int32</a></td>+ <td></td>+ <td><p>The maximum number of logs to return.+The service may return fewer than this value.+If unspecified, at most 10 log entries will be returned.+The maximum value is 5000; values above 5000 will be coerced to 5000. </p></td>+ </tr>++ <tr>+ <td>page_token</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>A page token, received from a previous `SearchLogs` call.+Provide this to retrieve the subsequent page. </p></td></tr></tbody>@@ -8845,57 +8709,132 @@ Permissions required: bb.users.updateEmail</p></td>- <h3 id="bytebase.v1.SetupSampleRequest">SetupSampleRequest</h3>- <p>Request message for setting up sample data.</p>+ <h3 id="bytebase.v1.SearchAuditLogsResponse">SearchAuditLogsResponse</h3>+ <p>Response message for searching audit logs.</p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>audit_logs</td>+ <td><a href="#bytebase.v1.AuditLog">AuditLog</a></td>+ <td>repeated</td>+ <td><p> </p></td>+ </tr>++ <tr>+ <td>next_page_token</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>A token to retrieve next page of log entities.+Pass this value in the page_token field in the subsequent call+to retrieve the next page of log entities. </p></td>+ </tr>++ </tbody>+ </table>-+----- <h3 id="bytebase.v1.ActuatorService">ActuatorService</h3>- <p>ActuatorService manages system health and operational information.</p>+ <h3 id="bytebase.v1.AuditLog.Severity">AuditLog.Severity</h3>+ <p>Severity level for audit log entries.</p><table class="enum-table"><thead>- <tr><td>Method Name</td><td>Request Type</td><td>Response Type</td><td>Description</td></tr>+ <tr><td>Name</td><td>Number</td><td>Description</td></tr></thead><tbody><tr>- <td>GetActuatorInfo</td>- <td><a href="#bytebase.v1.GetActuatorInfoRequest">GetActuatorInfoRequest</a></td>- <td><a href="#bytebase.v1.ActuatorInfo">ActuatorInfo</a></td>- <td><p>Gets system information and health status of the Bytebase instance.-Permissions required: None</p></td>+ <td>SEVERITY_UNSPECIFIED</td>+ <td>0</td>+ <td><p>Unspecified severity level.</p></td></tr><tr>- <td>SetupSample</td>- <td><a href="#bytebase.v1.SetupSampleRequest">SetupSampleRequest</a></td>- <td><a href="#google.protobuf.Empty">.google.protobuf.Empty</a></td>- <td><p>Sets up sample data for demonstration and testing purposes.-Permissions required: bb.projects.create</p></td>+ <td>DEBUG</td>+ <td>1</td>+ <td><p>Debug-level information.</p></td></tr><tr>- <td>DeleteCache</td>- <td><a href="#bytebase.v1.DeleteCacheRequest">DeleteCacheRequest</a></td>- <td><a href="#google.protobuf.Empty">.google.protobuf.Empty</a></td>- <td><p>Clears the system cache to force data refresh.-Permissions required: None</p></td>+ <td>INFO</td>+ <td>2</td>+ <td><p>Informational messages.</p></td></tr><tr>- <td>GetResourcePackage</td>- <td><a href="#bytebase.v1.GetResourcePackageRequest">GetResourcePackageRequest</a></td>- <td><a href="#bytebase.v1.ResourcePackage">ResourcePackage</a></td>- <td><p>Gets custom branding resources such as logos.-Permissions required: None</p></td>+ <td>NOTICE</td>+ <td>3</td>+ <td><p>Notable events.</p></td>+ </tr>++ <tr>+ <td>WARNING</td>+ <td>4</td>+ <td><p>Warning conditions.</p></td>+ </tr>++ <tr>+ <td>ERROR</td>+ <td>5</td>+ <td><p>Error conditions.</p></td>+ </tr>++ <tr>+ <td>CRITICAL</td>+ <td>6</td>+ <td><p>Critical conditions.</p></td>+ </tr>++ <tr>+ <td>ALERT</td>+ <td>7</td>+ <td><p>Action must be taken immediately.</p></td>+ </tr>++ <tr>+ <td>EMERGENCY</td>+ <td>8</td>+ <td><p>System is unusable.</p></td>+ </tr>++ </tbody>+ </table>++++++ <h3 id="bytebase.v1.AuditLogService">AuditLogService</h3>+ <p>AuditLogService manages audit logs for system activities and API calls.</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>SearchAuditLogs</td>+ <td><a href="#bytebase.v1.SearchAuditLogsRequest">SearchAuditLogsRequest</a></td>+ <td><a href="#bytebase.v1.SearchAuditLogsResponse">SearchAuditLogsResponse</a></td>+ <td><p>Searches audit logs with optional filtering and pagination.+Permissions required: bb.auditLogs.search</p></td>+ </tr>++ <tr>+ <td>ExportAuditLogs</td>+ <td><a href="#bytebase.v1.ExportAuditLogsRequest">ExportAuditLogsRequest</a></td>+ <td><a href="#bytebase.v1.ExportAuditLogsResponse">ExportAuditLogsResponse</a></td>+ <td><p>Exports audit logs in a specified format for external analysis.+Permissions required: bb.auditLogs.export</p></td></tr></tbody>@@ -8919,40 +8858,34 @@ Permissions required: None</p></td><tr>- <td>GetActuatorInfo</td>- <td>GET</td>- <td>/v1/actuator/info</td>- <td></td>+ <td>SearchAuditLogs</td>+ <td>POST</td>+ <td>/v1/{parent=projects/*}/auditLogs:search</td>+ <td>*</td></tr>---<tr>- <td>SetupSample</td>+ <td>SearchAuditLogs</td><td>POST</td>- <td>/v1/actuator:setupSample</td>- <td></td>+ <td>/v1/auditLogs:search</td>+ <td>*</td></tr><tr>- <td>DeleteCache</td>- <td>DELETE</td>- <td>/v1/actuator/cache</td>- <td></td>+ <td>ExportAuditLogs</td>+ <td>POST</td>+ <td>/v1/{parent=projects/*}/auditLogs:export</td>+ <td>*</td></tr>---<tr>- <td>GetResourcePackage</td>- <td>GET</td>- <td>/v1/actuator/resources</td>- <td></td>+ <td>ExportAuditLogs</td>+ <td>POST</td>+ <td>/v1/auditLogs:export</td>+ <td>*</td></tr>@@ -8963,125 +8896,13 @@ Permissions required: None</p></td><div class="file-heading">- <h2 id="v1/iam_policy.proto">v1/iam_policy.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>- <h3 id="bytebase.v1.Binding">Binding</h3>- <p>Binding associates members with a role and optional conditions.</p>--- <table class="field-table">- <thead>- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>- </thead>- <tbody>-- <tr>- <td>role</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>The role that is assigned to the members.-Format: roles/{role} </p></td>- </tr>-- <tr>- <td>members</td>- <td><a href="#string">string</a></td>- <td>repeated</td>- <td><p>Specifies the principals requesting access for a Bytebase resource.-For users, the member should be: user:{email}-For groups, the member should be: group:{email}-For service accounts, the member should be: serviceAccount:{email}-For workload identities, the member should be: workloadIdentity:{email} </p></td>- </tr>-- <tr>- <td>condition</td>- <td><a href="#google.type.Expr">google.type.Expr</a></td>- <td></td>- <td><p>The condition that is associated with this binding, only used in the project IAM policy.-If the condition evaluates to true, then this binding applies to the current request.-If the condition evaluates to false, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding.-The syntax and semantics of CEL are documented at https://github.com/google/cel-spec--Support variables:-resource.database: the database full name in "instances/{instance}/databases/{database}" format, used by the "roles/sqlEditorUser" and "roles/sqlEditorReadUser" roles, support "==" operator.-resource.schema_name: the schema name, used by the "roles/sqlEditorUser" and "roles/sqlEditorReadUser" roles, support "==" operator.-resource.table_name: the table name, used by the "roles/sqlEditorUser" and "roles/sqlEditorReadUser" roles, support "==" operator.-resource.environment_id: the environment to allow the DDL/DML operation in the SQL Editor, only works for the role with bb.sql.ddl or bb.sql.dml permissions. Support "in" operator.-request.time: the expiration. Only support "<" operation in `request.time < timestamp("{ISO datetime string format}")`.--For example:-resource.database == "instances/local-pg/databases/postgres" && resource.schema_name in ["public","another_schema"]-resource.database == "instances/local-pg/databases/bytebase" && resource.schema_name == "public" && resource.table_name in ["audit_log"]-resource.database == "instances/local-pg/databases/postgres" && resource.environment_id in ["test"]-request.time < timestamp("2025-04-26T11:24:48.655Z") </p></td>- </tr>-- <tr>- <td>parsed_expr</td>- <td><a href="#google.api.expr.v1alpha1.Expr">google.api.expr.v1alpha1.Expr</a></td>- <td></td>- <td><p>The parsed expression of the condition. </p></td>- </tr>-- </tbody>- </table>------ <h3 id="bytebase.v1.BindingDelta">BindingDelta</h3>- <p>A single change to a binding.</p>--- <table class="field-table">- <thead>- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>- </thead>- <tbody>-- <tr>- <td>action</td>- <td><a href="#bytebase.v1.BindingDelta.Action">BindingDelta.Action</a></td>- <td></td>- <td><p>The action that was performed on a Binding. </p></td>- </tr>-- <tr>- <td>role</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>Role that is assigned to `members`.-For example, `roles/projectOwner`. </p></td>- </tr>-- <tr>- <td>member</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>Follows the same format of Binding.members. </p></td>- </tr>-- <tr>- <td>condition</td>- <td><a href="#google.type.Expr">google.type.Expr</a></td>- <td></td>- <td><p>The condition that is associated with this binding. </p></td>- </tr>-- </tbody>- </table>------ <h3 id="bytebase.v1.GetIamPolicyRequest">GetIamPolicyRequest</h3>- <p>Request message for getting an IAM policy.</p>+ <h3 id="bytebase.v1.BatchGetUsersRequest">BatchGetUsersRequest</h3>+ <p></p><table class="field-table">@@ -9091,12 +8912,11 @@ For example, `roles/projectOwner`. </p></td><tbody><tr>- <td>resource</td>+ <td>names</td><td><a href="#string">string</a></td>- <td></td>- <td><p>The name of the resource to get the IAM policy.-Format: projects/{project}-Format: workspaces/{workspace} </p></td>+ <td>repeated</td>+ <td><p>The user names to retrieve.+Format: users/{email} </p></td></tr></tbody>@@ -9106,8 +8926,8 @@ Format: workspaces/{workspace} </p></td>- <h3 id="bytebase.v1.IamPolicy">IamPolicy</h3>- <p>IAM policy that binds members to roles.</p>+ <h3 id="bytebase.v1.BatchGetUsersResponse">BatchGetUsersResponse</h3>+ <p></p><table class="field-table">@@ -9117,20 +8937,10 @@ Format: workspaces/{workspace} </p></td><tbody><tr>- <td>bindings</td>- <td><a href="#bytebase.v1.Binding">Binding</a></td>+ <td>users</td>+ <td><a href="#bytebase.v1.User">User</a></td><td>repeated</td>- <td><p>Collection of binding.-A binding binds one or more project members to a single project role. </p></td>- </tr>-- <tr>- <td>etag</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>The current etag of the policy.-If an etag is provided and does not match the current etag of the policy,-the call will be blocked and an ABORTED error will be returned. </p></td>+ <td><p>The users from the specified request. </p></td></tr></tbody>@@ -9140,8 +8950,8 @@ the call will be blocked and an ABORTED error will be returned. </p></td>- <h3 id="bytebase.v1.PolicyDelta">PolicyDelta</h3>- <p>Describes changes between two IAM policies.</p>+ <h3 id="bytebase.v1.CreateUserRequest">CreateUserRequest</h3>+ <p></p><table class="field-table">@@ -9151,10 +8961,10 @@ the call will be blocked and an ABORTED error will be returned. </p></td><tbody><tr>- <td>binding_deltas</td>- <td><a href="#bytebase.v1.BindingDelta">BindingDelta</a></td>- <td>repeated</td>- <td><p>The delta for Bindings between two policies. </p></td>+ <td>user</td>+ <td><a href="#bytebase.v1.User">User</a></td>+ <td></td>+ <td><p>The user to create. </p></td></tr></tbody>@@ -9164,8 +8974,8 @@ the call will be blocked and an ABORTED error will be returned. </p></td>- <h3 id="bytebase.v1.SetIamPolicyRequest">SetIamPolicyRequest</h3>- <p>Request message for setting an IAM policy.</p>+ <h3 id="bytebase.v1.DeleteUserRequest">DeleteUserRequest</h3>+ <p></p><table class="field-table">@@ -9175,26 +8985,11 @@ the call will be blocked and an ABORTED error will be returned. </p></td><tbody><tr>- <td>resource</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>The name of the resource to set the IAM policy.-Format: projects/{project}-Format: workspaces/{workspace} </p></td>- </tr>-- <tr>- <td>policy</td>- <td><a href="#bytebase.v1.IamPolicy">IamPolicy</a></td>- <td></td>- <td><p> </p></td>- </tr>-- <tr>- <td>etag</td>+ <td>name</td><td><a href="#string">string</a></td><td></td>- <td><p>The current etag of the policy. </p></td>+ <td><p>The name of the user to delete.+Format: users/{email} </p></td></tr></tbody>@@ -9204,51 +8999,8 @@ Format: workspaces/{workspace} </p></td>--- <h3 id="bytebase.v1.BindingDelta.Action">BindingDelta.Action</h3>- <p>Type of action performed on a binding.</p>- <table class="enum-table">- <thead>- <tr><td>Name</td><td>Number</td><td>Description</td></tr>- </thead>- <tbody>-- <tr>- <td>ACTION_UNSPECIFIED</td>- <td>0</td>- <td><p>Unspecified action.</p></td>- </tr>-- <tr>- <td>ADD</td>- <td>1</td>- <td><p>Add a binding.</p></td>- </tr>-- <tr>- <td>REMOVE</td>- <td>2</td>- <td><p>Remove a binding.</p></td>- </tr>-- </tbody>- </table>-------- <div class="file-heading">- <h2 id="v1/audit_log_service.proto">v1/audit_log_service.proto</h2><a href="#title">Top</a>- </div>- <p></p>--- <h3 id="bytebase.v1.AuditData">AuditData</h3>- <p>Additional audit data specific to certain operations.</p>+ <h3 id="bytebase.v1.GetUserRequest">GetUserRequest</h3>+ <p></p><table class="field-table">@@ -9258,10 +9010,11 @@ Format: workspaces/{workspace} </p></td><tbody><tr>- <td>policy_delta</td>- <td><a href="#bytebase.v1.PolicyDelta">PolicyDelta</a></td>+ <td>name</td>+ <td><a href="#string">string</a></td><td></td>- <td><p>Changes to IAM policies. </p></td>+ <td><p>The name of the user to retrieve.+Format: users/{email} </p></td></tr></tbody>@@ -9271,8 +9024,8 @@ Format: workspaces/{workspace} </p></td>- <h3 id="bytebase.v1.AuditLog">AuditLog</h3>- <p>Audit log entry recording system activity or API call.</p>+ <h3 id="bytebase.v1.ListUsersRequest">ListUsersRequest</h3>+ <p></p><table class="field-table">@@ -9282,93 +9035,146 @@ Format: workspaces/{workspace} </p></td><tbody><tr>- <td>name</td>- <td><a href="#string">string</a></td>+ <td>page_size</td>+ <td><a href="#int32">int32</a></td><td></td>- <td><p>The name of the log.-Formats:-- projects/{project}/auditLogs/{uid}-- workspaces/{workspace}/auditLogs/{uid} </p></td>+ <td><p>The maximum number of users to return. The service may return fewer than+this value.+If unspecified, at most 10 users will be returned.+The maximum value is 1000; values above 1000 will be coerced to 1000. </p></td></tr><tr>- <td>create_time</td>- <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>+ <td>page_token</td>+ <td><a href="#string">string</a></td><td></td>- <td><p>The timestamp when the audit log was created. </p></td>+ <td><p>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. </p></td></tr><tr>- <td>user</td>- <td><a href="#string">string</a></td>+ <td>show_deleted</td>+ <td><a href="#bool">bool</a></td><td></td>- <td><p>The user who performed the action.-Format: users/{email} </p></td>+ <td><p>Show deleted users if specified. </p></td></tr><tr>- <td>method</td>+ <td>filter</td><td><a href="#string">string</a></td><td></td>- <td><p>The method or action being audited.-For example: /bytebase.v1.SQLService/Query or bb.project.repository.push </p></td>+ <td><p>Filter is used to filter users returned in the list.+The syntax and semantics of CEL are documented at https://github.com/google/cel-spec++Supported filter:+- name: the user name, support "==" and ".matches()" operator.+- email: the user email, support "==" and ".matches()" operator.+- state: check State enum for values, support "==" operator.+- project: the project full name in "projects/{id}" format, support "==" operator.++For example:+name == "ed"+name.matches("ed")+email == "[email protected]"+email.matches("ed")+state == "DELETED"+project == "projects/sample-project"+You can combine filter conditions like:+name.matches("ed") && project == "projects/sample-project"+(name == "ed" || email == "[email protected]") && project == "projects/sample-project" </p></td></tr>- <tr>- <td>severity</td>- <td><a href="#bytebase.v1.AuditLog.Severity">AuditLog.Severity</a></td>- <td></td>- <td><p>The severity level of this audit log entry. </p></td>- </tr>+ </tbody>+ </table>++++++ <h3 id="bytebase.v1.ListUsersResponse">ListUsersResponse</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>resource</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>The resource associated with this audit log. </p></td>+ <td>users</td>+ <td><a href="#bytebase.v1.User">User</a></td>+ <td>repeated</td>+ <td><p>The users from the specified request. </p></td></tr><tr>- <td>request</td>+ <td>next_page_token</td><td><a href="#string">string</a></td><td></td>- <td><p>The request payload in JSON format. </p></td>+ <td><p>A token, which can be sent as `page_token` to retrieve the next page.+If this field is omitted, there are no subsequent pages. </p></td></tr>- <tr>- <td>response</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>The response payload in JSON format.-Some fields may be omitted if they are too large or contain sensitive information. </p></td>- </tr>+ </tbody>+ </table>++++++ <h3 id="bytebase.v1.UndeleteUserRequest">UndeleteUserRequest</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>status</td>- <td><a href="#google.rpc.Status">google.rpc.Status</a></td>+ <td>name</td>+ <td><a href="#string">string</a></td><td></td>- <td><p>The status of the operation. </p></td>+ <td><p>The name of the deleted user.+Format: users/{email} </p></td></tr>- <tr>- <td>latency</td>- <td><a href="#google.protobuf.Duration">google.protobuf.Duration</a></td>- <td></td>- <td><p>The duration of the operation. </p></td>- </tr>+ </tbody>+ </table>++++++ <h3 id="bytebase.v1.UpdateEmailRequest">UpdateEmailRequest</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>service_data</td>- <td><a href="#google.protobuf.Any">google.protobuf.Any</a></td>+ <td>name</td>+ <td><a href="#string">string</a></td><td></td>- <td><p>Service-specific metadata about the request, response, and activities. </p></td>+ <td><p>The name of the user whose email to update.+Format: users/{email}+Note: This is the current (old) email address. The new email is specified in the 'email' field. </p></td></tr><tr>- <td>request_metadata</td>- <td><a href="#bytebase.v1.RequestMetadata">RequestMetadata</a></td>+ <td>email</td>+ <td><a href="#string">string</a></td><td></td>- <td><p>Metadata about the request context. </p></td>+ <td><p>The new email address. </p></td></tr></tbody>@@ -9378,8 +9184,8 @@ Some fields may be omitted if they are too large or contain sensitive informatio- <h3 id="bytebase.v1.ExportAuditLogsRequest">ExportAuditLogsRequest</h3>- <p>Request message for exporting audit logs.</p>+ <h3 id="bytebase.v1.UpdateUserRequest">UpdateUserRequest</h3>+ <p></p><table class="field-table">@@ -9389,54 +9195,50 @@ Some fields may be omitted if they are too large or contain sensitive informatio<tbody><tr>- <td>parent</td>- <td><a href="#string">string</a></td>+ <td>user</td>+ <td><a href="#bytebase.v1.User">User</a></td><td></td>- <td><p> </p></td>+ <td><p>The user to update.++The user's `name` field is used to identify the user to update.+Format: users/{email} </p></td></tr><tr>- <td>filter</td>- <td><a href="#string">string</a></td>+ <td>update_mask</td>+ <td><a href="#google.protobuf.FieldMask">google.protobuf.FieldMask</a></td><td></td>- <td><p>The filter of the log. It should be a valid CEL expression.-Check the filter field in the SearchAuditLogsRequest message. </p></td>+ <td><p>The list of fields to update. </p></td></tr><tr>- <td>order_by</td>+ <td>otp_code</td><td><a href="#string">string</a></td>- <td></td>- <td><p>The order by of the log.-Only support order by create_time. The default sorting order is ascending.-For example:- - order_by = "create_time asc"- - order_by = "create_time desc" </p></td>+ <td>optional</td>+ <td><p>The otp_code is used to verify the user's identity by MFA. </p></td></tr><tr>- <td>format</td>- <td><a href="#bytebase.v1.ExportFormat">ExportFormat</a></td>+ <td>regenerate_temp_mfa_secret</td>+ <td><a href="#bool">bool</a></td><td></td>- <td><p>The export format. </p></td>+ <td><p>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. </p></td></tr><tr>- <td>page_size</td>- <td><a href="#int32">int32</a></td>+ <td>regenerate_recovery_codes</td>+ <td><a href="#bool">bool</a></td><td></td>- <td><p>The maximum number of logs to return.-The service may return fewer than this value.-If unspecified, at most 10 log entries will be returned.-The maximum value is 5000; values above 5000 will be coerced to 5000. </p></td>+ <td><p>The regenerate_recovery_codes flag means to regenerate recovery codes for user. </p></td></tr><tr>- <td>page_token</td>- <td><a href="#string">string</a></td>+ <td>allow_missing</td>+ <td><a href="#bool">bool</a></td><td></td>- <td><p>A page token, received from a previous `ExportAuditLogs` call.-Provide this to retrieve the subsequent page. </p></td>+ <td><p>If set to true, and the user is not found, a new user will be created.+In this situation, `update_mask` is ignored. </p></td></tr></tbody>@@ -9446,8 +9248,8 @@ Provide this to retrieve the subsequent page. </p></td>- <h3 id="bytebase.v1.ExportAuditLogsResponse">ExportAuditLogsResponse</h3>- <p>Response message for exporting audit logs.</p>+ <h3 id="bytebase.v1.User">User</h3>+ <p></p><table class="field-table">@@ -9457,124 +9259,97 @@ Provide this to retrieve the subsequent page. </p></td><tbody><tr>- <td>content</td>- <td><a href="#bytes">bytes</a></td>+ <td>name</td>+ <td><a href="#string">string</a></td><td></td>- <td><p>The exported audit log content in the requested format. </p></td>+ <td><p>The name of the user.+Format: users/{email} </p></td></tr><tr>- <td>next_page_token</td>+ <td>state</td>+ <td><a href="#bytebase.v1.State">State</a></td>+ <td></td>+ <td><p>The lifecycle state of the user account. </p></td>+ </tr>++ <tr>+ <td>email</td><td><a href="#string">string</a></td><td></td>- <td><p>A token to retrieve next page of log entities.-Pass this value in the page_token field in the subsequent call-to retrieve the next page of log entities. </p></td>+ <td><p>The email address of the user, used for login and notifications. </p></td></tr>- </tbody>- </table>------ <h3 id="bytebase.v1.RequestMetadata">RequestMetadata</h3>- <p>Metadata about the incoming request.</p>--- <table class="field-table">- <thead>- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>- </thead>- <tbody>+ <tr>+ <td>title</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>The display title or full name of the user. </p></td>+ </tr><tr>- <td>caller_ip</td>+ <td>password</td><td><a href="#string">string</a></td><td></td>- <td><p>The IP address of the request originator. </p></td>+ <td><p>The password for authentication. Only used during user creation or password updates. </p></td></tr><tr>- <td>caller_supplied_user_agent</td>+ <td>service_key</td><td><a href="#string">string</a></td><td></td>- <td><p>The user agent string provided by the caller.-This is supplied by the client and is not authenticated. </p></td>+ <td><p>The service key for service account authentication. Only used for service accounts. </p></td></tr>- </tbody>- </table>------ <h3 id="bytebase.v1.SearchAuditLogsRequest">SearchAuditLogsRequest</h3>- <p>Request message for searching audit logs.</p>--- <table class="field-table">- <thead>- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>- </thead>- <tbody>+ <tr>+ <td>mfa_enabled</td>+ <td><a href="#bool">bool</a></td>+ <td></td>+ <td><p>The mfa_enabled flag means if the user has enabled MFA. </p></td>+ </tr><tr>- <td>parent</td>+ <td>temp_otp_secret</td><td><a href="#string">string</a></td><td></td>- <td><p> </p></td>+ <td><p>Temporary OTP secret used during MFA setup and regeneration. </p></td></tr><tr>- <td>filter</td>+ <td>temp_recovery_codes</td><td><a href="#string">string</a></td>+ <td>repeated</td>+ <td><p>Temporary recovery codes used during MFA setup and regeneration. </p></td>+ </tr>++ <tr>+ <td>temp_otp_secret_created_time</td>+ <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td><td></td>- <td><p>The filter of the log. It should be a valid CEL expression.-The syntax and semantics of CEL are documented at https://github.com/google/cel-spec--Supported filter:-- method: the API name, can be found in the docs, should start with "/bytebase.v1." prefix. For example "/bytebase.v1.UserService/CreateUser". Support "==" operator.-- severity: support "==" operator, check Severity enum in AuditLog message for values.-- user: the actor, should in "users/{email}" format, support "==" operator.-- create_time: support ">=" and "<=" operator.--For example:- - filter = "method == '/bytebase.v1.SQLService/Query'"- - filter = "method == '/bytebase.v1.SQLService/Query' && severity == 'ERROR'"- - filter = "method == '/bytebase.v1.SQLService/Query' && severity == 'ERROR' && user == 'users/[email protected]'"- - filter = "method == '/bytebase.v1.SQLService/Query' && severity == 'ERROR' && create_time <= '2021-01-01T00:00:00Z' && create_time >= '2020-01-01T00:00:00Z'" </p></td>+ <td><p>Timestamp when temp_otp_secret was created. Used by frontend to show countdown timer. </p></td></tr><tr>- <td>order_by</td>+ <td>phone</td><td><a href="#string">string</a></td><td></td>- <td><p>The order by of the log.-Only support order by create_time. The default sorting order is ascending.-For example:- - order_by = "create_time asc"- - order_by = "create_time desc" </p></td>+ <td><p>Should be a valid E.164 compliant phone number.+Could be empty. </p></td></tr><tr>- <td>page_size</td>- <td><a href="#int32">int32</a></td>+ <td>profile</td>+ <td><a href="#bytebase.v1.User.Profile">User.Profile</a></td><td></td>- <td><p>The maximum number of logs to return.-The service may return fewer than this value.-If unspecified, at most 10 log entries will be returned.-The maximum value is 5000; values above 5000 will be coerced to 5000. </p></td>+ <td><p>User profile metadata. </p></td></tr><tr>- <td>page_token</td>+ <td>groups</td><td><a href="#string">string</a></td>- <td></td>- <td><p>A page token, received from a previous `SearchLogs` call.-Provide this to retrieve the subsequent page. </p></td>+ <td>repeated</td>+ <td><p>The groups for the user.+Format: groups/{email} </p></td></tr></tbody>@@ -9584,8 +9359,8 @@ Provide this to retrieve the subsequent page. </p></td>- <h3 id="bytebase.v1.SearchAuditLogsResponse">SearchAuditLogsResponse</h3>- <p>Response message for searching audit logs.</p>+ <h3 id="bytebase.v1.User.Profile">User.Profile</h3>+ <p></p><table class="field-table">@@ -9595,19 +9370,24 @@ Provide this to retrieve the subsequent page. </p></td><tbody><tr>- <td>audit_logs</td>- <td><a href="#bytebase.v1.AuditLog">AuditLog</a></td>- <td>repeated</td>- <td><p> </p></td>+ <td>last_login_time</td>+ <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>+ <td></td>+ <td><p>The last time the user successfully logged in. </p></td></tr><tr>- <td>next_page_token</td>+ <td>last_change_password_time</td>+ <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>+ <td></td>+ <td><p>The last time the user changed their password. </p></td>+ </tr>++ <tr>+ <td>source</td><td><a href="#string">string</a></td><td></td>- <td><p>A token to retrieve next page of log entities.-Pass this value in the page_token field in the subsequent call-to retrieve the next page of log entities. </p></td>+ <td><p>source means where the user comes from. For now we support Entra ID SCIM sync, so the source could be Entra ID. </p></td></tr></tbody>@@ -9619,97 +9399,92 @@ to retrieve the next page of log entities. </p></td>- <h3 id="bytebase.v1.AuditLog.Severity">AuditLog.Severity</h3>- <p>Severity level for audit log entries.</p>- <table class="enum-table">- <thead>- <tr><td>Name</td><td>Number</td><td>Description</td></tr>- </thead>- <tbody>-- <tr>- <td>SEVERITY_UNSPECIFIED</td>- <td>0</td>- <td><p>Unspecified severity level.</p></td>- </tr>-- <tr>- <td>DEBUG</td>- <td>1</td>- <td><p>Debug-level information.</p></td>- </tr>+++++ <h3 id="bytebase.v1.UserService">UserService</h3>+ <p>UserService manages user accounts and authentication.</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>INFO</td>- <td>2</td>- <td><p>Informational messages.</p></td>+ <td>GetUser</td>+ <td><a href="#bytebase.v1.GetUserRequest">GetUserRequest</a></td>+ <td><a href="#bytebase.v1.User">User</a></td>+ <td><p>Get the user.+Any authenticated user can get the user.+Permissions required: bb.users.get</p></td></tr><tr>- <td>NOTICE</td>- <td>3</td>- <td><p>Notable events.</p></td>+ <td>BatchGetUsers</td>+ <td><a href="#bytebase.v1.BatchGetUsersRequest">BatchGetUsersRequest</a></td>+ <td><a href="#bytebase.v1.BatchGetUsersResponse">BatchGetUsersResponse</a></td>+ <td><p>Get the users in batch.+Any authenticated user can batch get users.+Permissions required: bb.users.get</p></td></tr><tr>- <td>WARNING</td>- <td>4</td>- <td><p>Warning conditions.</p></td>+ <td>GetCurrentUser</td>+ <td><a href="#google.protobuf.Empty">.google.protobuf.Empty</a></td>+ <td><a href="#bytebase.v1.User">User</a></td>+ <td><p>Get the current authenticated user.+Permissions required: None</p></td></tr><tr>- <td>ERROR</td>- <td>5</td>- <td><p>Error conditions.</p></td>+ <td>ListUsers</td>+ <td><a href="#bytebase.v1.ListUsersRequest">ListUsersRequest</a></td>+ <td><a href="#bytebase.v1.ListUsersResponse">ListUsersResponse</a></td>+ <td><p>List all users.+Any authenticated user can list users.+Permissions required: bb.users.list</p></td></tr><tr>- <td>CRITICAL</td>- <td>6</td>- <td><p>Critical conditions.</p></td>+ <td>CreateUser</td>+ <td><a href="#bytebase.v1.CreateUserRequest">CreateUserRequest</a></td>+ <td><a href="#bytebase.v1.User">User</a></td>+ <td><p>Creates a user. When Disallow Signup is enabled, requires bb.users.create permission; otherwise any user can sign up.+Permissions required: bb.users.create (only when Disallow Signup is enabled)</p></td></tr><tr>- <td>ALERT</td>- <td>7</td>- <td><p>Action must be taken immediately.</p></td>+ <td>UpdateUser</td>+ <td><a href="#bytebase.v1.UpdateUserRequest">UpdateUserRequest</a></td>+ <td><a href="#bytebase.v1.User">User</a></td>+ <td><p>Updates a user. Users can update their own profile, or users with bb.users.update permission can update any user.+Note: Email updates are not supported through this API. Use UpdateEmail instead.+Permissions required: bb.users.update (or self)</p></td></tr><tr>- <td>EMERGENCY</td>- <td>8</td>- <td><p>System is unusable.</p></td>+ <td>DeleteUser</td>+ <td><a href="#bytebase.v1.DeleteUserRequest">DeleteUserRequest</a></td>+ <td><a href="#google.protobuf.Empty">.google.protobuf.Empty</a></td>+ <td><p>Deletes a user. Requires bb.users.delete permission with additional validation: the last remaining workspace admin cannot be deleted.+Permissions required: bb.users.delete</p></td></tr>- </tbody>- </table>------ <h3 id="bytebase.v1.AuditLogService">AuditLogService</h3>- <p>AuditLogService manages audit logs for system activities and API calls.</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>SearchAuditLogs</td>- <td><a href="#bytebase.v1.SearchAuditLogsRequest">SearchAuditLogsRequest</a></td>- <td><a href="#bytebase.v1.SearchAuditLogsResponse">SearchAuditLogsResponse</a></td>- <td><p>Searches audit logs with optional filtering and pagination.-Permissions required: bb.auditLogs.search</p></td>+ <td>UndeleteUser</td>+ <td><a href="#bytebase.v1.UndeleteUserRequest">UndeleteUserRequest</a></td>+ <td><a href="#bytebase.v1.User">User</a></td>+ <td><p>Restores a deleted user.+Permissions required: bb.users.undelete</p></td></tr><tr>- <td>ExportAuditLogs</td>- <td><a href="#bytebase.v1.ExportAuditLogsRequest">ExportAuditLogsRequest</a></td>- <td><a href="#bytebase.v1.ExportAuditLogsResponse">ExportAuditLogsResponse</a></td>- <td><p>Exports audit logs in a specified format for external analysis.-Permissions required: bb.auditLogs.export</p></td>+ <td>UpdateEmail</td>+ <td><a href="#bytebase.v1.UpdateEmailRequest">UpdateEmailRequest</a></td>+ <td><a href="#bytebase.v1.User">User</a></td>+ <td><p>Updates a user's email address.+Permissions required: bb.users.updateEmail</p></td></tr></tbody>@@ -9733,33 +9508,89 @@ Permissions required: bb.auditLogs.export</p></td><tr>- <td>SearchAuditLogs</td>- <td>POST</td>- <td>/v1/{parent=projects/*}/auditLogs:search</td>- <td>*</td>+ <td>GetUser</td>+ <td>GET</td>+ <td>/v1/{name=users/*}</td>+ <td></td></tr>+++<tr>- <td>SearchAuditLogs</td>+ <td>BatchGetUsers</td>+ <td>GET</td>+ <td>/v1/users:batchGet</td>+ <td></td>+ </tr>+++++ <tr>+ <td>GetCurrentUser</td>+ <td>GET</td>+ <td>/v1/users/me</td>+ <td></td>+ </tr>+++++ <tr>+ <td>ListUsers</td>+ <td>GET</td>+ <td>/v1/users</td>+ <td></td>+ </tr>+++++ <tr>+ <td>CreateUser</td><td>POST</td>- <td>/v1/auditLogs:search</td>- <td>*</td>+ <td>/v1/users</td>+ <td>user</td></tr><tr>- <td>ExportAuditLogs</td>+ <td>UpdateUser</td>+ <td>PATCH</td>+ <td>/v1/{user.name=users/*}</td>+ <td>user</td>+ </tr>+++++ <tr>+ <td>DeleteUser</td>+ <td>DELETE</td>+ <td>/v1/{name=users/*}</td>+ <td></td>+ </tr>+++++ <tr>+ <td>UndeleteUser</td><td>POST</td>- <td>/v1/{parent=projects/*}/auditLogs:export</td>+ <td>/v1/{name=users/*}:undelete</td><td>*</td></tr>+++<tr>- <td>ExportAuditLogs</td>+ <td>UpdateEmail</td><td>POST</td>- <td>/v1/auditLogs:export</td>+ <td>/v1/{name=users/*}:updateEmail</td><td>*</td></tr>@@ -31169,8 +31000,82 @@ For project-level: {name}@{project-id}.workload.bytebase.com </p></td>+ <h3 id="bytebase.v1.WorkloadIdentityConfig">WorkloadIdentityConfig</h3>+ <p>WorkloadIdentityConfig for API layer</p>+++ <table class="field-table">+ <thead>+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>provider_type</td>+ <td><a href="#bytebase.v1.WorkloadIdentityConfig.ProviderType">WorkloadIdentityConfig.ProviderType</a></td>+ <td></td>+ <td><p>Platform type (currently only GITHUB is supported) </p></td>+ </tr>++ <tr>+ <td>issuer_url</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>OIDC Issuer URL (auto-filled based on provider_type, can be overridden) </p></td>+ </tr>++ <tr>+ <td>allowed_audiences</td>+ <td><a href="#string">string</a></td>+ <td>repeated</td>+ <td><p>Allowed audiences for token validation </p></td>+ </tr>++ <tr>+ <td>subject_pattern</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>Subject pattern to match (e.g., "repo:owner/repo:ref:refs/heads/main") </p></td>+ </tr>++ </tbody>+ </table>++++++ <h3 id="bytebase.v1.WorkloadIdentityConfig.ProviderType">WorkloadIdentityConfig.ProviderType</h3>+ <p>ProviderType identifies the CI/CD platform.</p>+ <table class="enum-table">+ <thead>+ <tr><td>Name</td><td>Number</td><td>Description</td></tr>+ </thead>+ <tbody>++ <tr>+ <td>PROVIDER_TYPE_UNSPECIFIED</td>+ <td>0</td>+ <td><p></p></td>+ </tr>++ <tr>+ <td>GITHUB</td>+ <td>1</td>+ <td><p></p></td>+ </tr>++ <tr>+ <td>GITLAB</td>+ <td>2</td>+ <td><p></p></td>+ </tr>++ </tbody>+ </table>+diff --git a/proto/store/store/user.proto b/proto/store/store/user.protoindex e29342ebb9..a91102982e 100644--- a/proto/store/store/user.proto+++ b/proto/store/store/user.proto@@ -40,8 +40,7 @@ message UserProfile {google.protobuf.Timestamp last_change_password_time = 2;// The source indicates where the user comes from. For now we support Entra ID SCIM sync, so the source could be Entra ID.string source = 3;- // Workload identity configuration (only for WORKLOAD_IDENTITY type)- WorkloadIdentityConfig workload_identity_config = 4;+ reserved 4;}// WorkloadIdentityConfig stores OIDC configuration for workload identity.diff --git a/proto/v1/v1/actuator_service.proto b/proto/v1/v1/actuator_service.protoindex 0350472cf0..b402b14087 100644--- a/proto/v1/v1/actuator_service.proto+++ b/proto/v1/v1/actuator_service.proto@@ -8,9 +8,7 @@ import "google/api/field_behavior.proto";import "google/protobuf/empty.proto";import "google/protobuf/timestamp.proto";import "v1/annotation.proto";-import "v1/common.proto";import "v1/setting_service.proto";-import "v1/user_service.proto";option go_package = "github.com/bytebase/bytebase/backend/generated-go/v1";@@ -124,18 +122,8 @@ message ActuatorInfo {// Whether the Bytebase instance is running in Docker.bool docker = 18 [(google.api.field_behavior) = OUTPUT_ONLY];- // User statistics by type and state.- message StatUser {- // The type of user.- UserType user_type = 1;- // The state of the user.- State state = 2;- // The count of users matching this type and state.- int32 count = 3;- }-- // Statistics about users in the system.- repeated StatUser user_stats = 19 [(google.api.field_behavior) = OUTPUT_ONLY];+ // The number of activated users.+ int32 activated_user_count = 19 [(google.api.field_behavior) = OUTPUT_ONLY];// The number of activated database instances.int32 activated_instance_count = 20 [(google.api.field_behavior) = OUTPUT_ONLY];diff --git a/proto/v1/v1/user_service.proto b/proto/v1/v1/user_service.protoindex 34cd28f819..957be65af3 100644--- a/proto/v1/v1/user_service.proto+++ b/proto/v1/v1/user_service.proto@@ -247,6 +247,8 @@ message UpdateEmailRequest {}message User {+ reserved 5, 15;+option (google.api.resource) = {type: "bytebase.com/User"pattern: "users/{email}"@@ -265,9 +267,6 @@ message User {// The display title or full name of the user.string title = 4 [(buf.validate.field).string.max_len = 200];- // The type of user account.- UserType user_type = 5;-// The password for authentication. Only used during user creation or password updates.string password = 6 [(google.api.field_behavior) = INPUT_ONLY];@@ -305,37 +304,4 @@ message User {// The groups for the user.// Format: groups/{email}repeated string groups = 14 [(google.api.field_behavior) = OUTPUT_ONLY];-- // Workload Identity configuration (only for WORKLOAD_IDENTITY type)- WorkloadIdentityConfig workload_identity_config = 15;-}--// WorkloadIdentityConfig for API layer-message WorkloadIdentityConfig {- // ProviderType identifies the CI/CD platform.- enum ProviderType {- PROVIDER_TYPE_UNSPECIFIED = 0;- GITHUB = 1;- GITLAB = 2;- }-- // Platform type (currently only GITHUB is supported)- ProviderType provider_type = 1;- // OIDC Issuer URL (auto-filled based on provider_type, can be overridden)- string issuer_url = 2;- // Allowed audiences for token validation- repeated string allowed_audiences = 3;- // Subject pattern to match (e.g., "repo:owner/repo:ref:refs/heads/main")- string subject_pattern = 4;-}--enum UserType {- // Unspecified user type.- USER_TYPE_UNSPECIFIED = 0;- // Regular human user account.- USER = 1;- // External CI/CD workload identity.- WORKLOAD_IDENTITY = 2;- // Service account for API integrations.- SERVICE_ACCOUNT = 3;}diff --git a/proto/v1/v1/workload_identity_service.proto b/proto/v1/v1/workload_identity_service.protoindex ce7901bcfa..9963219a46 100644--- a/proto/v1/v1/workload_identity_service.proto+++ b/proto/v1/v1/workload_identity_service.proto@@ -12,7 +12,6 @@ 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 = "github.com/bytebase/bytebase/backend/generated-go/v1";@@ -123,6 +122,25 @@ message WorkloadIdentity {WorkloadIdentityConfig workload_identity_config = 6;}+// WorkloadIdentityConfig for API layer+message WorkloadIdentityConfig {+ // ProviderType identifies the CI/CD platform.+ enum ProviderType {+ PROVIDER_TYPE_UNSPECIFIED = 0;+ GITHUB = 1;+ GITLAB = 2;+ }++ // Platform type (currently only GITHUB is supported)+ ProviderType provider_type = 1;+ // OIDC Issuer URL (auto-filled based on provider_type, can be overridden)+ string issuer_url = 2;+ // Allowed audiences for token validation+ repeated string allowed_audiences = 3;+ // Subject pattern to match (e.g., "repo:owner/repo:ref:refs/heads/main")+ string subject_pattern = 4;+}+// Request message for creating a workload identity.message CreateWorkloadIdentityRequest {// The parent resource where this workload identity will be created.