Skip to content

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

Allow assignee and creator to change custom fields.

天舟d99bb0911e83
diff --git a/frontend/src/views/TaskSidebar.vue b/frontend/src/views/TaskSidebar.vue
index 853618c634..8514ac199a 100644
--- a/frontend/src/views/TaskSidebar.vue
+++ b/frontend/src/views/TaskSidebar.vue
@@ -39,6 +39,7 @@
</h2>
<BBTextField
class="w-full mt-4 text-sm"
+ :disabled="!allowEditCustomFields"
:required="true"
:value="fieldValue(field)"
:placeholder="field.placeholder"
@@ -52,6 +53,7 @@
</h2>
<div class="w-full">
<EnvironmentSelect
+ :disabled="!allowEditCustomFields"
:name="field.id"
:selectedId="fieldValue(field)"
:selectDefault="false"
@@ -70,7 +72,7 @@
</h2>
<div class="w-full">
<DatabaseSelect
- :disabled="!environmentId()"
+ :disabled="!environmentId() || !allowEditCustomFields"
:selectedId="fieldValue(field)"
:environmentId="environmentId()"
@select-database-id="
@@ -89,6 +91,7 @@
<div class="flex flex-col w-full">
<div class="flex flex-row space-x-2">
<BBCheckbox
+ :disabled="!allowEditCustomFields"
:label="'New'"
:value="fieldValue(field).isNew"
class="items-center"
@@ -102,6 +105,7 @@
v-if="fieldValue(field).isNew"
type="text"
class="w-full text-sm"
+ :disabled="!allowEditCustomFields"
:required="true"
:value="fieldValue(field).name"
:placeholder="field.placeholder"
@@ -109,7 +113,7 @@
/>
<DatabaseSelect
v-else
- :disabled="!environmentId()"
+ :disabled="!environmentId() || !allowEditCustomFields"
:selectedId="fieldValue(field).id"
:environmentId="environmentId()"
@select-database-id="
@@ -123,6 +127,7 @@
v-if="!fieldValue(field).isNew"
class="mt-4 flex"
style="margin-left: 3.75rem"
+ :disabled="!allowEditCustomFields"
:label="'Read only'"
:value="fieldValue(field).readOnly"
@toggle="
@@ -140,6 +145,7 @@
</h2>
<div class="flex justify-start">
<BBSwitch
+ :disabled="!allowEditCustomFields"
:value="fieldValue(field)"
@toggle="
(on) => {
@@ -186,7 +192,8 @@
</template>
<script lang="ts">
-import { PropType, reactive } from "vue";
+import { computed, PropType, reactive } from "vue";
+import { useStore } from "vuex";
import cloneDeep from "lodash-es/cloneDeep";
import isEqual from "lodash-es/isEqual";
import DatabaseSelect from "../components/DatabaseSelect.vue";
@@ -199,7 +206,6 @@ import {
DatabaseFieldPayload,
} from "../plugins";
import { DatabaseId, EnvironmentId, Task } from "../types";
-import { activeStageIsRunning } from "../utils";
interface LocalState {}
@@ -235,6 +241,7 @@ export default {
const state = reactive<LocalState>({});
const currentUser = computed(() => store.getters["auth/currentUser"]());
+
const fieldValue = (field: TaskField): string | DatabaseFieldPayload => {
// Do a deep clone to prevent caller accidentally changes the original data.
return cloneDeep(props.task.payload[field.id]);
@@ -256,6 +263,20 @@ export default {
currentUser.value.role == "OWNER"
);
});
+
+ const allowEditCustomFields = computed(() => {
+ // For now, we allow creator and assignee to update the field any time.
+ // This may cause potential issue that the creator might change some of the
+ // fields after the assignee starts the work.
+ // In the future, we could provide options to enforce more strict rules
+ // e.g. disallow changing a particular field at a particular stage by a particular role.
+ return (
+ props.new ||
+ currentUser.value.id == props.task.assignee?.id ||
+ currentUser.value.id == props.task.creator.id
+ );
+ });
+
const trySaveCustomField = (
field: TaskField,
value: string | EnvironmentId | DatabaseFieldPayload
@@ -299,8 +320,8 @@ export default {
return {
state,
- activeStageIsRunning,
allowEditAssignee,
+ allowEditCustomFields,
fieldValue,
environmentId,
trySaveCustomField,