Skip to content

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

fix: check update binding (#16445)

ecmadao0f7bae7b0e48
diff --git a/frontend/src/components/ProjectMember/ProjectMemberRolePanel/EditProjectRolePanel.vue b/frontend/src/components/ProjectMember/ProjectMemberRolePanel/EditProjectRolePanel.vue
index 56240bc9c6..a09d44e3e1 100644
--- a/frontend/src/components/ProjectMember/ProjectMemberRolePanel/EditProjectRolePanel.vue
+++ b/frontend/src/components/ProjectMember/ProjectMemberRolePanel/EditProjectRolePanel.vue
@@ -122,7 +122,7 @@
<script lang="ts" setup>
import dayjs from "dayjs";
-import { cloneDeep, isEqual, isUndefined } from "lodash-es";
+import { cloneDeep, isEqual } from "lodash-es";
import { NButton, NDatePicker, NInput } from "naive-ui";
import { computed, reactive, onMounted } from "vue";
import { useI18n } from "vue-i18n";
@@ -217,15 +217,23 @@ const allowRemoveRole = () => {
return true;
};
+const bindingCondition = computed(() =>
+ buildConditionExpr({
+ title: state.title,
+ role: props.binding.role,
+ description: state.description,
+ expirationTimestampInMS: state.expirationTimestamp,
+ rowLimit: state.maxRowCount,
+ databaseResources: state.databaseResources,
+ })
+);
+
const allowConfirm = computed(() => {
- if (
- !isUndefined(state.databaseResources) &&
- state.databaseResources.length === 0
- ) {
- return false;
- }
// only allow update current single user.
- return props.binding.members.length === 1;
+ return (
+ props.binding.members.length === 1 &&
+ !isEqual(bindingCondition.value, props.binding.condition)
+ );
});
onMounted(() => {
@@ -267,14 +275,7 @@ const handleUpdateRole = async () => {
const newBinding = cloneDeep(props.binding);
newBinding.members = [member];
- newBinding.condition = buildConditionExpr({
- title: state.title,
- role: props.binding.role,
- description: state.description,
- expirationTimestampInMS: state.expirationTimestamp,
- rowLimit: state.maxRowCount,
- databaseResources: state.databaseResources,
- });
+ newBinding.condition = bindingCondition.value;
const policy = cloneDeep(iamPolicy.value);
const oldBindingIndex = policy.bindings.findIndex(