Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: bb.branches.admin (#13190)
Danny Xu11b5b43bc3af
diff --git a/backend/api/v1/branch_service.go b/backend/api/v1/branch_service.goindex 28d9b1819b..6aa232c059 100644--- a/backend/api/v1/branch_service.go+++ b/backend/api/v1/branch_service.go@@ -6,7 +6,6 @@ import ("fmt""io""log/slog"- "path""slices""strconv""strings"@@ -139,13 +138,19 @@ func (s *BranchService) CreateBranch(ctx context.Context, request *v1pb.CreateBrif branch != nil {return nil, status.Errorf(codes.FailedPrecondition, "branch %q has already existed", branchID)}- // Branch protection check.user, ok := ctx.Value(common.UserContextKey).(*store.UserMessage)if !ok {return nil, status.Errorf(codes.Internal, "user not found")}- if err := s.checkProtectionRules(ctx, project, branchID, request.GetBranch().GetBaselineDatabase() != "", user); err != nil {- return nil, err+ // Main branch IAM admin check.+ if request.GetBranch().GetParentBranch() == "" {+ ok, err := s.iamManager.CheckPermission(ctx, iam.PermissionBranchesAdmin, user, project.ResourceID)+ if err != nil {+ return nil, err+ }+ if !ok {+ return nil, status.Errorf(codes.InvalidArgument, "only users with %s permission can create a main branch", iam.PermissionBranchesAdmin)+ }}var createdBranch *store.BranchMessage@@ -550,9 +555,6 @@ func (s *BranchService) RebaseBranch(ctx context.Context, request *v1pb.RebaseBrif !ok {return nil, status.Errorf(codes.PermissionDenied, "permission denied to rebase branch")}- if err := s.checkProtectionRules(ctx, baseProject, baseBranchID, baseBranch.Config.SourceDatabase != "", user); err != nil {- return nil, err- }filteredNewBaseMetadata, newBaseSchema, newBaseConfig, err := s.getFilteredNewBaseFromRebaseRequest(ctx, request)if err != nil {@@ -758,8 +760,15 @@ func (s *BranchService) DeleteBranch(ctx context.Context, request *v1pb.DeleteBrif !ok {return nil, status.Errorf(codes.PermissionDenied, "permission denied to delete branch")}- if err := s.checkProtectionRules(ctx, project, branchID, branch.Config.SourceDatabase != "", user); err != nil {- return nil, err+ // Main branch IAM admin check.+ if branch.Config.GetSourceBranch() == "" {+ ok, err := s.iamManager.CheckPermission(ctx, iam.PermissionBranchesAdmin, user, project.ResourceID)+ if err != nil {+ return nil, err+ }+ if !ok {+ return nil, status.Errorf(codes.InvalidArgument, "only users with %s permission can create a main branch", iam.PermissionBranchesAdmin)+ }}if !request.Force {@@ -851,43 +860,6 @@ func (s *BranchService) getProject(ctx context.Context, projectID string) (*storreturn project, nil}-func (s *BranchService) checkProtectionRules(ctx context.Context, project *store.ProjectMessage, branchID string, databaseSource bool, user *store.UserMessage) error {- if len(project.Setting.GetProtectionRules()) == 0 {- return nil- }-- policy, err := s.store.GetProjectIamPolicy(ctx, project.UID)- if err != nil {- return err- }- roles := utils.GetUserFormattedRolesMap(ctx, s.store, user, policy.Policy)-- for _, rule := range project.Setting.ProtectionRules {- if rule.Target != storepb.ProtectionRule_BRANCH {- continue- }- if rule.GetBranchSource() == storepb.ProtectionRule_DATABASE && !databaseSource {- continue- }- if rule.NameFilter != "" {- ok, err := path.Match(rule.NameFilter, branchID)- if err != nil {- return err- }- if !ok {- continue- }- }-- for _, role := range rule.AllowedRoles {- if _, ok := roles[role]; ok {- return nil- }- }- }- return status.Errorf(codes.InvalidArgument, "not allowed to create branch by project protection rules")-}-func (s *BranchService) convertBranchToBranch(ctx context.Context, project *store.ProjectMessage, branch *store.BranchMessage, view v1pb.BranchView) (*v1pb.Branch, error) {creator, err := s.store.GetUserByID(ctx, branch.CreatorID)if err != nil {diff --git a/backend/api/v1/project_service.go b/backend/api/v1/project_service.goindex 4d2a152724..dccd8d1c26 100644--- a/backend/api/v1/project_service.go+++ b/backend/api/v1/project_service.go@@ -858,104 +858,13 @@ func (s *ProjectService) TestWebhook(ctx context.Context, request *v1pb.TestWebh}// GetProjectProtectionRules gets a project protection rules.-func (s *ProjectService) GetProjectProtectionRules(ctx context.Context, request *v1pb.GetProjectProtectionRulesRequest) (*v1pb.ProtectionRules, error) {- projectName, err := common.TrimSuffix(request.Name, common.ProtectionRulesSuffix)- if err != nil {- return nil, status.Errorf(codes.InvalidArgument, err.Error())- }- projectResourceID, err := common.GetProjectID(projectName)- if err != nil {- return nil, status.Errorf(codes.InvalidArgument, err.Error())- }- project, err := s.store.GetProjectV2(ctx, &store.FindProjectMessage{- ResourceID: &projectResourceID,- })- if err != nil {- return nil, status.Errorf(codes.Internal, err.Error())- }- if project == nil {- return nil, status.Errorf(codes.NotFound, "project %q not found", projectResourceID)- }- if project.Deleted {- return nil, status.Errorf(codes.NotFound, "project %q has been deleted", projectResourceID)- }-- resp := convertProtectionRules(project)- return resp, nil+func (*ProjectService) GetProjectProtectionRules(_ context.Context, _ *v1pb.GetProjectProtectionRulesRequest) (*v1pb.ProtectionRules, error) {+ return &v1pb.ProtectionRules{}, nil}// UpdateProjectProtectionRules updates a project protection rules.-func (s *ProjectService) UpdateProjectProtectionRules(ctx context.Context, request *v1pb.UpdateProjectProtectionRulesRequest) (*v1pb.ProtectionRules, error) {- if request.ProtectionRules == nil {- return nil, status.Errorf(codes.InvalidArgument, "protection rules must be set")- }- projectName, err := common.TrimSuffix(request.ProtectionRules.Name, common.ProtectionRulesSuffix)- if err != nil {- return nil, status.Errorf(codes.InvalidArgument, err.Error())- }- projectResourceID, err := common.GetProjectID(projectName)- if err != nil {- return nil, status.Errorf(codes.InvalidArgument, err.Error())- }- project, err := s.store.GetProjectV2(ctx, &store.FindProjectMessage{- ResourceID: &projectResourceID,- })- if err != nil {- return nil, status.Errorf(codes.Internal, err.Error())- }- if project == nil {- return nil, status.Errorf(codes.NotFound, "project %q not found", projectResourceID)- }- if project.Deleted {- return nil, status.Errorf(codes.NotFound, "project %q has been deleted", projectResourceID)- }-- var rules []*storepb.ProtectionRule- for _, rule := range request.ProtectionRules.Rules {- rules = append(rules, &storepb.ProtectionRule{- Id: rule.Id,- Target: storepb.ProtectionRule_Target(rule.Target),- NameFilter: rule.NameFilter,- BranchSource: storepb.ProtectionRule_BranchSource(rule.BranchSource),- AllowedRoles: rule.AllowedRoles,- })- }-- principalID, ok := ctx.Value(common.PrincipalIDContextKey).(int)- if !ok {- return nil, status.Errorf(codes.Internal, "principal ID not found")- }- setting := project.Setting- setting.ProtectionRules = rules- project, err = s.store.UpdateProjectV2(ctx, &store.UpdateProjectMessage{- UpdaterID: principalID,- ResourceID: project.ResourceID,- Setting: setting,- })- if err != nil {- return nil, status.Errorf(codes.Internal, err.Error())- }-- resp := convertProtectionRules(project)- return resp, nil-}--func convertProtectionRules(project *store.ProjectMessage) *v1pb.ProtectionRules {- resp := &v1pb.ProtectionRules{- Name: fmt.Sprintf("%s%s%s", common.ProjectNamePrefix, project.ResourceID, common.ProtectionRulesSuffix),- }- if project.Setting != nil {- for _, rule := range project.Setting.ProtectionRules {- resp.Rules = append(resp.Rules, &v1pb.ProtectionRule{- Id: rule.Id,- Target: v1pb.ProtectionRule_Target(rule.Target),- NameFilter: rule.NameFilter,- BranchSource: v1pb.ProtectionRule_BranchSource(rule.GetBranchSource()),- AllowedRoles: rule.AllowedRoles,- })- }- }- return resp+func (*ProjectService) UpdateProjectProtectionRules(_ context.Context, _ *v1pb.UpdateProjectProtectionRulesRequest) (*v1pb.ProtectionRules, error) {+ return &v1pb.ProtectionRules{}, nil}func convertToStoreProjectWebhookMessage(webhook *v1pb.Webhook) (*store.ProjectWebhookMessage, error) {diff --git a/backend/common/resource_name.go b/backend/common/resource_name.goindex c8df460e55..7c6c01f3ea 100644--- a/backend/common/resource_name.go+++ b/backend/common/resource_name.go@@ -50,10 +50,9 @@ const (GroupPrefix = "groups/"ReviewConfigPrefix = "reviewConfigs/"- SchemaSuffix = "/schema"- MetadataSuffix = "/metadata"- GitOpsInfoSuffix = "/gitOpsInfo"- ProtectionRulesSuffix = "/protectionRules"+ SchemaSuffix = "/schema"+ MetadataSuffix = "/metadata"+ GitOpsInfoSuffix = "/gitOpsInfo")// GetProjectID returns the project ID from a resource name.diff --git a/backend/component/iam/acl.yaml b/backend/component/iam/acl.yamlindex a9ff2865e0..195e868623 100644--- a/backend/component/iam/acl.yaml+++ b/backend/component/iam/acl.yaml@@ -4,6 +4,7 @@ roles:permissions:- bb.auditLogs.export- bb.auditLogs.search+ - bb.branches.admin- bb.branches.create- bb.branches.delete- bb.branches.get@@ -127,6 +128,7 @@ roles:permissions:- bb.auditLogs.export- bb.auditLogs.search+ - bb.branches.admin- bb.branches.create- bb.branches.delete- bb.branches.get@@ -261,6 +263,7 @@ roles:permissions:- bb.auditLogs.export- bb.auditLogs.search+ - bb.branches.admin- bb.branches.create- bb.branches.delete- bb.branches.getdiff --git a/backend/component/iam/permission.go b/backend/component/iam/permission.goindex caf402a315..70ccf9d9f3 100644--- a/backend/component/iam/permission.go+++ b/backend/component/iam/permission.go@@ -5,6 +5,7 @@ type Permission = stringconst (PermissionAuditLogsExport Permission = "bb.auditLogs.export"PermissionAuditLogsSearch Permission = "bb.auditLogs.search"+ PermissionBranchesAdmin Permission = "bb.branches.admin"PermissionBranchesCreate Permission = "bb.branches.create"PermissionBranchesDelete Permission = "bb.branches.delete"PermissionBranchesGet Permission = "bb.branches.get"@@ -128,6 +129,7 @@ const (var allPermissions = []Permission{PermissionAuditLogsExport,PermissionAuditLogsSearch,+ PermissionBranchesAdmin,PermissionBranchesCreate,PermissionBranchesDelete,PermissionBranchesGet,diff --git a/backend/component/iam/permission.yaml b/backend/component/iam/permission.yamlindex de88750228..93bda4d4a0 100644--- a/backend/component/iam/permission.yaml+++ b/backend/component/iam/permission.yaml@@ -1,6 +1,7 @@permissions:- bb.auditLogs.export- bb.auditLogs.search+ - bb.branches.admin- bb.branches.create- bb.branches.delete- bb.branches.getdiff --git a/frontend/src/types/proto/store/project.ts b/frontend/src/types/proto/store/project.tsindex 39c1c8a8df..9c8f0ebbe3 100644--- a/frontend/src/types/proto/store/project.ts+++ b/frontend/src/types/proto/store/project.ts@@ -11,7 +11,6 @@ export interface Label {}export interface Project {- protectionRules: ProtectionRule[];issueLabels: Label[];/** Force issue labels to be used when creating an issue. */forceIssueLabels: boolean;@@ -21,119 +20,6 @@ export interface Project {autoResolveIssue: boolean;}-export interface ProtectionRule {- /** A unique identifier for a node in UUID format. */- id: string;- target: ProtectionRule_Target;- /** The name of the branch/changelist or wildcard. */- nameFilter: string;- /**- * The roles allowed to create branches or changelists, rebase branches, delete branches.- * Format: roles/projectOwner.- */- allowedRoles: string[];- branchSource: ProtectionRule_BranchSource;-}--/** The type of target. */-export enum ProtectionRule_Target {- PROTECTION_TARGET_UNSPECIFIED = "PROTECTION_TARGET_UNSPECIFIED",- BRANCH = "BRANCH",- CHANGELIST = "CHANGELIST",- UNRECOGNIZED = "UNRECOGNIZED",-}--export function protectionRule_TargetFromJSON(object: any): ProtectionRule_Target {- switch (object) {- case 0:- case "PROTECTION_TARGET_UNSPECIFIED":- return ProtectionRule_Target.PROTECTION_TARGET_UNSPECIFIED;- case 1:- case "BRANCH":- return ProtectionRule_Target.BRANCH;- case 2:- case "CHANGELIST":- return ProtectionRule_Target.CHANGELIST;- case -1:- case "UNRECOGNIZED":- default:- return ProtectionRule_Target.UNRECOGNIZED;- }-}--export function protectionRule_TargetToJSON(object: ProtectionRule_Target): string {- switch (object) {- case ProtectionRule_Target.PROTECTION_TARGET_UNSPECIFIED:- return "PROTECTION_TARGET_UNSPECIFIED";- case ProtectionRule_Target.BRANCH:- return "BRANCH";- case ProtectionRule_Target.CHANGELIST:- return "CHANGELIST";- case ProtectionRule_Target.UNRECOGNIZED:- default:- return "UNRECOGNIZED";- }-}--export function protectionRule_TargetToNumber(object: ProtectionRule_Target): number {- switch (object) {- case ProtectionRule_Target.PROTECTION_TARGET_UNSPECIFIED:- return 0;- case ProtectionRule_Target.BRANCH:- return 1;- case ProtectionRule_Target.CHANGELIST:- return 2;- case ProtectionRule_Target.UNRECOGNIZED:- default:- return -1;- }-}--export enum ProtectionRule_BranchSource {- BRANCH_SOURCE_UNSPECIFIED = "BRANCH_SOURCE_UNSPECIFIED",- DATABASE = "DATABASE",- UNRECOGNIZED = "UNRECOGNIZED",-}--export function protectionRule_BranchSourceFromJSON(object: any): ProtectionRule_BranchSource {- switch (object) {- case 0:- case "BRANCH_SOURCE_UNSPECIFIED":- return ProtectionRule_BranchSource.BRANCH_SOURCE_UNSPECIFIED;- case 1:- case "DATABASE":- return ProtectionRule_BranchSource.DATABASE;- case -1:- case "UNRECOGNIZED":- default:- return ProtectionRule_BranchSource.UNRECOGNIZED;- }-}--export function protectionRule_BranchSourceToJSON(object: ProtectionRule_BranchSource): string {- switch (object) {- case ProtectionRule_BranchSource.BRANCH_SOURCE_UNSPECIFIED:- return "BRANCH_SOURCE_UNSPECIFIED";- case ProtectionRule_BranchSource.DATABASE:- return "DATABASE";- case ProtectionRule_BranchSource.UNRECOGNIZED:- default:- return "UNRECOGNIZED";- }-}--export function protectionRule_BranchSourceToNumber(object: ProtectionRule_BranchSource): number {- switch (object) {- case ProtectionRule_BranchSource.BRANCH_SOURCE_UNSPECIFIED:- return 0;- case ProtectionRule_BranchSource.DATABASE:- return 1;- case ProtectionRule_BranchSource.UNRECOGNIZED:- default:- return -1;- }-}-function createBaseLabel(): Label {return { value: "", color: "", group: "" };}@@ -224,20 +110,11 @@ export const Label = {};function createBaseProject(): Project {- return {- protectionRules: [],- issueLabels: [],- forceIssueLabels: false,- allowModifyStatement: false,- autoResolveIssue: false,- };+ return { issueLabels: [], forceIssueLabels: false, allowModifyStatement: false, autoResolveIssue: false };}export const Project = {encode(message: Project, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {- for (const v of message.protectionRules) {- ProtectionRule.encode(v!, writer.uint32(10).fork()).ldelim();- }for (const v of message.issueLabels) {Label.encode(v!, writer.uint32(18).fork()).ldelim();}@@ -260,13 +137,6 @@ export const Project = {while (reader.pos < end) {const tag = reader.uint32();switch (tag >>> 3) {- case 1:- if (tag !== 10) {- break;- }-- message.protectionRules.push(ProtectionRule.decode(reader, reader.uint32()));- continue;case 2:if (tag !== 18) {break;@@ -306,9 +176,6 @@ export const Project = {fromJSON(object: any): Project {return {- protectionRules: globalThis.Array.isArray(object?.protectionRules)- ? object.protectionRules.map((e: any) => ProtectionRule.fromJSON(e))- : [],issueLabels: globalThis.Array.isArray(object?.issueLabels)? object.issueLabels.map((e: any) => Label.fromJSON(e)): [],@@ -322,9 +189,6 @@ export const Project = {toJSON(message: Project): unknown {const obj: any = {};- if (message.protectionRules?.length) {- obj.protectionRules = message.protectionRules.map((e) => ProtectionRule.toJSON(e));- }if (message.issueLabels?.length) {obj.issueLabels = message.issueLabels.map((e) => Label.toJSON(e));}@@ -345,7 +209,6 @@ export const Project = {},fromPartial(object: DeepPartial<Project>): Project {const message = createBaseProject();- message.protectionRules = object.protectionRules?.map((e) => ProtectionRule.fromPartial(e)) || [];message.issueLabels = object.issueLabels?.map((e) => Label.fromPartial(e)) || [];message.forceIssueLabels = object.forceIssueLabels ?? false;message.allowModifyStatement = object.allowModifyStatement ?? false;@@ -354,137 +217,6 @@ export const Project = {},};-function createBaseProtectionRule(): ProtectionRule {- return {- id: "",- target: ProtectionRule_Target.PROTECTION_TARGET_UNSPECIFIED,- nameFilter: "",- allowedRoles: [],- branchSource: ProtectionRule_BranchSource.BRANCH_SOURCE_UNSPECIFIED,- };-}--export const ProtectionRule = {- encode(message: ProtectionRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {- if (message.id !== "") {- writer.uint32(10).string(message.id);- }- if (message.target !== ProtectionRule_Target.PROTECTION_TARGET_UNSPECIFIED) {- writer.uint32(16).int32(protectionRule_TargetToNumber(message.target));- }- if (message.nameFilter !== "") {- writer.uint32(26).string(message.nameFilter);- }- for (const v of message.allowedRoles) {- writer.uint32(34).string(v!);- }- if (message.branchSource !== ProtectionRule_BranchSource.BRANCH_SOURCE_UNSPECIFIED) {- writer.uint32(40).int32(protectionRule_BranchSourceToNumber(message.branchSource));- }- return writer;- },-- decode(input: _m0.Reader | Uint8Array, length?: number): ProtectionRule {- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);- let end = length === undefined ? reader.len : reader.pos + length;- const message = createBaseProtectionRule();- while (reader.pos < end) {- const tag = reader.uint32();- switch (tag >>> 3) {- case 1:- if (tag !== 10) {- break;- }-- message.id = reader.string();- continue;- case 2:- if (tag !== 16) {- break;- }-- message.target = protectionRule_TargetFromJSON(reader.int32());- continue;- case 3:- if (tag !== 26) {- break;- }-- message.nameFilter = reader.string();- continue;- case 4:- if (tag !== 34) {- break;- }-- message.allowedRoles.push(reader.string());- continue;- case 5:- if (tag !== 40) {- break;- }-- message.branchSource = protectionRule_BranchSourceFromJSON(reader.int32());- continue;- }- if ((tag & 7) === 4 || tag === 0) {- break;- }- reader.skipType(tag & 7);- }- return message;- },-- fromJSON(object: any): ProtectionRule {- return {- id: isSet(object.id) ? globalThis.String(object.id) : "",- target: isSet(object.target)- ? protectionRule_TargetFromJSON(object.target)- : ProtectionRule_Target.PROTECTION_TARGET_UNSPECIFIED,- nameFilter: isSet(object.nameFilter) ? globalThis.String(object.nameFilter) : "",- allowedRoles: globalThis.Array.isArray(object?.allowedRoles)- ? object.allowedRoles.map((e: any) => globalThis.String(e))- : [],- branchSource: isSet(object.branchSource)- ? protectionRule_BranchSourceFromJSON(object.branchSource)- : ProtectionRule_BranchSource.BRANCH_SOURCE_UNSPECIFIED,- };- },-- toJSON(message: ProtectionRule): unknown {- const obj: any = {};- if (message.id !== "") {- obj.id = message.id;- }- if (message.target !== ProtectionRule_Target.PROTECTION_TARGET_UNSPECIFIED) {- obj.target = protectionRule_TargetToJSON(message.target);- }- if (message.nameFilter !== "") {- obj.nameFilter = message.nameFilter;- }- if (message.allowedRoles?.length) {- obj.allowedRoles = message.allowedRoles;- }- if (message.branchSource !== ProtectionRule_BranchSource.BRANCH_SOURCE_UNSPECIFIED) {- obj.branchSource = protectionRule_BranchSourceToJSON(message.branchSource);- }- return obj;- },-- create(base?: DeepPartial<ProtectionRule>): ProtectionRule {- return ProtectionRule.fromPartial(base ?? {});- },- fromPartial(object: DeepPartial<ProtectionRule>): ProtectionRule {- const message = createBaseProtectionRule();- message.id = object.id ?? "";- message.target = object.target ?? ProtectionRule_Target.PROTECTION_TARGET_UNSPECIFIED;- message.nameFilter = object.nameFilter ?? "";- message.allowedRoles = object.allowedRoles?.map((e) => e) || [];- message.branchSource = object.branchSource ?? ProtectionRule_BranchSource.BRANCH_SOURCE_UNSPECIFIED;- return message;- },-};-type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;export type DeepPartial<T> = T extends Builtin ? Tdiff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yamlindex b36759c098..555f8bd369 100644--- a/proto/gen/grpc-doc/openapi.yaml+++ b/proto/gen/grpc-doc/openapi.yaml@@ -11951,10 +11951,6 @@ components:Project:type: objectproperties:- protectionRules:- type: array- items:- $ref: '#/components/schemas/ProtectionRule'issueLabels:type: arrayitems:diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.mdindex e5d47a862a..c0da7be300 100644--- a/proto/gen/grpc-doc/store/README.md+++ b/proto/gen/grpc-doc/store/README.md@@ -210,10 +210,6 @@- [store/project.proto](#store_project-proto)- [Label](#bytebase-store-Label)- [Project](#bytebase-store-Project)- - [ProtectionRule](#bytebase-store-ProtectionRule)-- - [ProtectionRule.BranchSource](#bytebase-store-ProtectionRule-BranchSource)- - [ProtectionRule.Target](#bytebase-store-ProtectionRule-Target)- [store/project_webhook.proto](#store_project_webhook-proto)- [ProjectWebhookPayload](#bytebase-store-ProjectWebhookPayload)@@ -3305,7 +3301,6 @@ SlowQueryPolicy is the policy configuration for slow query.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| protection_rules | [ProtectionRule](#bytebase-store-ProtectionRule) | repeated | || issue_labels | [Label](#bytebase-store-Label) | repeated | || force_issue_labels | [bool](#bool) | | Force issue labels to be used when creating an issue. || allow_modify_statement | [bool](#bool) | | Allow modifying statement after issue is created. |@@ -3315,52 +3310,8 @@ SlowQueryPolicy is the policy configuration for slow query.--<a name="bytebase-store-ProtectionRule"></a>--### ProtectionRule----| Field | Type | Label | Description |-| ----- | ---- | ----- | ----------- |-| id | [string](#string) | | A unique identifier for a node in UUID format. |-| target | [ProtectionRule.Target](#bytebase-store-ProtectionRule-Target) | | |-| name_filter | [string](#string) | | The name of the branch/changelist or wildcard. |-| allowed_roles | [string](#string) | repeated | The roles allowed to create branches or changelists, rebase branches, delete branches. Format: roles/projectOwner. |-| branch_source | [ProtectionRule.BranchSource](#bytebase-store-ProtectionRule-BranchSource) | | |-------<a name="bytebase-store-ProtectionRule-BranchSource"></a>--### ProtectionRule.BranchSource---| Name | Number | Description |-| ---- | ------ | ----------- |-| BRANCH_SOURCE_UNSPECIFIED | 0 | |-| DATABASE | 1 | |----<a name="bytebase-store-ProtectionRule-Target"></a>--### ProtectionRule.Target-The type of target.--| Name | Number | Description |-| ---- | ------ | ----------- |-| PROTECTION_TARGET_UNSPECIFIED | 0 | |-| BRANCH | 1 | |-| CHANGELIST | 2 | |--diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.htmlindex 0cd82b0306..4fa5500b61 100644--- a/proto/gen/grpc-doc/store/index.html+++ b/proto/gen/grpc-doc/store/index.html@@ -1014,18 +1014,6 @@<a href="#bytebase.store.Project"><span class="badge">M</span>Project</a></li>- <li>- <a href="#bytebase.store.ProtectionRule"><span class="badge">M</span>ProtectionRule</a>- </li>--- <li>- <a href="#bytebase.store.ProtectionRule.BranchSource"><span class="badge">E</span>ProtectionRule.BranchSource</a>- </li>-- <li>- <a href="#bytebase.store.ProtectionRule.Target"><span class="badge">E</span>ProtectionRule.Target</a>- </li>@@ -8446,13 +8434,6 @@ for example, the environment resource can have the sql review config tag, like &</thead><tbody>- <tr>- <td>protection_rules</td>- <td><a href="#bytebase.store.ProtectionRule">ProtectionRule</a></td>- <td>repeated</td>- <td><p> </p></td>- </tr>-<tr><td>issue_labels</td><td><a href="#bytebase.store.Label">Label</a></td>@@ -8488,112 +8469,7 @@ for example, the environment resource can have the sql review config tag, like &- <h3 id="bytebase.store.ProtectionRule">ProtectionRule</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>id</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>A unique identifier for a node in UUID format. </p></td>- </tr>-- <tr>- <td>target</td>- <td><a href="#bytebase.store.ProtectionRule.Target">ProtectionRule.Target</a></td>- <td></td>- <td><p> </p></td>- </tr>-- <tr>- <td>name_filter</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p>The name of the branch/changelist or wildcard. </p></td>- </tr>-- <tr>- <td>allowed_roles</td>- <td><a href="#string">string</a></td>- <td>repeated</td>- <td><p>The roles allowed to create branches or changelists, rebase branches, delete branches.-Format: roles/projectOwner. </p></td>- </tr>-- <tr>- <td>branch_source</td>- <td><a href="#bytebase.store.ProtectionRule.BranchSource">ProtectionRule.BranchSource</a></td>- <td></td>- <td><p> </p></td>- </tr>-- </tbody>- </table>-------- <h3 id="bytebase.store.ProtectionRule.BranchSource">ProtectionRule.BranchSource</h3>- <p></p>- <table class="enum-table">- <thead>- <tr><td>Name</td><td>Number</td><td>Description</td></tr>- </thead>- <tbody>-- <tr>- <td>BRANCH_SOURCE_UNSPECIFIED</td>- <td>0</td>- <td><p></p></td>- </tr>-- <tr>- <td>DATABASE</td>- <td>1</td>- <td><p></p></td>- </tr>-- </tbody>- </table>-- <h3 id="bytebase.store.ProtectionRule.Target">ProtectionRule.Target</h3>- <p>The type of target.</p>- <table class="enum-table">- <thead>- <tr><td>Name</td><td>Number</td><td>Description</td></tr>- </thead>- <tbody>-- <tr>- <td>PROTECTION_TARGET_UNSPECIFIED</td>- <td>0</td>- <td><p></p></td>- </tr>-- <tr>- <td>BRANCH</td>- <td>1</td>- <td><p></p></td>- </tr>-- <tr>- <td>CHANGELIST</td>- <td>2</td>- <td><p></p></td>- </tr>-- </tbody>- </table>diff --git a/proto/generated-go/store/project.pb.go b/proto/generated-go/store/project.pb.goindex 930bf467e3..a10cea2d16 100644--- a/proto/generated-go/store/project.pb.go+++ b/proto/generated-go/store/project.pb.go@@ -20,102 +20,6 @@ const (_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20))-// The type of target.-type ProtectionRule_Target int32--const (- ProtectionRule_PROTECTION_TARGET_UNSPECIFIED ProtectionRule_Target = 0- ProtectionRule_BRANCH ProtectionRule_Target = 1- ProtectionRule_CHANGELIST ProtectionRule_Target = 2-)--// Enum value maps for ProtectionRule_Target.-var (- ProtectionRule_Target_name = map[int32]string{- 0: "PROTECTION_TARGET_UNSPECIFIED",- 1: "BRANCH",- 2: "CHANGELIST",- }- ProtectionRule_Target_value = map[string]int32{- "PROTECTION_TARGET_UNSPECIFIED": 0,- "BRANCH": 1,- "CHANGELIST": 2,- }-)--func (x ProtectionRule_Target) Enum() *ProtectionRule_Target {- p := new(ProtectionRule_Target)- *p = x- return p-}--func (x ProtectionRule_Target) String() string {- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))-}--func (ProtectionRule_Target) Descriptor() protoreflect.EnumDescriptor {- return file_store_project_proto_enumTypes[0].Descriptor()-}--func (ProtectionRule_Target) Type() protoreflect.EnumType {- return &file_store_project_proto_enumTypes[0]-}--func (x ProtectionRule_Target) Number() protoreflect.EnumNumber {- return protoreflect.EnumNumber(x)-}--// Deprecated: Use ProtectionRule_Target.Descriptor instead.-func (ProtectionRule_Target) EnumDescriptor() ([]byte, []int) {- return file_store_project_proto_rawDescGZIP(), []int{2, 0}-}--type ProtectionRule_BranchSource int32--const (- ProtectionRule_BRANCH_SOURCE_UNSPECIFIED ProtectionRule_BranchSource = 0- ProtectionRule_DATABASE ProtectionRule_BranchSource = 1-)--// Enum value maps for ProtectionRule_BranchSource.-var (- ProtectionRule_BranchSource_name = map[int32]string{- 0: "BRANCH_SOURCE_UNSPECIFIED",- 1: "DATABASE",- }- ProtectionRule_BranchSource_value = map[string]int32{- "BRANCH_SOURCE_UNSPECIFIED": 0,- "DATABASE": 1,- }-)--func (x ProtectionRule_BranchSource) Enum() *ProtectionRule_BranchSource {- p := new(ProtectionRule_BranchSource)- *p = x- return p-}--func (x ProtectionRule_BranchSource) String() string {- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))-}--func (ProtectionRule_BranchSource) Descriptor() protoreflect.EnumDescriptor {- return file_store_project_proto_enumTypes[1].Descriptor()-}--func (ProtectionRule_BranchSource) Type() protoreflect.EnumType {- return &file_store_project_proto_enumTypes[1]-}--func (x ProtectionRule_BranchSource) Number() protoreflect.EnumNumber {- return protoreflect.EnumNumber(x)-}--// Deprecated: Use ProtectionRule_BranchSource.Descriptor instead.-func (ProtectionRule_BranchSource) EnumDescriptor() ([]byte, []int) {- return file_store_project_proto_rawDescGZIP(), []int{2, 1}-}-type Label struct {state protoimpl.MessageStatesizeCache protoimpl.SizeCache@@ -184,8 +88,7 @@ type Project struct {sizeCache protoimpl.SizeCacheunknownFields protoimpl.UnknownFields- ProtectionRules []*ProtectionRule `protobuf:"bytes,1,rep,name=protection_rules,json=protectionRules,proto3" json:"protection_rules,omitempty"`- IssueLabels []*Label `protobuf:"bytes,2,rep,name=issue_labels,json=issueLabels,proto3" json:"issue_labels,omitempty"`+ IssueLabels []*Label `protobuf:"bytes,2,rep,name=issue_labels,json=issueLabels,proto3" json:"issue_labels,omitempty"`// Force issue labels to be used when creating an issue.ForceIssueLabels bool `protobuf:"varint,3,opt,name=force_issue_labels,json=forceIssueLabels,proto3" json:"force_issue_labels,omitempty"`// Allow modifying statement after issue is created.@@ -226,13 +129,6 @@ func (*Project) Descriptor() ([]byte, []int) {return file_store_project_proto_rawDescGZIP(), []int{1}}-func (x *Project) GetProtectionRules() []*ProtectionRule {- if x != nil {- return x.ProtectionRules- }- return nil-}-func (x *Project) GetIssueLabels() []*Label {if x != nil {return x.IssueLabels@@ -261,89 +157,6 @@ func (x *Project) GetAutoResolveIssue() bool {return false}-type ProtectionRule struct {- state protoimpl.MessageState- sizeCache protoimpl.SizeCache- unknownFields protoimpl.UnknownFields-- // A unique identifier for a node in UUID format.- Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`- Target ProtectionRule_Target `protobuf:"varint,2,opt,name=target,proto3,enum=bytebase.store.ProtectionRule_Target" json:"target,omitempty"`- // The name of the branch/changelist or wildcard.- NameFilter string `protobuf:"bytes,3,opt,name=name_filter,json=nameFilter,proto3" json:"name_filter,omitempty"`- // The roles allowed to create branches or changelists, rebase branches, delete branches.- // Format: roles/projectOwner.- AllowedRoles []string `protobuf:"bytes,4,rep,name=allowed_roles,json=allowedRoles,proto3" json:"allowed_roles,omitempty"`- BranchSource ProtectionRule_BranchSource `protobuf:"varint,5,opt,name=branch_source,json=branchSource,proto3,enum=bytebase.store.ProtectionRule_BranchSource" json:"branch_source,omitempty"`-}--func (x *ProtectionRule) Reset() {- *x = ProtectionRule{}- if protoimpl.UnsafeEnabled {- mi := &file_store_project_proto_msgTypes[2]- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- ms.StoreMessageInfo(mi)- }-}--func (x *ProtectionRule) String() string {- return protoimpl.X.MessageStringOf(x)-}--func (*ProtectionRule) ProtoMessage() {}--func (x *ProtectionRule) ProtoReflect() protoreflect.Message {- mi := &file_store_project_proto_msgTypes[2]- if protoimpl.UnsafeEnabled && x != nil {- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))- if ms.LoadMessageInfo() == nil {- ms.StoreMessageInfo(mi)- }- return ms- }- return mi.MessageOf(x)-}--// Deprecated: Use ProtectionRule.ProtoReflect.Descriptor instead.-func (*ProtectionRule) Descriptor() ([]byte, []int) {- return file_store_project_proto_rawDescGZIP(), []int{2}-}--func (x *ProtectionRule) GetId() string {- if x != nil {- return x.Id- }- return ""-}--func (x *ProtectionRule) GetTarget() ProtectionRule_Target {- if x != nil {- return x.Target- }- return ProtectionRule_PROTECTION_TARGET_UNSPECIFIED-}--func (x *ProtectionRule) GetNameFilter() string {- if x != nil {- return x.NameFilter- }- return ""-}--func (x *ProtectionRule) GetAllowedRoles() []string {- if x != nil {- return x.AllowedRoles- }- return nil-}--func (x *ProtectionRule) GetBranchSource() ProtectionRule_BranchSource {- if x != nil {- return x.BranchSource- }- return ProtectionRule_BRANCH_SOURCE_UNSPECIFIED-}-var File_store_project_proto protoreflect.FileDescriptorvar file_store_project_proto_rawDesc = []byte{@@ -354,51 +167,22 @@ var file_store_project_proto_rawDesc = []byte{0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x02, 0x20,0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x67, 0x72,0x6f, 0x75, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70,- 0x22, 0xa0, 0x02, 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x49, 0x0a, 0x10,- 0x70, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x73,- 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,- 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x69,- 0x6f, 0x6e, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x69,- 0x6f, 0x6e, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x38, 0x0a, 0x0c, 0x69, 0x73, 0x73, 0x75, 0x65,- 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e,- 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x4c,- 0x61, 0x62, 0x65, 0x6c, 0x52, 0x0b, 0x69, 0x73, 0x73, 0x75, 0x65, 0x4c, 0x61, 0x62, 0x65, 0x6c,- 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x73, 0x73, 0x75, 0x65,- 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x66,- 0x6f, 0x72, 0x63, 0x65, 0x49, 0x73, 0x73, 0x75, 0x65, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12,- 0x34, 0x0a, 0x16, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x5f,- 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52,- 0x14, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x53, 0x74, 0x61, 0x74,- 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x2c, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x6f, 0x5f, 0x72, 0x65,- 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x5f, 0x69, 0x73, 0x73, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28,- 0x08, 0x52, 0x10, 0x61, 0x75, 0x74, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x49, 0x73,- 0x73, 0x75, 0x65, 0x22, 0xfd, 0x02, 0x0a, 0x0e, 0x50, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x69,- 0x6f, 0x6e, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,- 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3d, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74,- 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,- 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x69,- 0x6f, 0x6e, 0x52, 0x75, 0x6c, 0x65, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74,- 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x66, 0x69,- 0x6c, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6e, 0x61, 0x6d, 0x65,- 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65,- 0x64, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x61,- 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x12, 0x50, 0x0a, 0x0d, 0x62,- 0x72, 0x61, 0x6e, 0x63, 0x68, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01,- 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74,- 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x75,- 0x6c, 0x65, 0x2e, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52,- 0x0c, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x47, 0x0a,- 0x06, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x21, 0x0a, 0x1d, 0x50, 0x52, 0x4f, 0x54, 0x45,- 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x55, 0x4e, 0x53,- 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x42, 0x52,- 0x41, 0x4e, 0x43, 0x48, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45,- 0x4c, 0x49, 0x53, 0x54, 0x10, 0x02, 0x22, 0x3b, 0x0a, 0x0c, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68,- 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x42, 0x52, 0x41, 0x4e, 0x43, 0x48,- 0x5f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46,- 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x41, 0x54, 0x41, 0x42, 0x41, 0x53,- 0x45, 0x10, 0x01, 0x42, 0x14, 0x5a, 0x12, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64,- 0x2d, 0x67, 0x6f, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,- 0x33,+ 0x22, 0xdb, 0x01, 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x38, 0x0a, 0x0c,+ 0x69, 0x73, 0x73, 0x75, 0x65, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x03,+ 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74,+ 0x6f, 0x72, 0x65, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x0b, 0x69, 0x73, 0x73, 0x75, 0x65,+ 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x5f,+ 0x69, 0x73, 0x73, 0x75, 0x65, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x01,+ 0x28, 0x08, 0x52, 0x10, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x49, 0x73, 0x73, 0x75, 0x65, 0x4c, 0x61,+ 0x62, 0x65, 0x6c, 0x73, 0x12, 0x34, 0x0a, 0x16, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x6d, 0x6f,+ 0x64, 0x69, 0x66, 0x79, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x04,+ 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x4d, 0x6f, 0x64, 0x69, 0x66,+ 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x2c, 0x0a, 0x12, 0x61, 0x75,+ 0x74, 0x6f, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x5f, 0x69, 0x73, 0x73, 0x75, 0x65,+ 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x61, 0x75, 0x74, 0x6f, 0x52, 0x65, 0x73, 0x6f,+ 0x6c, 0x76, 0x65, 0x49, 0x73, 0x73, 0x75, 0x65, 0x4a, 0x04, 0x08, 0x01, 0x10, 0x02, 0x42, 0x14,+ 0x5a, 0x12, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x73,+ 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,}var (@@ -413,25 +197,18 @@ func file_store_project_proto_rawDescGZIP() []byte {return file_store_project_proto_rawDescData}-var file_store_project_proto_enumTypes = make([]protoimpl.EnumInfo, 2)-var file_store_project_proto_msgTypes = make([]protoimpl.MessageInfo, 3)+var file_store_project_proto_msgTypes = make([]protoimpl.MessageInfo, 2)var file_store_project_proto_goTypes = []any{- (ProtectionRule_Target)(0), // 0: bytebase.store.ProtectionRule.Target- (ProtectionRule_BranchSource)(0), // 1: bytebase.store.ProtectionRule.BranchSource- (*Label)(nil), // 2: bytebase.store.Label- (*Project)(nil), // 3: bytebase.store.Project- (*ProtectionRule)(nil), // 4: bytebase.store.ProtectionRule+ (*Label)(nil), // 0: bytebase.store.Label+ (*Project)(nil), // 1: bytebase.store.Project}var file_store_project_proto_depIdxs = []int32{- 4, // 0: bytebase.store.Project.protection_rules:type_name -> bytebase.store.ProtectionRule- 2, // 1: bytebase.store.Project.issue_labels:type_name -> bytebase.store.Label- 0, // 2: bytebase.store.ProtectionRule.target:type_name -> bytebase.store.ProtectionRule.Target- 1, // 3: bytebase.store.ProtectionRule.branch_source:type_name -> bytebase.store.ProtectionRule.BranchSource- 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+ 0, // 0: bytebase.store.Project.issue_labels:type_name -> bytebase.store.Label+ 1, // [1:1] is the sub-list for method output_type+ 1, // [1:1] is the sub-list for method input_type+ 1, // [1:1] is the sub-list for extension type_name+ 1, // [1:1] is the sub-list for extension extendee+ 0, // [0:1] is the sub-list for field type_name}func init() { file_store_project_proto_init() }@@ -464,32 +241,19 @@ func file_store_project_proto_init() {return nil}}- file_store_project_proto_msgTypes[2].Exporter = func(v any, i int) any {- switch v := v.(*ProtectionRule); i {- case 0:- return &v.state- case 1:- return &v.sizeCache- case 2:- return &v.unknownFields- default:- return nil- }- }}type x struct{}out := protoimpl.TypeBuilder{File: protoimpl.DescBuilder{GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: file_store_project_proto_rawDesc,- NumEnums: 2,- NumMessages: 3,+ NumEnums: 0,+ NumMessages: 2,NumExtensions: 0,NumServices: 0,},GoTypes: file_store_project_proto_goTypes,DependencyIndexes: file_store_project_proto_depIdxs,- EnumInfos: file_store_project_proto_enumTypes,MessageInfos: file_store_project_proto_msgTypes,}.Build()File_store_project_proto = out.Filediff --git a/proto/store/project.proto b/proto/store/project.protoindex 72ccd69593..72937eefe8 100644--- a/proto/store/project.proto+++ b/proto/store/project.proto@@ -11,7 +11,7 @@ message Label {}message Project {- repeated ProtectionRule protection_rules = 1;+ reserved 1;repeated Label issue_labels = 2;// Force issue labels to be used when creating an issue.bool force_issue_labels = 3;@@ -20,30 +20,3 @@ message Project {// Enable auto resolve issue.bool auto_resolve_issue = 5;}--message ProtectionRule {- // A unique identifier for a node in UUID format.- string id = 1;-- // The type of target.- enum Target {- PROTECTION_TARGET_UNSPECIFIED = 0;- BRANCH = 1;- CHANGELIST = 2;- }-- Target target = 2;-- // The name of the branch/changelist or wildcard.- string name_filter = 3;-- // The roles allowed to create branches or changelists, rebase branches, delete branches.- // Format: roles/projectOwner.- repeated string allowed_roles = 4;-- enum BranchSource {- BRANCH_SOURCE_UNSPECIFIED = 0;- DATABASE = 1;- }- BranchSource branch_source = 5;-}