Skip to content

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

Add option to allow including all roles in the PrincipalSelect

天舟b4fe79b0db62
diff --git a/frontend/src/components/PrincipalSelect.vue b/frontend/src/components/PrincipalSelect.vue
index ff5db164e9..22b3242be9 100644
--- a/frontend/src/components/PrincipalSelect.vue
+++ b/frontend/src/components/PrincipalSelect.vue
@@ -20,9 +20,9 @@
</template>
<script lang="ts">
-import { watchEffect, reactive, computed } from "vue";
+import { watchEffect, reactive, computed, PropType } from "vue";
import { useStore } from "vuex";
-import { RoleMapping, Principal } from "../types";
+import { RoleMapping, Principal, RoleType } from "../types";
import { feature } from "../utils";
interface LocalState {
@@ -40,6 +40,10 @@ export default {
default: false,
type: Boolean,
},
+ allowAllRoles: {
+ default: true,
+ type: Boolean,
+ },
},
setup(props, { emit }) {
const state = reactive<LocalState>({
@@ -48,12 +52,17 @@ export default {
const store = useStore();
const principalList = computed(() => {
- let list: RoleMapping[] = store.getters["roleMapping/roleMappingList"]();
- if (feature("bytebase.admin")) {
- list = list.filter((item) => {
- return item.role == "DBA" || item.role == "OWNER";
- });
- }
+ const list: RoleMapping[] = store.getters[
+ "roleMapping/roleMappingList"
+ ]().filter((item: RoleMapping) => {
+ return (
+ props.allowAllRoles ||
+ !feature("bytebase.admin") ||
+ item.role == "DBA" ||
+ item.role == "OWNER"
+ );
+ });
+
return list.map((roleMapping: RoleMapping) => {
return store.getters["principal/principalById"](
roleMapping.principalId
diff --git a/frontend/src/views/TaskSidebar.vue b/frontend/src/views/TaskSidebar.vue
index 71e50d07d8..2d20f10bd1 100644
--- a/frontend/src/views/TaskSidebar.vue
+++ b/frontend/src/views/TaskSidebar.vue
@@ -20,6 +20,7 @@
<div class="w-full">
<PrincipalSelect
:selectedId="task.assignee?.id"
+ :allowAllRoles="false"
@select-principal="
(principal) => {
$emit('update-assignee-id', principal.id);