Skip to content

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

refactor: standardize database group permissions (#18256)

boojack357a430f8682
diff --git a/backend/api/auth/auth_test.go b/backend/api/auth/auth_test.go
index f4532fd2b4..09b9675176 100644
--- a/backend/api/auth/auth_test.go
+++ b/backend/api/auth/auth_test.go
@@ -40,7 +40,7 @@ func TestGetAllowMissingRequiredPermission(t *testing.T) {
{
name: "DatabaseGroupService.UpdateDatabaseGroup has annotation",
fullMethod: "/bytebase.v1.DatabaseGroupService/UpdateDatabaseGroup",
- wantPerm: "bb.projects.update",
+ wantPerm: "bb.databaseGroups.create",
wantErr: false,
},
{
diff --git a/backend/api/v1/database_group_service.go b/backend/api/v1/database_group_service.go
index e35e29e875..d82b8a1f25 100644
--- a/backend/api/v1/database_group_service.go
+++ b/backend/api/v1/database_group_service.go
@@ -86,18 +86,6 @@ func (s *DatabaseGroupService) CreateDatabaseGroup(ctx context.Context, req *con
return connect.NewResponse(result), nil
}
- user, ok := GetUserFromContext(ctx)
- if !ok {
- return nil, connect.NewError(connect.CodeInternal, errors.Errorf("user not found"))
- }
- hasPermission, err := s.iamManager.CheckPermission(ctx, iam.PermissionProjectsUpdate, user, project.ResourceID)
- if err != nil {
- return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to check permission with error"))
- }
- if !hasPermission {
- return nil, connect.NewError(connect.CodePermissionDenied, errors.Errorf("user does not have permission %q", iam.PermissionProjectsUpdate))
- }
-
databaseGroup, err := s.store.CreateDatabaseGroup(ctx, storeDatabaseGroup)
if err != nil {
return nil, connect.NewError(connect.CodeInternal, err)
@@ -145,12 +133,12 @@ func (s *DatabaseGroupService) UpdateDatabaseGroup(ctx context.Context, req *con
}
if existedDatabaseGroup == nil {
if req.Msg.AllowMissing {
- ok, err := s.iamManager.CheckPermission(ctx, iam.PermissionProjectsUpdate, user, project.ResourceID)
+ ok, err := s.iamManager.CheckPermission(ctx, iam.PermissionDatabaseGroupsCreate, user, project.ResourceID)
if err != nil {
return nil, connect.NewError(connect.CodeInternal, errors.Wrap(err, "failed to check permission"))
}
if !ok {
- return nil, connect.NewError(connect.CodePermissionDenied, errors.Errorf("user does not have permission %q", iam.PermissionProjectsUpdate))
+ return nil, connect.NewError(connect.CodePermissionDenied, errors.Errorf("user does not have permission %q", iam.PermissionDatabaseGroupsCreate))
}
return s.CreateDatabaseGroup(ctx, connect.NewRequest(&v1pb.CreateDatabaseGroupRequest{
Parent: common.FormatProject(project.ResourceID),
diff --git a/backend/component/iam/acl.yaml b/backend/component/iam/acl.yaml
index f71636e90b..b592a3b4d1 100644
--- a/backend/component/iam/acl.yaml
+++ b/backend/component/iam/acl.yaml
@@ -8,6 +8,11 @@ roles:
- bb.changelogs.list
- bb.databaseCatalogs.get
- bb.databaseCatalogs.update
+ - bb.databaseGroups.create
+ - bb.databaseGroups.delete
+ - bb.databaseGroups.get
+ - bb.databaseGroups.list
+ - bb.databaseGroups.update
- bb.databases.check
- bb.databases.get
- bb.databases.getSchema
@@ -120,6 +125,11 @@ roles:
- bb.changelogs.list
- bb.databaseCatalogs.get
- bb.databaseCatalogs.update
+ - bb.databaseGroups.create
+ - bb.databaseGroups.delete
+ - bb.databaseGroups.get
+ - bb.databaseGroups.list
+ - bb.databaseGroups.update
- bb.databases.check
- bb.databases.get
- bb.databases.getSchema
@@ -240,6 +250,11 @@ roles:
- bb.changelogs.list
- bb.databaseCatalogs.get
- bb.databaseCatalogs.update
+ - bb.databaseGroups.create
+ - bb.databaseGroups.delete
+ - bb.databaseGroups.get
+ - bb.databaseGroups.list
+ - bb.databaseGroups.update
- bb.databases.check
- bb.databases.get
- bb.databases.getSchema
@@ -300,6 +315,8 @@ roles:
- bb.changelogs.get
- bb.changelogs.list
- bb.databaseCatalogs.get
+ - bb.databaseGroups.get
+ - bb.databaseGroups.list
- bb.databases.check
- bb.databases.get
- bb.databases.getSchema
@@ -336,6 +353,8 @@ roles:
title: SQL Editor User
permissions:
- bb.databaseCatalogs.get
+ - bb.databaseGroups.get
+ - bb.databaseGroups.list
- bb.databases.check
- bb.databases.get
- bb.databases.getSchema
@@ -354,6 +373,8 @@ roles:
permissions:
- bb.databaseCatalogs.get
- bb.changelogs.get
+ - bb.databaseGroups.get
+ - bb.databaseGroups.list
- bb.databases.check
- bb.databases.get
- bb.databases.getSchema
@@ -395,6 +416,8 @@ roles:
title: Project viewer
permissions:
- bb.databaseCatalogs.get
+ - bb.databaseGroups.get
+ - bb.databaseGroups.list
- bb.databases.get
- bb.databases.getSchema
- bb.databases.list
diff --git a/backend/component/iam/permission.go b/backend/component/iam/permission.go
index 9268285250..5dac5c65cb 100644
--- a/backend/component/iam/permission.go
+++ b/backend/component/iam/permission.go
@@ -9,6 +9,11 @@ const (
PermissionChangelogsList Permission = "bb.changelogs.list"
PermissionDatabaseCatalogsGet Permission = "bb.databaseCatalogs.get"
PermissionDatabaseCatalogsUpdate Permission = "bb.databaseCatalogs.update"
+ PermissionDatabaseGroupsCreate Permission = "bb.databaseGroups.create"
+ PermissionDatabaseGroupsDelete Permission = "bb.databaseGroups.delete"
+ PermissionDatabaseGroupsGet Permission = "bb.databaseGroups.get"
+ PermissionDatabaseGroupsList Permission = "bb.databaseGroups.list"
+ PermissionDatabaseGroupsUpdate Permission = "bb.databaseGroups.update"
PermissionDatabasesCheck Permission = "bb.databases.check"
PermissionDatabasesGet Permission = "bb.databases.get"
PermissionDatabasesGetSchema Permission = "bb.databases.getSchema"
@@ -121,6 +126,11 @@ var allPermissions = []Permission{
PermissionChangelogsList,
PermissionDatabaseCatalogsGet,
PermissionDatabaseCatalogsUpdate,
+ PermissionDatabaseGroupsCreate,
+ PermissionDatabaseGroupsDelete,
+ PermissionDatabaseGroupsGet,
+ PermissionDatabaseGroupsList,
+ PermissionDatabaseGroupsUpdate,
PermissionDatabasesCheck,
PermissionDatabasesGet,
PermissionDatabasesGetSchema,
diff --git a/backend/component/iam/permission.yaml b/backend/component/iam/permission.yaml
index d08015e038..c7e8b6332d 100644
--- a/backend/component/iam/permission.yaml
+++ b/backend/component/iam/permission.yaml
@@ -5,6 +5,11 @@ permissions:
- bb.changelogs.list
- bb.databaseCatalogs.get
- bb.databaseCatalogs.update
+ - bb.databaseGroups.create
+ - bb.databaseGroups.delete
+ - bb.databaseGroups.get
+ - bb.databaseGroups.list
+ - bb.databaseGroups.update
- bb.databases.check
- bb.databases.get
- bb.databases.getSchema
diff --git a/backend/generated-go/v1/database_group_service.pb.go b/backend/generated-go/v1/database_group_service.pb.go
index 53f7161bc9..e833a9cd13 100644
--- a/backend/generated-go/v1/database_group_service.pb.go
+++ b/backend/generated-go/v1/database_group_service.pb.go
@@ -604,13 +604,13 @@ const file_v1_database_group_service_proto_rawDesc = "" +
"\x11DatabaseGroupView\x12#\n" +
"\x1fDATABASE_GROUP_VIEW_UNSPECIFIED\x10\x00\x12\x1d\n" +
"\x19DATABASE_GROUP_VIEW_BASIC\x10\x01\x12\x1c\n" +
- "\x18DATABASE_GROUP_VIEW_FULL\x10\x022\xf1\a\n" +
- "\x14DatabaseGroupService\x12\xb5\x01\n" +
- "\x12ListDatabaseGroups\x12&.bytebase.v1.ListDatabaseGroupsRequest\x1a'.bytebase.v1.ListDatabaseGroupsResponse\"N\xdaA\x06parent\x8a\xea0\x0fbb.projects.get\x90\xea0\x01\x82\xd3\xe4\x93\x02(\x12&/v1/{parent=projects/*}/databaseGroups\x12\xa2\x01\n" +
- "\x10GetDatabaseGroup\x12$.bytebase.v1.GetDatabaseGroupRequest\x1a\x1a.bytebase.v1.DatabaseGroup\"L\xdaA\x04name\x8a\xea0\x0fbb.projects.get\x90\xea0\x01\x82\xd3\xe4\x93\x02(\x12&/v1/{name=projects/*/databaseGroups/*}\x12\xcf\x01\n" +
- "\x13CreateDatabaseGroup\x12'.bytebase.v1.CreateDatabaseGroupRequest\x1a\x1a.bytebase.v1.DatabaseGroup\"s\xdaA\x14parent,databaseGroup\x8a\xea0\x12bb.projects.update\x90\xea0\x02\x98\xea0\x01\x82\xd3\xe4\x93\x028:\x0edatabase_group\"&/v1/{parent=projects/*}/databaseGroups\x12\xfb\x01\n" +
- "\x13UpdateDatabaseGroup\x12'.bytebase.v1.UpdateDatabaseGroupRequest\x1a\x1a.bytebase.v1.DatabaseGroup\"\x9e\x01\xdaA\x1adatabase_group,update_mask\x8a\xea0\x12bb.projects.update\x90\xea0\x01\x98\xea0\x01\xa2\xea0\x12bb.projects.update\x82\xd3\xe4\x93\x02G:\x0edatabase_group25/v1/{database_group.name=projects/*/databaseGroups/*}\x12\xab\x01\n" +
- "\x13DeleteDatabaseGroup\x12'.bytebase.v1.DeleteDatabaseGroupRequest\x1a\x16.google.protobuf.Empty\"S\xdaA\x04name\x8a\xea0\x12bb.projects.update\x90\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02(*&/v1/{name=projects/*/databaseGroups/*}B\xaf\x01\n" +
+ "\x18DATABASE_GROUP_VIEW_FULL\x10\x022\x96\b\n" +
+ "\x14DatabaseGroupService\x12\xbc\x01\n" +
+ "\x12ListDatabaseGroups\x12&.bytebase.v1.ListDatabaseGroupsRequest\x1a'.bytebase.v1.ListDatabaseGroupsResponse\"U\xdaA\x06parent\x8a\xea0\x16bb.databaseGroups.list\x90\xea0\x01\x82\xd3\xe4\x93\x02(\x12&/v1/{parent=projects/*}/databaseGroups\x12\xa8\x01\n" +
+ "\x10GetDatabaseGroup\x12$.bytebase.v1.GetDatabaseGroupRequest\x1a\x1a.bytebase.v1.DatabaseGroup\"R\xdaA\x04name\x8a\xea0\x15bb.databaseGroups.get\x90\xea0\x01\x82\xd3\xe4\x93\x02(\x12&/v1/{name=projects/*/databaseGroups/*}\x12\xd5\x01\n" +
+ "\x13CreateDatabaseGroup\x12'.bytebase.v1.CreateDatabaseGroupRequest\x1a\x1a.bytebase.v1.DatabaseGroup\"y\xdaA\x14parent,databaseGroup\x8a\xea0\x18bb.databaseGroups.create\x90\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x028:\x0edatabase_group\"&/v1/{parent=projects/*}/databaseGroups\x12\x87\x02\n" +
+ "\x13UpdateDatabaseGroup\x12'.bytebase.v1.UpdateDatabaseGroupRequest\x1a\x1a.bytebase.v1.DatabaseGroup\"\xaa\x01\xdaA\x1adatabase_group,update_mask\x8a\xea0\x18bb.databaseGroups.update\x90\xea0\x01\x98\xea0\x01\xa2\xea0\x18bb.databaseGroups.create\x82\xd3\xe4\x93\x02G:\x0edatabase_group25/v1/{database_group.name=projects/*/databaseGroups/*}\x12\xb1\x01\n" +
+ "\x13DeleteDatabaseGroup\x12'.bytebase.v1.DeleteDatabaseGroupRequest\x1a\x16.google.protobuf.Empty\"Y\xdaA\x04name\x8a\xea0\x18bb.databaseGroups.delete\x90\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02(*&/v1/{name=projects/*/databaseGroups/*}B\xaf\x01\n" +
"\x0fcom.bytebase.v1B\x19DatabaseGroupServiceProtoP\x01Z4github.com/bytebase/bytebase/backend/generated-go/v1\xa2\x02\x03BXX\xaa\x02\vBytebase.V1\xca\x02\vBytebase\\V1\xe2\x02\x17Bytebase\\V1\\GPBMetadata\xea\x02\fBytebase::V1b\x06proto3"
var (
diff --git a/backend/generated-go/v1/database_group_service_grpc.pb.go b/backend/generated-go/v1/database_group_service_grpc.pb.go
index adc749e0cc..5632c4e433 100644
--- a/backend/generated-go/v1/database_group_service_grpc.pb.go
+++ b/backend/generated-go/v1/database_group_service_grpc.pb.go
@@ -34,20 +34,20 @@ const (
// DatabaseGroupService manages database groups for organizing databases by criteria.
type DatabaseGroupServiceClient interface {
// Lists database groups in a project.
- // Permissions required: bb.projects.get
+ // Permissions required: bb.databaseGroups.list
ListDatabaseGroups(ctx context.Context, in *ListDatabaseGroupsRequest, opts ...grpc.CallOption) (*ListDatabaseGroupsResponse, error)
// Gets a database group by name.
- // Permissions required: bb.projects.get
+ // Permissions required: bb.databaseGroups.get
GetDatabaseGroup(ctx context.Context, in *GetDatabaseGroupRequest, opts ...grpc.CallOption) (*DatabaseGroup, error)
// Creates a new database group.
- // Permissions required: bb.projects.update
+ // Permissions required: bb.databaseGroups.create
CreateDatabaseGroup(ctx context.Context, in *CreateDatabaseGroupRequest, opts ...grpc.CallOption) (*DatabaseGroup, error)
// Updates a database group.
- // Permissions required: bb.projects.update
- // When allow_missing=true, also requires: bb.projects.update
+ // Permissions required: bb.databaseGroups.update
+ // When allow_missing=true, also requires: bb.databaseGroups.create
UpdateDatabaseGroup(ctx context.Context, in *UpdateDatabaseGroupRequest, opts ...grpc.CallOption) (*DatabaseGroup, error)
// Deletes a database group.
- // Permissions required: bb.projects.update
+ // Permissions required: bb.databaseGroups.delete
DeleteDatabaseGroup(ctx context.Context, in *DeleteDatabaseGroupRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}
@@ -116,20 +116,20 @@ func (c *databaseGroupServiceClient) DeleteDatabaseGroup(ctx context.Context, in
// DatabaseGroupService manages database groups for organizing databases by criteria.
type DatabaseGroupServiceServer interface {
// Lists database groups in a project.
- // Permissions required: bb.projects.get
+ // Permissions required: bb.databaseGroups.list
ListDatabaseGroups(context.Context, *ListDatabaseGroupsRequest) (*ListDatabaseGroupsResponse, error)
// Gets a database group by name.
- // Permissions required: bb.projects.get
+ // Permissions required: bb.databaseGroups.get
GetDatabaseGroup(context.Context, *GetDatabaseGroupRequest) (*DatabaseGroup, error)
// Creates a new database group.
- // Permissions required: bb.projects.update
+ // Permissions required: bb.databaseGroups.create
CreateDatabaseGroup(context.Context, *CreateDatabaseGroupRequest) (*DatabaseGroup, error)
// Updates a database group.
- // Permissions required: bb.projects.update
- // When allow_missing=true, also requires: bb.projects.update
+ // Permissions required: bb.databaseGroups.update
+ // When allow_missing=true, also requires: bb.databaseGroups.create
UpdateDatabaseGroup(context.Context, *UpdateDatabaseGroupRequest) (*DatabaseGroup, error)
// Deletes a database group.
- // Permissions required: bb.projects.update
+ // Permissions required: bb.databaseGroups.delete
DeleteDatabaseGroup(context.Context, *DeleteDatabaseGroupRequest) (*emptypb.Empty, error)
mustEmbedUnimplementedDatabaseGroupServiceServer()
}
diff --git a/backend/generated-go/v1/v1connect/database_group_service.connect.go b/backend/generated-go/v1/v1connect/database_group_service.connect.go
index 08665b4990..39e70ae1b8 100644
--- a/backend/generated-go/v1/v1connect/database_group_service.connect.go
+++ b/backend/generated-go/v1/v1connect/database_group_service.connect.go
@@ -54,20 +54,20 @@ const (
// DatabaseGroupServiceClient is a client for the bytebase.v1.DatabaseGroupService service.
type DatabaseGroupServiceClient interface {
// Lists database groups in a project.
- // Permissions required: bb.projects.get
+ // Permissions required: bb.databaseGroups.list
ListDatabaseGroups(context.Context, *connect.Request[v1.ListDatabaseGroupsRequest]) (*connect.Response[v1.ListDatabaseGroupsResponse], error)
// Gets a database group by name.
- // Permissions required: bb.projects.get
+ // Permissions required: bb.databaseGroups.get
GetDatabaseGroup(context.Context, *connect.Request[v1.GetDatabaseGroupRequest]) (*connect.Response[v1.DatabaseGroup], error)
// Creates a new database group.
- // Permissions required: bb.projects.update
+ // Permissions required: bb.databaseGroups.create
CreateDatabaseGroup(context.Context, *connect.Request[v1.CreateDatabaseGroupRequest]) (*connect.Response[v1.DatabaseGroup], error)
// Updates a database group.
- // Permissions required: bb.projects.update
- // When allow_missing=true, also requires: bb.projects.update
+ // Permissions required: bb.databaseGroups.update
+ // When allow_missing=true, also requires: bb.databaseGroups.create
UpdateDatabaseGroup(context.Context, *connect.Request[v1.UpdateDatabaseGroupRequest]) (*connect.Response[v1.DatabaseGroup], error)
// Deletes a database group.
- // Permissions required: bb.projects.update
+ // Permissions required: bb.databaseGroups.delete
DeleteDatabaseGroup(context.Context, *connect.Request[v1.DeleteDatabaseGroupRequest]) (*connect.Response[emptypb.Empty], error)
}
@@ -152,20 +152,20 @@ func (c *databaseGroupServiceClient) DeleteDatabaseGroup(ctx context.Context, re
// DatabaseGroupServiceHandler is an implementation of the bytebase.v1.DatabaseGroupService service.
type DatabaseGroupServiceHandler interface {
// Lists database groups in a project.
- // Permissions required: bb.projects.get
+ // Permissions required: bb.databaseGroups.list
ListDatabaseGroups(context.Context, *connect.Request[v1.ListDatabaseGroupsRequest]) (*connect.Response[v1.ListDatabaseGroupsResponse], error)
// Gets a database group by name.
- // Permissions required: bb.projects.get
+ // Permissions required: bb.databaseGroups.get
GetDatabaseGroup(context.Context, *connect.Request[v1.GetDatabaseGroupRequest]) (*connect.Response[v1.DatabaseGroup], error)
// Creates a new database group.
- // Permissions required: bb.projects.update
+ // Permissions required: bb.databaseGroups.create
CreateDatabaseGroup(context.Context, *connect.Request[v1.CreateDatabaseGroupRequest]) (*connect.Response[v1.DatabaseGroup], error)
// Updates a database group.
- // Permissions required: bb.projects.update
- // When allow_missing=true, also requires: bb.projects.update
+ // Permissions required: bb.databaseGroups.update
+ // When allow_missing=true, also requires: bb.databaseGroups.create
UpdateDatabaseGroup(context.Context, *connect.Request[v1.UpdateDatabaseGroupRequest]) (*connect.Response[v1.DatabaseGroup], error)
// Deletes a database group.
- // Permissions required: bb.projects.update
+ // Permissions required: bb.databaseGroups.delete
DeleteDatabaseGroup(context.Context, *connect.Request[v1.DeleteDatabaseGroupRequest]) (*connect.Response[emptypb.Empty], error)
}
diff --git a/backend/migrator/migration/3.13/0004##add_database_group_permissions.sql b/backend/migrator/migration/3.13/0004##add_database_group_permissions.sql
new file mode 100644
index 0000000000..df77f448a6
--- /dev/null
+++ b/backend/migrator/migration/3.13/0004##add_database_group_permissions.sql
@@ -0,0 +1,39 @@
+-- Add bb.databaseGroups.list and bb.databaseGroups.get to roles that have bb.projects.get
+-- This maintains backward compatibility when migrating from bb.projects.get to bb.databaseGroups.list/get
+UPDATE role
+SET permissions = jsonb_set(
+ permissions,
+ '{permissions}',
+ (
+ SELECT jsonb_agg(DISTINCT p ORDER BY p)
+ FROM (
+ SELECT jsonb_array_elements_text(permissions->'permissions') AS p
+ UNION
+ SELECT 'bb.databaseGroups.get'
+ UNION
+ SELECT 'bb.databaseGroups.list'
+ ) sub
+ )
+)
+WHERE permissions->'permissions' ? 'bb.projects.get';
+
+-- Add bb.databaseGroups.create, bb.databaseGroups.update, and bb.databaseGroups.delete to roles that have bb.projects.update
+-- This maintains backward compatibility when migrating from bb.projects.update to bb.databaseGroups.create/update/delete
+UPDATE role
+SET permissions = jsonb_set(
+ permissions,
+ '{permissions}',
+ (
+ SELECT jsonb_agg(DISTINCT p ORDER BY p)
+ FROM (
+ SELECT jsonb_array_elements_text(permissions->'permissions') AS p
+ UNION
+ SELECT 'bb.databaseGroups.create'
+ UNION
+ SELECT 'bb.databaseGroups.delete'
+ UNION
+ SELECT 'bb.databaseGroups.update'
+ ) sub
+ )
+)
+WHERE permissions->'permissions' ? 'bb.projects.update';
diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.go
index d2fc906acc..370e85fa10 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.13.3"), *files[len(files)-1].version)
+ require.Equal(t, semver.MustParse("3.13.4"), *files[len(files)-1].version)
}
func TestVersionUnique(t *testing.T) {
diff --git a/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vue b/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vue
index b3e6eed906..73b4384331 100644
--- a/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vue
+++ b/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vue
@@ -146,7 +146,7 @@ const router = useRouter();
const isCreating = computed(() => props.databaseGroup === undefined);
const allowDelete = computed(() => {
- return hasProjectPermissionV2(props.project, "bb.projects.update");
+ return hasProjectPermissionV2(props.project, "bb.databaseGroups.delete");
});
onMounted(async () => {
diff --git a/frontend/src/router/dashboard/projectV1.ts b/frontend/src/router/dashboard/projectV1.ts
index a48c149c89..603c2b478b 100644
--- a/frontend/src/router/dashboard/projectV1.ts
+++ b/frontend/src/router/dashboard/projectV1.ts
@@ -201,7 +201,7 @@ const projectV1Routes: RouteRecordRaw[] = [
path: "create",
name: PROJECT_V1_ROUTE_DATABASE_GROUPS_CREATE,
meta: {
- requiredPermissionList: () => ["bb.projects.update"],
+ requiredPermissionList: () => ["bb.databaseGroups.create"],
},
component: () =>
import("@/views/project/ProjectDatabaseGroupCreate.vue"),
diff --git a/frontend/src/types/iam/permission.ts b/frontend/src/types/iam/permission.ts
index 265606f1d7..54de67589b 100644
--- a/frontend/src/types/iam/permission.ts
+++ b/frontend/src/types/iam/permission.ts
@@ -7,6 +7,11 @@ export type Permission =
| "bb.changelogs.list"
| "bb.databaseCatalogs.get"
| "bb.databaseCatalogs.update"
+ | "bb.databaseGroups.create"
+ | "bb.databaseGroups.delete"
+ | "bb.databaseGroups.get"
+ | "bb.databaseGroups.list"
+ | "bb.databaseGroups.update"
| "bb.databases.check"
| "bb.databases.get"
| "bb.databases.getSchema"
diff --git a/frontend/src/types/proto-es/v1/database_group_service_pb.d.ts b/frontend/src/types/proto-es/v1/database_group_service_pb.d.ts
index e39798e883..c17fe1fb4c 100644
--- a/frontend/src/types/proto-es/v1/database_group_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/database_group_service_pb.d.ts
@@ -310,7 +310,7 @@ export declare const DatabaseGroupViewSchema: GenEnum<DatabaseGroupView>;
export declare const DatabaseGroupService: GenService<{
/**
* Lists database groups in a project.
- * Permissions required: bb.projects.get
+ * Permissions required: bb.databaseGroups.list
*
* @generated from rpc bytebase.v1.DatabaseGroupService.ListDatabaseGroups
*/
@@ -321,7 +321,7 @@ export declare const DatabaseGroupService: GenService<{
},
/**
* Gets a database group by name.
- * Permissions required: bb.projects.get
+ * Permissions required: bb.databaseGroups.get
*
* @generated from rpc bytebase.v1.DatabaseGroupService.GetDatabaseGroup
*/
@@ -332,7 +332,7 @@ export declare const DatabaseGroupService: GenService<{
},
/**
* Creates a new database group.
- * Permissions required: bb.projects.update
+ * Permissions required: bb.databaseGroups.create
*
* @generated from rpc bytebase.v1.DatabaseGroupService.CreateDatabaseGroup
*/
@@ -343,8 +343,8 @@ export declare const DatabaseGroupService: GenService<{
},
/**
* Updates a database group.
- * Permissions required: bb.projects.update
- * When allow_missing=true, also requires: bb.projects.update
+ * Permissions required: bb.databaseGroups.update
+ * When allow_missing=true, also requires: bb.databaseGroups.create
*
* @generated from rpc bytebase.v1.DatabaseGroupService.UpdateDatabaseGroup
*/
@@ -355,7 +355,7 @@ export declare const DatabaseGroupService: GenService<{
},
/**
* Deletes a database group.
- * Permissions required: bb.projects.update
+ * Permissions required: bb.databaseGroups.delete
*
* @generated from rpc bytebase.v1.DatabaseGroupService.DeleteDatabaseGroup
*/
diff --git a/frontend/src/types/proto-es/v1/database_group_service_pb.js b/frontend/src/types/proto-es/v1/database_group_service_pb.js
index 1f3e9b43bd..2163fe2d68 100644
--- a/frontend/src/types/proto-es/v1/database_group_service_pb.js
+++ b/frontend/src/types/proto-es/v1/database_group_service_pb.js
@@ -16,7 +16,7 @@ import { file_v1_annotation } from "./annotation_pb";
* Describes the file v1/database_group_service.proto.
*/
export const file_v1_database_group_service = /*@__PURE__*/
- fileDesc("Ch92MS9kYXRhYmFzZV9ncm91cF9zZXJ2aWNlLnByb3RvEgtieXRlYmFzZS52MSJ3ChlMaXN0RGF0YWJhc2VHcm91cHNSZXF1ZXN0EiwKBnBhcmVudBgBIAEoCUIc4EEC+kEWChRieXRlYmFzZS5jb20vUHJvamVjdBIsCgR2aWV3GAIgASgOMh4uYnl0ZWJhc2UudjEuRGF0YWJhc2VHcm91cFZpZXciUQoaTGlzdERhdGFiYXNlR3JvdXBzUmVzcG9uc2USMwoPZGF0YWJhc2VfZ3JvdXBzGAEgAygLMhouYnl0ZWJhc2UudjEuRGF0YWJhc2VHcm91cCJ5ChdHZXREYXRhYmFzZUdyb3VwUmVxdWVzdBIwCgRuYW1lGAEgASgJQiLgQQL6QRwKGmJ5dGViYXNlLmNvbS9EYXRhYmFzZUdyb3VwEiwKBHZpZXcYAiABKA4yHi5ieXRlYmFzZS52MS5EYXRhYmFzZUdyb3VwVml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dyb3VwMjUvdjEve2RhdGFiYXNlX2dyb3VwLm5hbWU9cHJvamVjdHMvKi9kYXRhYmFzZUdyb3Vwcy8qfRKrAQoTRGVsZXRlRGF0YWJhc2VHcm91cBInLmJ5dGViYXNlLnYxLkRlbGV0ZURhdGFiYXNlR3JvdXBSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IlPaQQRuYW1liuowEmJiLnByb2plY3RzLnVwZGF0ZZDqMAGY6jABgtPkkwIoKiYvdjEve25hbWU9cHJvamVjdHMvKi9kYXRhYmFzZUdyb3Vwcy8qfUKvAQoPY29tLmJ5dGViYXNlLnYxQhlEYXRhYmFzZUdyb3VwU2VydmljZVByb3RvUAFaNGdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvYmFja2VuZC9nZW5lcmF0ZWQtZ28vdjGiAgNCWFiqAgtCeXRlYmFzZS5WMcoCC0J5dGViYXNlXFYx4gIXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [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_type_expr, file_v1_annotation]);
+ fileDesc("Ch92MS9kYXRhYmFzZV9ncm91cF9zZXJ2aWNlLnByb3RvEgtieXRlYmFzZS52MSJ3ChlMaXN0RGF0YWJhc2VHcm91cHNSZXF1ZXN0EiwKBnBhcmVudBgBIAEoCUIc4EEC+kEWChRieXRlYmFzZS5jb20vUHJvamVjdBIsCgR2aWV3GAIgASgOMh4uYnl0ZWJhc2UudjEuRGF0YWJhc2VHcm91cFZpZXciUQoaTGlzdERhdGFiYXNlR3JvdXBzUmVzcG9uc2USMwoPZGF0YWJhc2VfZ3JvdXBzGAEgAygLMhouYnl0ZWJhc2UudjEuRGF0YWJhc2VHcm91cCJ5ChdHZXREYXRhYmFzZUdyb3VwUmVxdWVzdBIwCgRuYW1lGAE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3VwIqoB2kEaZGF0YWJhc2VfZ3JvdXAsdXBkYXRlX21hc2uK6jAYYmIuZGF0YWJhc2VHcm91cHMudXBkYXRlkOowAZjqMAGi6jAYYmIuZGF0YWJhc2VHcm91cHMuY3JlYXRlgtPkkwJHOg5kYXRhYmFzZV9ncm91cDI1L3YxL3tkYXRhYmFzZV9ncm91cC5uYW1lPXByb2plY3RzLyovZGF0YWJhc2VHcm91cHMvKn0SsQEKE0RlbGV0ZURhdGFiYXNlR3JvdXASJy5ieXRlYmFzZS52MS5EZWxldGVEYXRhYmFzZUdyb3VwUmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSJZ2kEEbmFtZYrqMBhiYi5kYXRhYmFzZUdyb3Vwcy5kZWxldGWQ6jABmOowAYLT5JMCKComL3YxL3tuYW1lPXByb2plY3RzLyovZGF0YWJhc2VHcm91cHMvKn1CrwEKD2NvbS5ieXRlYmFzZS52MUIZRGF0YWJhc2VHcm91cFNlcnZpY2VQcm90b1ABWjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxogIDQlhYqgILQnl0ZWJhc2UuVjHKAgtCeXRlYmFzZVxWMeICF0J5dGViYXNlXFYxXEdQQk1ldGFkYXRh6gIMQnl0ZWJhc2U6OlYxYgZwcm90bzM", [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_type_expr, file_v1_annotation]);
/**
* Describes the message bytebase.v1.ListDatabaseGroupsRequest.
diff --git a/frontend/src/views/project/ProjectDatabaseGroupDashboard.vue b/frontend/src/views/project/ProjectDatabaseGroupDashboard.vue
index 37244312c8..7b3450c492 100644
--- a/frontend/src/views/project/ProjectDatabaseGroupDashboard.vue
+++ b/frontend/src/views/project/ProjectDatabaseGroupDashboard.vue
@@ -80,7 +80,7 @@ const state = reactive<LocalState>({
});
const allowCreate = computed(() =>
- hasProjectPermissionV2(project.value, "bb.projects.update")
+ hasProjectPermissionV2(project.value, "bb.databaseGroups.create")
);
const hasDBGroupFeature = computed(() =>
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 7845549a85..ac899b85db 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -3632,7 +3632,7 @@ paths:
- DatabaseGroupService
description: |-
Lists database groups in a project.
- Permissions required: bb.projects.get
+ Permissions required: bb.databaseGroups.list
operationId: DatabaseGroupService_ListDatabaseGroups
parameters:
- name: project
@@ -3669,7 +3669,7 @@ paths:
- DatabaseGroupService
description: |-
Creates a new database group.
- Permissions required: bb.projects.update
+ Permissions required: bb.databaseGroups.create
operationId: DatabaseGroupService_CreateDatabaseGroup
parameters:
- name: project
@@ -3718,7 +3718,7 @@ paths:
- DatabaseGroupService
description: |-
Gets a database group by name.
- Permissions required: bb.projects.get
+ Permissions required: bb.databaseGroups.get
operationId: DatabaseGroupService_GetDatabaseGroup
parameters:
- name: project
@@ -3761,7 +3761,7 @@ paths:
- DatabaseGroupService
description: |-
Deletes a database group.
- Permissions required: bb.projects.update
+ Permissions required: bb.databaseGroups.delete
operationId: DatabaseGroupService_DeleteDatabaseGroup
parameters:
- name: project
@@ -3791,8 +3791,8 @@ paths:
- DatabaseGroupService
description: |-
Updates a database group.
- Permissions required: bb.projects.update
- When allow_missing=true, also requires: bb.projects.update
+ Permissions required: bb.databaseGroups.update
+ When allow_missing=true, also requires: bb.databaseGroups.create
operationId: DatabaseGroupService_UpdateDatabaseGroup
parameters:
- name: project
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index abf7a020b1..601af332c0 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -6502,11 +6502,11 @@ DatabaseGroupService manages database groups for organizing databases by criteri
| Method Name | Request Type | Response Type | Description |
| ----------- | ------------ | ------------- | ------------|
-| ListDatabaseGroups | [ListDatabaseGroupsRequest](#bytebase-v1-ListDatabaseGroupsRequest) | [ListDatabaseGroupsResponse](#bytebase-v1-ListDatabaseGroupsResponse) | Lists database groups in a project. Permissions required: bb.projects.get |
-| GetDatabaseGroup | [GetDatabaseGroupRequest](#bytebase-v1-GetDatabaseGroupRequest) | [DatabaseGroup](#bytebase-v1-DatabaseGroup) | Gets a database group by name. Permissions required: bb.projects.get |
-| CreateDatabaseGroup | [CreateDatabaseGroupRequest](#bytebase-v1-CreateDatabaseGroupRequest) | [DatabaseGroup](#bytebase-v1-DatabaseGroup) | Creates a new database group. Permissions required: bb.projects.update |
-| UpdateDatabaseGroup | [UpdateDatabaseGroupRequest](#bytebase-v1-UpdateDatabaseGroupRequest) | [DatabaseGroup](#bytebase-v1-DatabaseGroup) | Updates a database group. Permissions required: bb.projects.update When allow_missing=true, also requires: bb.projects.update |
-| DeleteDatabaseGroup | [DeleteDatabaseGroupRequest](#bytebase-v1-DeleteDatabaseGroupRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | Deletes a database group. Permissions required: bb.projects.update |
+| ListDatabaseGroups | [ListDatabaseGroupsRequest](#bytebase-v1-ListDatabaseGroupsRequest) | [ListDatabaseGroupsResponse](#bytebase-v1-ListDatabaseGroupsResponse) | Lists database groups in a project. Permissions required: bb.databaseGroups.list |
+| GetDatabaseGroup | [GetDatabaseGroupRequest](#bytebase-v1-GetDatabaseGroupRequest) | [DatabaseGroup](#bytebase-v1-DatabaseGroup) | Gets a database group by name. Permissions required: bb.databaseGroups.get |
+| CreateDatabaseGroup | [CreateDatabaseGroupRequest](#bytebase-v1-CreateDatabaseGroupRequest) | [DatabaseGroup](#bytebase-v1-DatabaseGroup) | Creates a new database group. Permissions required: bb.databaseGroups.create |
+| UpdateDatabaseGroup | [UpdateDatabaseGroupRequest](#bytebase-v1-UpdateDatabaseGroupRequest) | [DatabaseGroup](#bytebase-v1-DatabaseGroup) | Updates a database group. Permissions required: bb.databaseGroups.update When allow_missing=true, also requires: bb.databaseGroups.create |
+| DeleteDatabaseGroup | [DeleteDatabaseGroupRequest](#bytebase-v1-DeleteDatabaseGroupRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | Deletes a database group. Permissions required: bb.databaseGroups.delete |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index 3d40dbc749..92c9a257f7 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -18550,7 +18550,7 @@ The API will default to the BASIC view.</p></td>
<td><a href="#bytebase.v1.ListDatabaseGroupsRequest">ListDatabaseGroupsRequest</a></td>
<td><a href="#bytebase.v1.ListDatabaseGroupsResponse">ListDatabaseGroupsResponse</a></td>
<td><p>Lists database groups in a project.
-Permissions required: bb.projects.get</p></td>
+Permissions required: bb.databaseGroups.list</p></td>
</tr>
<tr>
@@ -18558,7 +18558,7 @@ Permissions required: bb.projects.get</p></td>
<td><a href="#bytebase.v1.GetDatabaseGroupRequest">GetDatabaseGroupRequest</a></td>
<td><a href="#bytebase.v1.DatabaseGroup">DatabaseGroup</a></td>
<td><p>Gets a database group by name.
-Permissions required: bb.projects.get</p></td>
+Permissions required: bb.databaseGroups.get</p></td>
</tr>
<tr>
@@ -18566,7 +18566,7 @@ Permissions required: bb.projects.get</p></td>
<td><a href="#bytebase.v1.CreateDatabaseGroupRequest">CreateDatabaseGroupRequest</a></td>
<td><a href="#bytebase.v1.DatabaseGroup">DatabaseGroup</a></td>
<td><p>Creates a new database group.
-Permissions required: bb.projects.update</p></td>
+Permissions required: bb.databaseGroups.create</p></td>
</tr>
<tr>
@@ -18574,8 +18574,8 @@ Permissions required: bb.projects.update</p></td>
<td><a href="#bytebase.v1.UpdateDatabaseGroupRequest">UpdateDatabaseGroupRequest</a></td>
<td><a href="#bytebase.v1.DatabaseGroup">DatabaseGroup</a></td>
<td><p>Updates a database group.
-Permissions required: bb.projects.update
-When allow_missing=true, also requires: bb.projects.update</p></td>
+Permissions required: bb.databaseGroups.update
+When allow_missing=true, also requires: bb.databaseGroups.create</p></td>
</tr>
<tr>
@@ -18583,7 +18583,7 @@ When allow_missing=true, also requires: bb.projects.update</p></td>
<td><a href="#bytebase.v1.DeleteDatabaseGroupRequest">DeleteDatabaseGroupRequest</a></td>
<td><a href="#google.protobuf.Empty">.google.protobuf.Empty</a></td>
<td><p>Deletes a database group.
-Permissions required: bb.projects.update</p></td>
+Permissions required: bb.databaseGroups.delete</p></td>
</tr>
</tbody>
diff --git a/proto/v1/v1/database_group_service.proto b/proto/v1/v1/database_group_service.proto
index 266ac5afb5..83cd23e0f0 100644
--- a/proto/v1/v1/database_group_service.proto
+++ b/proto/v1/v1/database_group_service.proto
@@ -17,57 +17,57 @@ option go_package = "github.com/bytebase/bytebase/backend/generated-go/v1";
// DatabaseGroupService manages database groups for organizing databases by criteria.
service DatabaseGroupService {
// Lists database groups in a project.
- // Permissions required: bb.projects.get
+ // Permissions required: bb.databaseGroups.list
rpc ListDatabaseGroups(ListDatabaseGroupsRequest) returns (ListDatabaseGroupsResponse) {
option (google.api.http) = {get: "/v1/{parent=projects/*}/databaseGroups"};
option (google.api.method_signature) = "parent";
- option (bytebase.v1.permission) = "bb.projects.get";
+ option (bytebase.v1.permission) = "bb.databaseGroups.list";
option (bytebase.v1.auth_method) = IAM;
}
// Gets a database group by name.
- // Permissions required: bb.projects.get
+ // Permissions required: bb.databaseGroups.get
rpc GetDatabaseGroup(GetDatabaseGroupRequest) returns (DatabaseGroup) {
option (google.api.http) = {get: "/v1/{name=projects/*/databaseGroups/*}"};
option (google.api.method_signature) = "name";
- option (bytebase.v1.permission) = "bb.projects.get";
+ option (bytebase.v1.permission) = "bb.databaseGroups.get";
option (bytebase.v1.auth_method) = IAM;
}
// Creates a new database group.
- // Permissions required: bb.projects.update
+ // Permissions required: bb.databaseGroups.create
rpc CreateDatabaseGroup(CreateDatabaseGroupRequest) returns (DatabaseGroup) {
option (google.api.http) = {
post: "/v1/{parent=projects/*}/databaseGroups"
body: "database_group"
};
option (google.api.method_signature) = "parent,databaseGroup";
- option (bytebase.v1.permission) = "bb.projects.update";
- option (bytebase.v1.auth_method) = CUSTOM;
+ option (bytebase.v1.permission) = "bb.databaseGroups.create";
+ option (bytebase.v1.auth_method) = IAM;
option (bytebase.v1.audit) = true;
}
// Updates a database group.
- // Permissions required: bb.projects.update
- // When allow_missing=true, also requires: bb.projects.update
+ // Permissions required: bb.databaseGroups.update
+ // When allow_missing=true, also requires: bb.databaseGroups.create
rpc UpdateDatabaseGroup(UpdateDatabaseGroupRequest) returns (DatabaseGroup) {
option (google.api.http) = {
patch: "/v1/{database_group.name=projects/*/databaseGroups/*}"
body: "database_group"
};
option (google.api.method_signature) = "database_group,update_mask";
- option (bytebase.v1.permission) = "bb.projects.update";
- option (bytebase.v1.allow_missing_requires) = "bb.projects.update";
+ option (bytebase.v1.permission) = "bb.databaseGroups.update";
+ option (bytebase.v1.allow_missing_requires) = "bb.databaseGroups.create";
option (bytebase.v1.auth_method) = IAM;
option (bytebase.v1.audit) = true;
}
// Deletes a database group.
- // Permissions required: bb.projects.update
+ // Permissions required: bb.databaseGroups.delete
rpc DeleteDatabaseGroup(DeleteDatabaseGroupRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {delete: "/v1/{name=projects/*/databaseGroups/*}"};
option (google.api.method_signature) = "name";
- option (bytebase.v1.permission) = "bb.projects.update";
+ option (bytebase.v1.permission) = "bb.databaseGroups.delete";
option (bytebase.v1.auth_method) = IAM;
option (bytebase.v1.audit) = true;
}