Skip to content

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

refactor: fetch workspace iam policy (#13399)

ecmadaob35501a2fac0
diff --git a/frontend/src/App.vue b/frontend/src/App.vue
index afa76da375..32f3c7a081 100644
--- a/frontend/src/App.vue
+++ b/frontend/src/App.vue
@@ -42,7 +42,7 @@ import {
} from "naive-ui";
import { ServerError } from "nice-grpc-common";
import { ClientError, Status } from "nice-grpc-web";
-import { onErrorCaptured, onMounted } from "vue";
+import { onErrorCaptured, onMounted, watchEffect } from "vue";
import { watch } from "vue";
import { useRoute, useRouter } from "vue-router";
import Watermark from "@/components/misc/Watermark.vue";
@@ -58,6 +58,7 @@ import {
useAuthStore,
useNotificationStore,
useSubscriptionV1Store,
+ useWorkspaceV1Store,
} from "./store";
import { isDev } from "./utils";
@@ -70,6 +71,7 @@ const { key } = provideAppRootContext();
const authStore = useAuthStore();
const notificationStore = useNotificationStore();
const actuatorStore = useActuatorV1Store();
+const workspaceStore = useWorkspaceV1Store();
onMounted(async () => {
const initActuator = async () => {
@@ -98,6 +100,12 @@ onMounted(async () => {
actuatorStore.initialized = true;
});
+watchEffect(async () => {
+ if (authStore.currentUserId) {
+ await workspaceStore.fetchIamPolicy();
+ }
+});
+
onErrorCaptured((error: any /* , _, info */) => {
// Handle grpc request error.
// It looks like: `{"path":"/bytebase.v1.AuthService/Login","code":2,"details":"Response closed without headers"}`
diff --git a/frontend/src/components/Member/utils.ts b/frontend/src/components/Member/utils.ts
index bdf738224e..703cb0b640 100644
--- a/frontend/src/components/Member/utils.ts
+++ b/frontend/src/components/Member/utils.ts
@@ -23,7 +23,7 @@ const getMemberBinding = (
if (!group) {
return undefined;
}
- if (searchText && group.title.includes(searchText)) {
+ if (searchText && !group.title.toLowerCase().includes(searchText)) {
return undefined;
}
const email = extractGroupEmail(group.name);
@@ -42,7 +42,7 @@ const getMemberBinding = (
if (!user) {
return undefined;
}
- if (searchText && user.title.includes(searchText)) {
+ if (searchText && !user.title.toLowerCase().includes(searchText)) {
return undefined;
}
diff --git a/frontend/src/store/modules/auth.ts b/frontend/src/store/modules/auth.ts
index 4349f3fdbc..d6c6628b8e 100644
--- a/frontend/src/store/modules/auth.ts
+++ b/frontend/src/store/modules/auth.ts
@@ -11,11 +11,10 @@ import type {
} from "@/types/proto/v1/auth_service";
import { UserType } from "@/types/proto/v1/auth_service";
import { getIntCookie } from "@/utils";
-import { useUserStore, useWorkspaceV1Store } from ".";
+import { useUserStore } from ".";
export const useAuthStore = defineStore("auth_v1", () => {
const userStore = useUserStore();
- const workspaceStore = useWorkspaceV1Store();
const currentUserId = ref<number | undefined>();
const currentUser = computed(() => {
@@ -58,8 +57,6 @@ export const useAuthStore = defineStore("auth_v1", () => {
password: request.password,
web: true,
});
- // TODO(ed): fetch iam.
- await workspaceStore.fetchIamPolicy();
};
const logout = async () => {
@@ -79,7 +76,6 @@ export const useAuthStore = defineStore("auth_v1", () => {
String(currentUserId.value),
true // silent
);
- await workspaceStore.fetchIamPolicy();
}
};