Skip to content

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

fix: project owner should have policy permission for project resource (#15635)

ecmadao4f8642e64006
diff --git a/backend/component/iam/acl.yaml b/backend/component/iam/acl.yaml
index c05ee47414..275a122896 100644
--- a/backend/component/iam/acl.yaml
+++ b/backend/component/iam/acl.yaml
@@ -307,6 +307,11 @@ roles:
- bb.plans.list
- bb.plans.preview
- bb.plans.update
+ - bb.policies.create
+ - bb.policies.delete
+ - bb.policies.get
+ - bb.policies.list
+ - bb.policies.update
- bb.projects.get
- bb.projects.getIamPolicy
- bb.projects.setIamPolicy
diff --git a/frontend/src/components/Member/MemberDataTable/cells/UserOperationsCell.vue b/frontend/src/components/Member/MemberDataTable/cells/UserOperationsCell.vue
index 6520fce66e..1c8b5b8f41 100644
--- a/frontend/src/components/Member/MemberDataTable/cells/UserOperationsCell.vue
+++ b/frontend/src/components/Member/MemberDataTable/cells/UserOperationsCell.vue
@@ -1,6 +1,9 @@
<template>
<div v-if="allowEdit" class="flex justify-end">
- <NPopconfirm v-if="allowUpdate" @positive-click="$emit('revoke-binding')">
+ <NPopconfirm
+ v-if="allowUpdate && binding.projectRoleBindings.length > 0"
+ @positive-click="$emit('revoke-binding')"
+ >
<template #trigger>
<NButton quaternary circle @click.stop>
<template #icon>
diff --git a/frontend/src/components/Project/ProjectSwitch/ProjectSwitchContent.vue b/frontend/src/components/Project/ProjectSwitch/ProjectSwitchContent.vue
index c4eb813e04..bb165b1db3 100644
--- a/frontend/src/components/Project/ProjectSwitch/ProjectSwitchContent.vue
+++ b/frontend/src/components/Project/ProjectSwitch/ProjectSwitchContent.vue
@@ -100,7 +100,7 @@ const state = reactive<LocalState>({
showPopover: false,
searchText: "",
selectedTab: "all",
- loading: false,
+ loading: true,
allProjects: [],
});
const projectStore = useProjectV1Store();
diff --git a/frontend/src/components/SensitiveData/MaskingExceptionUserTable.vue b/frontend/src/components/SensitiveData/MaskingExceptionUserTable.vue
index a54d1ec983..f639066b54 100644
--- a/frontend/src/components/SensitiveData/MaskingExceptionUserTable.vue
+++ b/frontend/src/components/SensitiveData/MaskingExceptionUserTable.vue
@@ -46,12 +46,13 @@ import {
getGroupEmailInBinding,
groupBindingPrefix,
isValidDatabaseName,
+ type ComposedProject,
} from "@/types";
import { Expr } from "@/types/proto/google/type/expr";
import { MaskingExceptionPolicy_MaskingException_Action } from "@/types/proto/v1/org_policy_service";
import type { MaskingExceptionPolicy_MaskingException } from "@/types/proto/v1/org_policy_service";
import { PolicyType } from "@/types/proto/v1/org_policy_service";
-import { autoDatabaseRoute, hasWorkspacePermissionV2 } from "@/utils";
+import { autoDatabaseRoute, hasProjectPermissionV2 } from "@/utils";
import {
type ConditionExpression,
batchConvertFromCELString,
@@ -68,8 +69,7 @@ interface LocalState {
const props = defineProps<{
size: "small" | "medium";
disabled: boolean;
- // project full name
- project: string;
+ project: ComposedProject;
showDatabaseColumn: boolean;
filterAccessUser: (accessUser: AccessUser) => boolean;
}>();
@@ -88,12 +88,12 @@ const policyStore = usePolicyV1Store();
const $dialog = useDialog();
const hasPermission = computed(() => {
- return hasWorkspacePermissionV2("bb.policies.update");
+ return hasProjectPermissionV2(props.project, "bb.policies.update");
});
const { policy, ready } = usePolicyByParentAndType(
computed(() => ({
- parentPath: props.project,
+ parentPath: props.project.name,
policyType: PolicyType.MASKING_EXCEPTION,
}))
);
@@ -532,7 +532,7 @@ const onSubmit = async () => {
const updateExceptionPolicy = async () => {
const policy = await policyStore.getOrFetchPolicyByParentAndType({
- parentPath: props.project,
+ parentPath: props.project.name,
policyType: PolicyType.MASKING_EXCEPTION,
});
if (!policy) {
@@ -579,7 +579,7 @@ const updateExceptionPolicy = async () => {
maskingExceptions: exceptions,
};
await policyStore.upsertPolicy({
- parentPath: props.project,
+ parentPath: props.project.name,
policy,
});
};
diff --git a/frontend/src/views/project/ProjectMaskingExemption.vue b/frontend/src/views/project/ProjectMaskingExemption.vue
index 7663bfa6fd..81a20c0d39 100644
--- a/frontend/src/views/project/ProjectMaskingExemption.vue
+++ b/frontend/src/views/project/ProjectMaskingExemption.vue
@@ -55,7 +55,7 @@
<MaskingExceptionUserTable
size="medium"
:disabled="false"
- :project="project.name"
+ :project="project"
:show-database-column="true"
:filter-access-user="filterAccessUser"
/>