Skip to content

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

chore: P branch 197 (#15863)

p0ny03f701afb52a
diff --git a/backend/api/v1/issue_service.go b/backend/api/v1/issue_service.go
index 83b2632c8f..227acbb2fd 100644
--- a/backend/api/v1/issue_service.go
+++ b/backend/api/v1/issue_service.go
@@ -1516,26 +1516,5 @@ func isUserReviewer(ctx context.Context, stores *store.Store, issue *store.Issue
}
roles := utils.GetUserFormattedRolesMap(ctx, stores, user, policies...)
-
- switch val := node.Payload.(type) {
- case *storepb.ApprovalNode_GroupValue_:
- switch val.GroupValue {
- case storepb.ApprovalNode_GROUP_VALUE_UNSPECIFILED:
- return false, errors.Errorf("invalid group value")
- case storepb.ApprovalNode_WORKSPACE_OWNER:
- return roles[common.FormatRole(base.WorkspaceAdmin.String())], nil
- case storepb.ApprovalNode_WORKSPACE_DBA:
- return roles[common.FormatRole(base.WorkspaceDBA.String())], nil
- case storepb.ApprovalNode_PROJECT_OWNER:
- return roles[common.FormatRole(base.ProjectOwner.String())], nil
- case storepb.ApprovalNode_PROJECT_MEMBER:
- return roles[common.FormatRole(base.ProjectDeveloper.String())], nil
- default:
- return false, errors.Errorf("invalid group value")
- }
- case *storepb.ApprovalNode_Role:
- return roles[val.Role], nil
- default:
- return false, errors.Errorf("invalid node payload type")
- }
+ return roles[node.Role], nil
}
diff --git a/backend/api/v1/issue_service_convert.go b/backend/api/v1/issue_service_convert.go
index 909934218a..94cebb045c 100644
--- a/backend/api/v1/issue_service_convert.go
+++ b/backend/api/v1/issue_service_convert.go
@@ -242,32 +242,10 @@ func convertToApprovalStep(step *storepb.ApprovalStep) *v1pb.ApprovalStep {
func convertToApprovalNode(node *storepb.ApprovalNode) *v1pb.ApprovalNode {
v1node := &v1pb.ApprovalNode{}
v1node.Type = v1pb.ApprovalNode_Type(node.Type)
- switch payload := node.Payload.(type) {
- case *storepb.ApprovalNode_GroupValue_:
- v1node.Role = common.FormatRole(convertToRoleByGroupValue(payload.GroupValue).String())
- case *storepb.ApprovalNode_Role:
- v1node.Role = payload.Role
- }
+ v1node.Role = node.Role
return v1node
}
-func convertToRoleByGroupValue(v storepb.ApprovalNode_GroupValue) base.Role {
- switch v {
- case storepb.ApprovalNode_GROUP_VALUE_UNSPECIFILED:
- return base.UnknownRole
- case storepb.ApprovalNode_WORKSPACE_OWNER:
- return base.WorkspaceAdmin
- case storepb.ApprovalNode_WORKSPACE_DBA:
- return base.WorkspaceDBA
- case storepb.ApprovalNode_PROJECT_OWNER:
- return base.ProjectOwner
- case storepb.ApprovalNode_PROJECT_MEMBER:
- return base.ProjectDeveloper
- default:
- return base.UnknownRole
- }
-}
-
func convertToGrantRequest(ctx context.Context, s *store.Store, v *storepb.GrantRequest) (*v1pb.GrantRequest, error) {
if v == nil {
return nil, nil
diff --git a/backend/api/v1/issue_service_test.go b/backend/api/v1/issue_service_test.go
index 38eaa61478..a1221faf9d 100644
--- a/backend/api/v1/issue_service_test.go
+++ b/backend/api/v1/issue_service_test.go
@@ -19,9 +19,7 @@ func TestConvertToApprovalNode(t *testing.T) {
{
node: &storepb.ApprovalNode{
Type: storepb.ApprovalNode_ANY_IN_GROUP,
- Payload: &storepb.ApprovalNode_GroupValue_{
- GroupValue: storepb.ApprovalNode_WORKSPACE_DBA,
- },
+ Role: common.FormatRole(base.WorkspaceDBA.String()),
},
want: &v1pb.ApprovalNode{
Type: v1pb.ApprovalNode_ANY_IN_GROUP,
diff --git a/backend/component/webhook/manager.go b/backend/component/webhook/manager.go
index 98c077708f..4294bc0736 100644
--- a/backend/component/webhook/manager.go
+++ b/backend/component/webhook/manager.go
@@ -266,28 +266,8 @@ func (m *Manager) getWebhookContextFromEvent(ctx context.Context, e *Event, acti
var usersGetter func(ctx context.Context) ([]*store.UserMessage, error)
- switch val := node.Payload.(type) {
- case *storepb.ApprovalNode_GroupValue_:
- switch val.GroupValue {
- case storepb.ApprovalNode_GROUP_VALUE_UNSPECIFILED:
- return nil, errors.Errorf("invalid group value")
- case storepb.ApprovalNode_WORKSPACE_OWNER:
- usersGetter = m.getUsersFromWorkspaceRole(base.WorkspaceAdmin)
- case storepb.ApprovalNode_WORKSPACE_DBA:
- usersGetter = m.getUsersFromWorkspaceRole(base.WorkspaceDBA)
- case storepb.ApprovalNode_PROJECT_OWNER:
- usersGetter = getUsersFromProjectRole(m.store, base.ProjectOwner, e.Project.ResourceID)
- case storepb.ApprovalNode_PROJECT_MEMBER:
- usersGetter = getUsersFromProjectRole(m.store, base.ProjectDeveloper, e.Project.ResourceID)
- default:
- return nil, errors.Errorf("invalid group value")
- }
- case *storepb.ApprovalNode_Role:
- role := base.Role(strings.TrimPrefix(val.Role, "roles/"))
- usersGetter = getUsersFromProjectRole(m.store, role, e.Project.ResourceID)
- default:
- return nil, errors.Errorf("invalid node payload type")
- }
+ role := base.Role(strings.TrimPrefix(node.Role, "roles/"))
+ usersGetter = getUsersFromProjectRole(m.store, role, e.Project.ResourceID)
users, err := usersGetter(ctx)
if err != nil {
diff --git a/backend/migrator/migration/3.6/0004##deprecate_approval_node_group_value.sql b/backend/migrator/migration/3.6/0004##deprecate_approval_node_group_value.sql
new file mode 100644
index 0000000000..cc62a95d9d
--- /dev/null
+++ b/backend/migrator/migration/3.6/0004##deprecate_approval_node_group_value.sql
@@ -0,0 +1,35 @@
+UPDATE setting
+SET value = REPLACE(
+ REPLACE(
+ REPLACE(
+ REPLACE(
+ REPLACE(value::text,
+ '"groupValue"', '"role"'
+ )::text,
+ '"WORKSPACE_OWNER"', '"roles/workspaceAdmin"'
+ )::text,
+ '"WORKSPACE_DBA"', '"roles/workspaceDBA"'
+ )::text,
+ '"PROJECT_OWNER"', '"roles/projectOwner"'
+ )::text,
+ '"PROJECT_MEMBER"', '"roles/projectDeveloper"'
+)::jsonb
+WHERE name = 'bb.workspace.approval';
+
+UPDATE issue
+SET payload = REPLACE(
+ REPLACE(
+ REPLACE(
+ REPLACE(
+ REPLACE(payload::text,
+ '"groupValue"', '"role"'
+ )::text,
+ '"WORKSPACE_OWNER"', '"roles/workspaceAdmin"'
+ )::text,
+ '"WORKSPACE_DBA"', '"roles/workspaceDBA"'
+ )::text,
+ '"PROJECT_OWNER"', '"roles/projectOwner"'
+ )::text,
+ '"PROJECT_MEMBER"', '"roles/projectDeveloper"'
+)::jsonb
+WHERE payload#>'{approval,approvalTemplates}' IS NOT NULL;
diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.go
index 86803ac321..7587af40dc 100644
--- a/backend/migrator/migrator_test.go
+++ b/backend/migrator/migrator_test.go
@@ -12,7 +12,7 @@ import (
func TestLatestVersion(t *testing.T) {
files, err := getSortedVersionedFiles()
require.NoError(t, err)
- require.Equal(t, semver.MustParse("3.6.3"), *files[len(files)-1].version)
+ require.Equal(t, semver.MustParse("3.6.4"), *files[len(files)-1].version)
}
func TestVersionUnique(t *testing.T) {
diff --git a/frontend/src/types/proto/google/protobuf/descriptor.ts b/frontend/src/types/proto/google/protobuf/descriptor.ts
index 1576d9993b..2fdf22f5e2 100644
--- a/frontend/src/types/proto/google/protobuf/descriptor.ts
+++ b/frontend/src/types/proto/google/protobuf/descriptor.ts
@@ -210,19 +210,11 @@ export interface FileDescriptorProto {
* The supported values are "proto2", "proto3", and "editions".
*
* If `edition` is present, this value must be "editions".
- * WARNING: This field should only be used by protobuf plugins or special
- * cases like the proto compiler. Other uses are discouraged and
- * developers should rely on the protoreflect APIs for their client language.
*/
syntax?:
| string
| undefined;
- /**
- * The edition of the proto file.
- * WARNING: This field should only be used by protobuf plugins or special
- * cases like the proto compiler. Other uses are discouraged and
- * developers should rely on the protoreflect APIs for their client language.
- */
+ /** The edition of the proto file. */
edition?: Edition | undefined;
}
@@ -939,12 +931,7 @@ export interface FileOptions {
rubyPackage?:
| string
| undefined;
- /**
- * Any features defined in the specific edition.
- * WARNING: This field should only be used by protobuf plugins or special
- * cases like the proto compiler. Other uses are discouraged and
- * developers should rely on the protoreflect APIs for their client language.
- */
+ /** Any features defined in the specific edition. */
features?:
| FeatureSet
| undefined;
@@ -1096,12 +1083,7 @@ export interface MessageOptions {
deprecatedLegacyJsonFieldConflicts?:
| boolean
| undefined;
- /**
- * Any features defined in the specific edition.
- * WARNING: This field should only be used by protobuf plugins or special
- * cases like the proto compiler. Other uses are discouraged and
- * developers should rely on the protoreflect APIs for their client language.
- */
+ /** Any features defined in the specific edition. */
features?:
| FeatureSet
| undefined;
@@ -1206,12 +1188,7 @@ export interface FieldOptions {
retention?: FieldOptions_OptionRetention | undefined;
targets: FieldOptions_OptionTargetType[];
editionDefaults: FieldOptions_EditionDefault[];
- /**
- * Any features defined in the specific edition.
- * WARNING: This field should only be used by protobuf plugins or special
- * cases like the proto compiler. Other uses are discouraged and
- * developers should rely on the protoreflect APIs for their client language.
- */
+ /** Any features defined in the specific edition. */
features?: FeatureSet | undefined;
featureSupport?:
| FieldOptions_FeatureSupport
@@ -1547,12 +1524,7 @@ export interface FieldOptions_FeatureSupport {
}
export interface OneofOptions {
- /**
- * Any features defined in the specific edition.
- * WARNING: This field should only be used by protobuf plugins or special
- * cases like the proto compiler. Other uses are discouraged and
- * developers should rely on the protoreflect APIs for their client language.
- */
+ /** Any features defined in the specific edition. */
features?:
| FeatureSet
| undefined;
@@ -1590,12 +1562,7 @@ export interface EnumOptions {
deprecatedLegacyJsonFieldConflicts?:
| boolean
| undefined;
- /**
- * Any features defined in the specific edition.
- * WARNING: This field should only be used by protobuf plugins or special
- * cases like the proto compiler. Other uses are discouraged and
- * developers should rely on the protoreflect APIs for their client language.
- */
+ /** Any features defined in the specific edition. */
features?:
| FeatureSet
| undefined;
@@ -1613,12 +1580,7 @@ export interface EnumValueOptions {
deprecated?:
| boolean
| undefined;
- /**
- * Any features defined in the specific edition.
- * WARNING: This field should only be used by protobuf plugins or special
- * cases like the proto compiler. Other uses are discouraged and
- * developers should rely on the protoreflect APIs for their client language.
- */
+ /** Any features defined in the specific edition. */
features?:
| FeatureSet
| undefined;
@@ -1639,12 +1601,7 @@ export interface EnumValueOptions {
}
export interface ServiceOptions {
- /**
- * Any features defined in the specific edition.
- * WARNING: This field should only be used by protobuf plugins or special
- * cases like the proto compiler. Other uses are discouraged and
- * developers should rely on the protoreflect APIs for their client language.
- */
+ /** Any features defined in the specific edition. */
features?:
| FeatureSet
| undefined;
@@ -1672,12 +1629,7 @@ export interface MethodOptions {
idempotencyLevel?:
| MethodOptions_IdempotencyLevel
| undefined;
- /**
- * Any features defined in the specific edition.
- * WARNING: This field should only be used by protobuf plugins or special
- * cases like the proto compiler. Other uses are discouraged and
- * developers should rely on the protoreflect APIs for their client language.
- */
+ /** Any features defined in the specific edition. */
features?:
| FeatureSet
| undefined;
@@ -1794,7 +1746,6 @@ export interface FeatureSet {
utf8Validation?: FeatureSet_Utf8Validation | undefined;
messageEncoding?: FeatureSet_MessageEncoding | undefined;
jsonFormat?: FeatureSet_JsonFormat | undefined;
- enforceNamingStyle?: FeatureSet_EnforceNamingStyle | undefined;
}
export enum FeatureSet_FieldPresence {
@@ -2123,59 +2074,6 @@ export function featureSet_JsonFormatToNumber(object: FeatureSet_JsonFormat): nu
}
}
-export enum FeatureSet_EnforceNamingStyle {
- ENFORCE_NAMING_STYLE_UNKNOWN = "ENFORCE_NAMING_STYLE_UNKNOWN",
- STYLE2024 = "STYLE2024",
- STYLE_LEGACY = "STYLE_LEGACY",
- UNRECOGNIZED = "UNRECOGNIZED",
-}
-
-export function featureSet_EnforceNamingStyleFromJSON(object: any): FeatureSet_EnforceNamingStyle {
- switch (object) {
- case 0:
- case "ENFORCE_NAMING_STYLE_UNKNOWN":
- return FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN;
- case 1:
- case "STYLE2024":
- return FeatureSet_EnforceNamingStyle.STYLE2024;
- case 2:
- case "STYLE_LEGACY":
- return FeatureSet_EnforceNamingStyle.STYLE_LEGACY;
- case -1:
- case "UNRECOGNIZED":
- default:
- return FeatureSet_EnforceNamingStyle.UNRECOGNIZED;
- }
-}
-
-export function featureSet_EnforceNamingStyleToJSON(object: FeatureSet_EnforceNamingStyle): string {
- switch (object) {
- case FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN:
- return "ENFORCE_NAMING_STYLE_UNKNOWN";
- case FeatureSet_EnforceNamingStyle.STYLE2024:
- return "STYLE2024";
- case FeatureSet_EnforceNamingStyle.STYLE_LEGACY:
- return "STYLE_LEGACY";
- case FeatureSet_EnforceNamingStyle.UNRECOGNIZED:
- default:
- return "UNRECOGNIZED";
- }
-}
-
-export function featureSet_EnforceNamingStyleToNumber(object: FeatureSet_EnforceNamingStyle): number {
- switch (object) {
- case FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN:
- return 0;
- case FeatureSet_EnforceNamingStyle.STYLE2024:
- return 1;
- case FeatureSet_EnforceNamingStyle.STYLE_LEGACY:
- return 2;
- case FeatureSet_EnforceNamingStyle.UNRECOGNIZED:
- default:
- return -1;
- }
-}
-
/**
* A compiled specification for the defaults of a set of features. These
* messages are generated from FeatureSet extensions and can be used to seed
@@ -6262,7 +6160,6 @@ function createBaseFeatureSet(): FeatureSet {
utf8Validation: FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN,
messageEncoding: FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN,
jsonFormat: FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN,
- enforceNamingStyle: FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN,
};
}
@@ -6297,12 +6194,6 @@ export const FeatureSet: MessageFns<FeatureSet> = {
if (message.jsonFormat !== undefined && message.jsonFormat !== FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN) {
writer.uint32(48).int32(featureSet_JsonFormatToNumber(message.jsonFormat));
}
- if (
- message.enforceNamingStyle !== undefined &&
- message.enforceNamingStyle !== FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN
- ) {
- writer.uint32(56).int32(featureSet_EnforceNamingStyleToNumber(message.enforceNamingStyle));
- }
return writer;
},
@@ -6361,14 +6252,6 @@ export const FeatureSet: MessageFns<FeatureSet> = {
message.jsonFormat = featureSet_JsonFormatFromJSON(reader.int32());
continue;
}
- case 7: {
- if (tag !== 56) {
- break;
- }
-
- message.enforceNamingStyle = featureSet_EnforceNamingStyleFromJSON(reader.int32());
- continue;
- }
}
if ((tag & 7) === 4 || tag === 0) {
break;
@@ -6398,9 +6281,6 @@ export const FeatureSet: MessageFns<FeatureSet> = {
jsonFormat: isSet(object.jsonFormat)
? featureSet_JsonFormatFromJSON(object.jsonFormat)
: FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN,
- enforceNamingStyle: isSet(object.enforceNamingStyle)
- ? featureSet_EnforceNamingStyleFromJSON(object.enforceNamingStyle)
- : FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN,
};
},
@@ -6435,12 +6315,6 @@ export const FeatureSet: MessageFns<FeatureSet> = {
if (message.jsonFormat !== undefined && message.jsonFormat !== FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN) {
obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat);
}
- if (
- message.enforceNamingStyle !== undefined &&
- message.enforceNamingStyle !== FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN
- ) {
- obj.enforceNamingStyle = featureSet_EnforceNamingStyleToJSON(message.enforceNamingStyle);
- }
return obj;
},
@@ -6456,8 +6330,6 @@ export const FeatureSet: MessageFns<FeatureSet> = {
message.utf8Validation = object.utf8Validation ?? FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN;
message.messageEncoding = object.messageEncoding ?? FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN;
message.jsonFormat = object.jsonFormat ?? FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN;
- message.enforceNamingStyle = object.enforceNamingStyle ??
- FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN;
return message;
},
};
diff --git a/frontend/src/types/proto/google/protobuf/wrappers.ts b/frontend/src/types/proto/google/protobuf/wrappers.ts
index bb730b69e5..07224c0f85 100644
--- a/frontend/src/types/proto/google/protobuf/wrappers.ts
+++ b/frontend/src/types/proto/google/protobuf/wrappers.ts
@@ -14,9 +14,6 @@ export const protobufPackage = "google.protobuf";
* Wrapper message for `double`.
*
* The JSON representation for `DoubleValue` is JSON number.
- *
- * Not recommended for use in new APIs, but still useful for legacy APIs and
- * has no plan to be removed.
*/
export interface DoubleValue {
/** The double value. */
@@ -27,9 +24,6 @@ export interface DoubleValue {
* Wrapper message for `float`.
*
* The JSON representation for `FloatValue` is JSON number.
- *
- * Not recommended for use in new APIs, but still useful for legacy APIs and
- * has no plan to be removed.
*/
export interface FloatValue {
/** The float value. */
@@ -40,9 +34,6 @@ export interface FloatValue {
* Wrapper message for `int64`.
*
* The JSON representation for `Int64Value` is JSON string.
- *
- * Not recommended for use in new APIs, but still useful for legacy APIs and
- * has no plan to be removed.
*/
export interface Int64Value {
/** The int64 value. */
@@ -53,9 +44,6 @@ export interface Int64Value {
* Wrapper message for `uint64`.
*
* The JSON representation for `UInt64Value` is JSON string.
- *
- * Not recommended for use in new APIs, but still useful for legacy APIs and
- * has no plan to be removed.
*/
export interface UInt64Value {
/** The uint64 value. */
@@ -66,9 +54,6 @@ export interface UInt64Value {
* Wrapper message for `int32`.
*
* The JSON representation for `Int32Value` is JSON number.
- *
- * Not recommended for use in new APIs, but still useful for legacy APIs and
- * has no plan to be removed.
*/
export interface Int32Value {
/** The int32 value. */
@@ -79,9 +64,6 @@ export interface Int32Value {
* Wrapper message for `uint32`.
*
* The JSON representation for `UInt32Value` is JSON number.
- *
- * Not recommended for use in new APIs, but still useful for legacy APIs and
- * has no plan to be removed.
*/
export interface UInt32Value {
/** The uint32 value. */
@@ -92,9 +74,6 @@ export interface UInt32Value {
* Wrapper message for `bool`.
*
* The JSON representation for `BoolValue` is JSON `true` and `false`.
- *
- * Not recommended for use in new APIs, but still useful for legacy APIs and
- * has no plan to be removed.
*/
export interface BoolValue {
/** The bool value. */
@@ -105,9 +84,6 @@ export interface BoolValue {
* Wrapper message for `string`.
*
* The JSON representation for `StringValue` is JSON string.
- *
- * Not recommended for use in new APIs, but still useful for legacy APIs and
- * has no plan to be removed.
*/
export interface StringValue {
/** The string value. */
@@ -118,9 +94,6 @@ export interface StringValue {
* Wrapper message for `bytes`.
*
* The JSON representation for `BytesValue` is JSON string.
- *
- * Not recommended for use in new APIs, but still useful for legacy APIs and
- * has no plan to be removed.
*/
export interface BytesValue {
/** The bytes value. */
diff --git a/frontend/src/types/proto/store/approval.ts b/frontend/src/types/proto/store/approval.ts
index a192d28f71..16218444e2 100644
--- a/frontend/src/types/proto/store/approval.ts
+++ b/frontend/src/types/proto/store/approval.ts
@@ -231,11 +231,7 @@ export function approvalStep_TypeToNumber(object: ApprovalStep_Type): number {
export interface ApprovalNode {
type: ApprovalNode_Type;
- groupValue?:
- | ApprovalNode_GroupValue
- | undefined;
- /** Format: roles/{role} */
- role?: string | undefined;
+ role: string;
}
/**
@@ -289,82 +285,6 @@ export function approvalNode_TypeToNumber(object: ApprovalNode_Type): number {
}
}
-/**
- * The predefined user groups are:
- * - WORKSPACE_OWNER
- * - WORKSPACE_DBA
- * - PROJECT_OWNER
- * - PROJECT_MEMBER
- */
-export enum ApprovalNode_GroupValue {
- GROUP_VALUE_UNSPECIFILED = "GROUP_VALUE_UNSPECIFILED",
- WORKSPACE_OWNER = "WORKSPACE_OWNER",
- WORKSPACE_DBA = "WORKSPACE_DBA",
- PROJECT_OWNER = "PROJECT_OWNER",
- PROJECT_MEMBER = "PROJECT_MEMBER",
- UNRECOGNIZED = "UNRECOGNIZED",
-}
-
-export function approvalNode_GroupValueFromJSON(object: any): ApprovalNode_GroupValue {
- switch (object) {
- case 0:
- case "GROUP_VALUE_UNSPECIFILED":
- return ApprovalNode_GroupValue.GROUP_VALUE_UNSPECIFILED;
- case 1:
- case "WORKSPACE_OWNER":
- return ApprovalNode_GroupValue.WORKSPACE_OWNER;
- case 2:
- case "WORKSPACE_DBA":
- return ApprovalNode_GroupValue.WORKSPACE_DBA;
- case 3:
- case "PROJECT_OWNER":
- return ApprovalNode_GroupValue.PROJECT_OWNER;
- case 4:
- case "PROJECT_MEMBER":
- return ApprovalNode_GroupValue.PROJECT_MEMBER;
- case -1:
- case "UNRECOGNIZED":
- default:
- return ApprovalNode_GroupValue.UNRECOGNIZED;
- }
-}
-
-export function approvalNode_GroupValueToJSON(object: ApprovalNode_GroupValue): string {
- switch (object) {
- case ApprovalNode_GroupValue.GROUP_VALUE_UNSPECIFILED:
- return "GROUP_VALUE_UNSPECIFILED";
- case ApprovalNode_GroupValue.WORKSPACE_OWNER:
- return "WORKSPACE_OWNER";
- case ApprovalNode_GroupValue.WORKSPACE_DBA:
- return "WORKSPACE_DBA";
- case ApprovalNode_GroupValue.PROJECT_OWNER:
- return "PROJECT_OWNER";
- case ApprovalNode_GroupValue.PROJECT_MEMBER:
- return "PROJECT_MEMBER";
- case ApprovalNode_GroupValue.UNRECOGNIZED:
- default:
- return "UNRECOGNIZED";
- }
-}
-
-export function approvalNode_GroupValueToNumber(object: ApprovalNode_GroupValue): number {
- switch (object) {
- case ApprovalNode_GroupValue.GROUP_VALUE_UNSPECIFILED:
- return 0;
- case ApprovalNode_GroupValue.WORKSPACE_OWNER:
- return 1;
- case ApprovalNode_GroupValue.WORKSPACE_DBA:
- return 2;
- case ApprovalNode_GroupValue.PROJECT_OWNER:
- return 3;
- case ApprovalNode_GroupValue.PROJECT_MEMBER:
- return 4;
- case ApprovalNode_GroupValue.UNRECOGNIZED:
- default:
- return -1;
- }
-}
-
function createBaseIssuePayloadApproval(): IssuePayloadApproval {
return {
approvalTemplates: [],
@@ -826,7 +746,7 @@ export const ApprovalStep: MessageFns<ApprovalStep> = {
};
function createBaseApprovalNode(): ApprovalNode {
- return { type: ApprovalNode_Type.TYPE_UNSPECIFIED, groupValue: undefined, role: undefined };
+ return { type: ApprovalNode_Type.TYPE_UNSPECIFIED, role: "" };
}
export const ApprovalNode: MessageFns<ApprovalNode> = {
@@ -834,11 +754,8 @@ export const ApprovalNode: MessageFns<ApprovalNode> = {
if (message.type !== ApprovalNode_Type.TYPE_UNSPECIFIED) {
writer.uint32(8).int32(approvalNode_TypeToNumber(message.type));
}
- if (message.groupValue !== undefined) {
- writer.uint32(16).int32(approvalNode_GroupValueToNumber(message.groupValue));
- }
- if (message.role !== undefined) {
- writer.uint32(26).string(message.role);
+ if (message.role !== "") {
+ writer.uint32(18).string(message.role);
}
return writer;
},
@@ -859,15 +776,7 @@ export const ApprovalNode: MessageFns<ApprovalNode> = {
continue;
}
case 2: {
- if (tag !== 16) {
- break;
- }
-
- message.groupValue = approvalNode_GroupValueFromJSON(reader.int32());
- continue;
- }
- case 3: {
- if (tag !== 26) {
+ if (tag !== 18) {
break;
}
@@ -886,8 +795,7 @@ export const ApprovalNode: MessageFns<ApprovalNode> = {
fromJSON(object: any): ApprovalNode {
return {
type: isSet(object.type) ? approvalNode_TypeFromJSON(object.type) : ApprovalNode_Type.TYPE_UNSPECIFIED,
- groupValue: isSet(object.groupValue) ? approvalNode_GroupValueFromJSON(object.groupValue) : undefined,
- role: isSet(object.role) ? globalThis.String(object.role) : undefined,
+ role: isSet(object.role) ? globalThis.String(object.role) : "",
};
},
@@ -896,10 +804,7 @@ export const ApprovalNode: MessageFns<ApprovalNode> = {
if (message.type !== ApprovalNode_Type.TYPE_UNSPECIFIED) {
obj.type = approvalNode_TypeToJSON(message.type);
}
- if (message.groupValue !== undefined) {
- obj.groupValue = approvalNode_GroupValueToJSON(message.groupValue);
- }
- if (message.role !== undefined) {
+ if (message.role !== "") {
obj.role = message.role;
}
return obj;
@@ -911,8 +816,7 @@ export const ApprovalNode: MessageFns<ApprovalNode> = {
fromPartial(object: DeepPartial<ApprovalNode>): ApprovalNode {
const message = createBaseApprovalNode();
message.type = object.type ?? ApprovalNode_Type.TYPE_UNSPECIFIED;
- message.groupValue = object.groupValue ?? undefined;
- message.role = object.role ?? undefined;
+ message.role = object.role ?? "";
return message;
},
};
diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.md
index e595106514..78bd7e6943 100644
--- a/proto/gen/grpc-doc/store/README.md
+++ b/proto/gen/grpc-doc/store/README.md
@@ -26,7 +26,6 @@
- [IssuePayloadApproval](#bytebase-store-IssuePayloadApproval)
- [IssuePayloadApproval.Approver](#bytebase-store-IssuePayloadApproval-Approver)
- - [ApprovalNode.GroupValue](#bytebase-store-ApprovalNode-GroupValue)
- [ApprovalNode.Type](#bytebase-store-ApprovalNode-Type)
- [ApprovalStep.Type](#bytebase-store-ApprovalStep-Type)
- [IssuePayloadApproval.Approver.Status](#bytebase-store-IssuePayloadApproval-Approver-Status)
@@ -561,8 +560,7 @@ offset.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| type | [ApprovalNode.Type](#bytebase-store-ApprovalNode-Type) | | |
-| group_value | [ApprovalNode.GroupValue](#bytebase-store-ApprovalNode-GroupValue) | | |
-| role | [string](#string) | | Format: roles/{role} |
+| role | [string](#string) | | |
@@ -641,25 +639,6 @@ IssuePayloadApproval records the approval template used and the approval history
-<a name="bytebase-store-ApprovalNode-GroupValue"></a>
-
-### ApprovalNode.GroupValue
-The predefined user groups are:
-- WORKSPACE_OWNER
-- WORKSPACE_DBA
-- PROJECT_OWNER
-- PROJECT_MEMBER
-
-| Name | Number | Description |
-| ---- | ------ | ----------- |
-| GROUP_VALUE_UNSPECIFILED | 0 | |
-| WORKSPACE_OWNER | 1 | |
-| WORKSPACE_DBA | 2 | |
-| PROJECT_OWNER | 3 | |
-| PROJECT_MEMBER | 4 | |
-
-
-
<a name="bytebase-store-ApprovalNode-Type"></a>
### ApprovalNode.Type
diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.html
index ecd00772bf..07bd9d52cf 100644
--- a/proto/gen/grpc-doc/store/index.html
+++ b/proto/gen/grpc-doc/store/index.html
@@ -261,10 +261,6 @@
</li>
- <li>
- <a href="#bytebase.store.ApprovalNode.GroupValue"><span class="badge">E</span>ApprovalNode.GroupValue</a>
- </li>
-
<li>
<a href="#bytebase.store.ApprovalNode.Type"><span class="badge">E</span>ApprovalNode.Type</a>
</li>
@@ -2080,18 +2076,11 @@ TODO: use range instead. </p></td>
<td><p> </p></td>
</tr>
- <tr>
- <td>group_value</td>
- <td><a href="#bytebase.store.ApprovalNode.GroupValue">ApprovalNode.GroupValue</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
<tr>
<td>role</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>Format: roles/{role} </p></td>
+ <td><p> </p></td>
</tr>
</tbody>
@@ -2263,47 +2252,6 @@ If `true`, other fields are available. </p></td>
- <h3 id="bytebase.store.ApprovalNode.GroupValue">ApprovalNode.GroupValue</h3>
- <p>The predefined user groups are:</p><p>- WORKSPACE_OWNER</p><p>- WORKSPACE_DBA</p><p>- PROJECT_OWNER</p><p>- PROJECT_MEMBER</p>
- <table class="enum-table">
- <thead>
- <tr><td>Name</td><td>Number</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>GROUP_VALUE_UNSPECIFILED</td>
- <td>0</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>WORKSPACE_OWNER</td>
- <td>1</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>WORKSPACE_DBA</td>
- <td>2</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>PROJECT_OWNER</td>
- <td>3</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>PROJECT_MEMBER</td>
- <td>4</td>
- <td><p></p></td>
- </tr>
-
- </tbody>
- </table>
-
<h3 id="bytebase.store.ApprovalNode.Type">ApprovalNode.Type</h3>
<p>Type of the ApprovalNode.</p><p>type determines who should approve this node.</p><p>ANY_IN_GROUP means the ApprovalNode can be approved by an user from our predefined user group.</p><p>See GroupValue below for the predefined user groups.</p>
<table class="enum-table">
diff --git a/proto/generated-go/store/approval.pb.go b/proto/generated-go/store/approval.pb.go
index 275ebc3293..a405e98017 100644
--- a/proto/generated-go/store/approval.pb.go
+++ b/proto/generated-go/store/approval.pb.go
@@ -227,66 +227,6 @@ func (ApprovalNode_Type) EnumDescriptor() ([]byte, []int) {
return file_store_approval_proto_rawDescGZIP(), []int{4, 0}
}
-// The predefined user groups are:
-// - WORKSPACE_OWNER
-// - WORKSPACE_DBA
-// - PROJECT_OWNER
-// - PROJECT_MEMBER
-type ApprovalNode_GroupValue int32
-
-const (
- ApprovalNode_GROUP_VALUE_UNSPECIFILED ApprovalNode_GroupValue = 0
- ApprovalNode_WORKSPACE_OWNER ApprovalNode_GroupValue = 1
- ApprovalNode_WORKSPACE_DBA ApprovalNode_GroupValue = 2
- ApprovalNode_PROJECT_OWNER ApprovalNode_GroupValue = 3
- ApprovalNode_PROJECT_MEMBER ApprovalNode_GroupValue = 4
-)
-
-// Enum value maps for ApprovalNode_GroupValue.
-var (
- ApprovalNode_GroupValue_name = map[int32]string{
- 0: "GROUP_VALUE_UNSPECIFILED",
- 1: "WORKSPACE_OWNER",
- 2: "WORKSPACE_DBA",
- 3: "PROJECT_OWNER",
- 4: "PROJECT_MEMBER",
- }
- ApprovalNode_GroupValue_value = map[string]int32{
- "GROUP_VALUE_UNSPECIFILED": 0,
- "WORKSPACE_OWNER": 1,
- "WORKSPACE_DBA": 2,
- "PROJECT_OWNER": 3,
- "PROJECT_MEMBER": 4,
- }
-)
-
-func (x ApprovalNode_GroupValue) Enum() *ApprovalNode_GroupValue {
- p := new(ApprovalNode_GroupValue)
- *p = x
- return p
-}
-
-func (x ApprovalNode_GroupValue) String() string {
- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
-}
-
-func (ApprovalNode_GroupValue) Descriptor() protoreflect.EnumDescriptor {
- return file_store_approval_proto_enumTypes[4].Descriptor()
-}
-
-func (ApprovalNode_GroupValue) Type() protoreflect.EnumType {
- return &file_store_approval_proto_enumTypes[4]
-}
-
-func (x ApprovalNode_GroupValue) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(x)
-}
-
-// Deprecated: Use ApprovalNode_GroupValue.Descriptor instead.
-func (ApprovalNode_GroupValue) EnumDescriptor() ([]byte, []int) {
- return file_store_approval_proto_rawDescGZIP(), []int{4, 1}
-}
-
// IssuePayloadApproval is a part of the payload of an issue.
// IssuePayloadApproval records the approval template used and the approval history.
type IssuePayloadApproval struct {
@@ -532,13 +472,9 @@ func (x *ApprovalStep) GetNodes() []*ApprovalNode {
}
type ApprovalNode struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- Type ApprovalNode_Type `protobuf:"varint,1,opt,name=type,proto3,enum=bytebase.store.ApprovalNode_Type" json:"type,omitempty"`
- // Types that are valid to be assigned to Payload:
- //
- // *ApprovalNode_GroupValue_
- // *ApprovalNode_Role
- Payload isApprovalNode_Payload `protobuf_oneof:"payload"`
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Type ApprovalNode_Type `protobuf:"varint,1,opt,name=type,proto3,enum=bytebase.store.ApprovalNode_Type" json:"type,omitempty"`
+ Role string `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -580,48 +516,13 @@ func (x *ApprovalNode) GetType() ApprovalNode_Type {
return ApprovalNode_TYPE_UNSPECIFIED
}
-func (x *ApprovalNode) GetPayload() isApprovalNode_Payload {
- if x != nil {
- return x.Payload
- }
- return nil
-}
-
-func (x *ApprovalNode) GetGroupValue() ApprovalNode_GroupValue {
- if x != nil {
- if x, ok := x.Payload.(*ApprovalNode_GroupValue_); ok {
- return x.GroupValue
- }
- }
- return ApprovalNode_GROUP_VALUE_UNSPECIFILED
-}
-
func (x *ApprovalNode) GetRole() string {
if x != nil {
- if x, ok := x.Payload.(*ApprovalNode_Role); ok {
- return x.Role
- }
+ return x.Role
}
return ""
}
-type isApprovalNode_Payload interface {
- isApprovalNode_Payload()
-}
-
-type ApprovalNode_GroupValue_ struct {
- GroupValue ApprovalNode_GroupValue `protobuf:"varint,2,opt,name=group_value,json=groupValue,proto3,enum=bytebase.store.ApprovalNode_GroupValue,oneof"`
-}
-
-type ApprovalNode_Role struct {
- // Format: roles/{role}
- Role string `protobuf:"bytes,3,opt,name=role,proto3,oneof"`
-}
-
-func (*ApprovalNode_GroupValue_) isApprovalNode_Payload() {}
-
-func (*ApprovalNode_Role) isApprovalNode_Payload() {}
-
type IssuePayloadApproval_Approver struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The new status.
@@ -715,23 +616,13 @@ const file_store_approval_proto_rawDesc = "" +
"\x04Type\x12\x14\n" +
"\x10TYPE_UNSPECIFIED\x10\x00\x12\a\n" +
"\x03ALL\x10\x01\x12\a\n" +
- "\x03ANY\x10\x02\"\xdd\x02\n" +
+ "\x03ANY\x10\x02\"\x89\x01\n" +
"\fApprovalNode\x125\n" +
- "\x04type\x18\x01 \x01(\x0e2!.bytebase.store.ApprovalNode.TypeR\x04type\x12J\n" +
- "\vgroup_value\x18\x02 \x01(\x0e2'.bytebase.store.ApprovalNode.GroupValueH\x00R\n" +
- "groupValue\x12\x14\n" +
- "\x04role\x18\x03 \x01(\tH\x00R\x04role\".\n" +
+ "\x04type\x18\x01 \x01(\x0e2!.bytebase.store.ApprovalNode.TypeR\x04type\x12\x12\n" +
+ "\x04role\x18\x02 \x01(\tR\x04role\".\n" +
"\x04Type\x12\x14\n" +
"\x10TYPE_UNSPECIFIED\x10\x00\x12\x10\n" +
- "\fANY_IN_GROUP\x10\x01\"y\n" +
- "\n" +
- "GroupValue\x12\x1c\n" +
- "\x18GROUP_VALUE_UNSPECIFILED\x10\x00\x12\x13\n" +
- "\x0fWORKSPACE_OWNER\x10\x01\x12\x11\n" +
- "\rWORKSPACE_DBA\x10\x02\x12\x11\n" +
- "\rPROJECT_OWNER\x10\x03\x12\x12\n" +
- "\x0ePROJECT_MEMBER\x10\x04B\t\n" +
- "\apayloadB\x14Z\x12generated-go/storeb\x06proto3"
+ "\fANY_IN_GROUP\x10\x01B\x14Z\x12generated-go/storeb\x06proto3"
var (
file_store_approval_proto_rawDescOnce sync.Once
@@ -745,37 +636,35 @@ func file_store_approval_proto_rawDescGZIP() []byte {
return file_store_approval_proto_rawDescData
}
-var file_store_approval_proto_enumTypes = make([]protoimpl.EnumInfo, 5)
+var file_store_approval_proto_enumTypes = make([]protoimpl.EnumInfo, 4)
var file_store_approval_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_store_approval_proto_goTypes = []any{
(IssuePayloadApproval_RiskLevel)(0), // 0: bytebase.store.IssuePayloadApproval.RiskLevel
(IssuePayloadApproval_Approver_Status)(0), // 1: bytebase.store.IssuePayloadApproval.Approver.Status
(ApprovalStep_Type)(0), // 2: bytebase.store.ApprovalStep.Type
(ApprovalNode_Type)(0), // 3: bytebase.store.ApprovalNode.Type
- (ApprovalNode_GroupValue)(0), // 4: bytebase.store.ApprovalNode.GroupValue
- (*IssuePayloadApproval)(nil), // 5: bytebase.store.IssuePayloadApproval
- (*ApprovalTemplate)(nil), // 6: bytebase.store.ApprovalTemplate
- (*ApprovalFlow)(nil), // 7: bytebase.store.ApprovalFlow
- (*ApprovalStep)(nil), // 8: bytebase.store.ApprovalStep
- (*ApprovalNode)(nil), // 9: bytebase.store.ApprovalNode
- (*IssuePayloadApproval_Approver)(nil), // 10: bytebase.store.IssuePayloadApproval.Approver
+ (*IssuePayloadApproval)(nil), // 4: bytebase.store.IssuePayloadApproval
+ (*ApprovalTemplate)(nil), // 5: bytebase.store.ApprovalTemplate
+ (*ApprovalFlow)(nil), // 6: bytebase.store.ApprovalFlow
+ (*ApprovalStep)(nil), // 7: bytebase.store.ApprovalStep
+ (*ApprovalNode)(nil), // 8: bytebase.store.ApprovalNode
+ (*IssuePayloadApproval_Approver)(nil), // 9: bytebase.store.IssuePayloadApproval.Approver
}
var file_store_approval_proto_depIdxs = []int32{
- 6, // 0: bytebase.store.IssuePayloadApproval.approval_templates:type_name -> bytebase.store.ApprovalTemplate
- 10, // 1: bytebase.store.IssuePayloadApproval.approvers:type_name -> bytebase.store.IssuePayloadApproval.Approver
- 0, // 2: bytebase.store.IssuePayloadApproval.risk_level:type_name -> bytebase.store.IssuePayloadApproval.RiskLevel
- 7, // 3: bytebase.store.ApprovalTemplate.flow:type_name -> bytebase.store.ApprovalFlow
- 8, // 4: bytebase.store.ApprovalFlow.steps:type_name -> bytebase.store.ApprovalStep
- 2, // 5: bytebase.store.ApprovalStep.type:type_name -> bytebase.store.ApprovalStep.Type
- 9, // 6: bytebase.store.ApprovalStep.nodes:type_name -> bytebase.store.ApprovalNode
- 3, // 7: bytebase.store.ApprovalNode.type:type_name -> bytebase.store.ApprovalNode.Type
- 4, // 8: bytebase.store.ApprovalNode.group_value:type_name -> bytebase.store.ApprovalNode.GroupValue
- 1, // 9: bytebase.store.IssuePayloadApproval.Approver.status:type_name -> bytebase.store.IssuePayloadApproval.Approver.Status
- 10, // [10:10] is the sub-list for method output_type
- 10, // [10:10] 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
+ 5, // 0: bytebase.store.IssuePayloadApproval.approval_templates:type_name -> bytebase.store.ApprovalTemplate
+ 9, // 1: bytebase.store.IssuePayloadApproval.approvers:type_name -> bytebase.store.IssuePayloadApproval.Approver
+ 0, // 2: bytebase.store.IssuePayloadApproval.risk_level:type_name -> bytebase.store.IssuePayloadApproval.RiskLevel
+ 6, // 3: bytebase.store.ApprovalTemplate.flow:type_name -> bytebase.store.ApprovalFlow
+ 7, // 4: bytebase.store.ApprovalFlow.steps:type_name -> bytebase.store.ApprovalStep
+ 2, // 5: bytebase.store.ApprovalStep.type:type_name -> bytebase.store.ApprovalStep.Type
+ 8, // 6: bytebase.store.ApprovalStep.nodes:type_name -> bytebase.store.ApprovalNode
+ 3, // 7: bytebase.store.ApprovalNode.type:type_name -> bytebase.store.ApprovalNode.Type
+ 1, // 8: bytebase.store.IssuePayloadApproval.Approver.status:type_name -> bytebase.store.IssuePayloadApproval.Approver.Status
+ 9, // [9:9] is the sub-list for method output_type
+ 9, // [9:9] is the sub-list for method input_type
+ 9, // [9:9] is the sub-list for extension type_name
+ 9, // [9:9] is the sub-list for extension extendee
+ 0, // [0:9] is the sub-list for field type_name
}
func init() { file_store_approval_proto_init() }
@@ -783,16 +672,12 @@ func file_store_approval_proto_init() {
if File_store_approval_proto != nil {
return
}
- file_store_approval_proto_msgTypes[4].OneofWrappers = []any{
- (*ApprovalNode_GroupValue_)(nil),
- (*ApprovalNode_Role)(nil),
- }
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_store_approval_proto_rawDesc), len(file_store_approval_proto_rawDesc)),
- NumEnums: 5,
+ NumEnums: 4,
NumMessages: 6,
NumExtensions: 0,
NumServices: 0,
diff --git a/proto/store/approval.proto b/proto/store/approval.proto
index 2d5b9692d2..99474de78a 100644
--- a/proto/store/approval.proto
+++ b/proto/store/approval.proto
@@ -75,21 +75,5 @@ message ApprovalNode {
}
Type type = 1;
- // The predefined user groups are:
- // - WORKSPACE_OWNER
- // - WORKSPACE_DBA
- // - PROJECT_OWNER
- // - PROJECT_MEMBER
- enum GroupValue {
- GROUP_VALUE_UNSPECIFILED = 0;
- WORKSPACE_OWNER = 1;
- WORKSPACE_DBA = 2;
- PROJECT_OWNER = 3;
- PROJECT_MEMBER = 4;
- }
- oneof payload {
- GroupValue group_value = 2;
- // Format: roles/{role}
- string role = 3;
- }
+ string role = 2;
}