Skip to content

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

chore: hide allUsers in member list (#10166)

boojacka831c74c9f7b
diff --git a/frontend/src/components/ProjectMember/ProjectMemberTable/ProjectMemberTable.vue b/frontend/src/components/ProjectMember/ProjectMemberTable/ProjectMemberTable.vue
index 7238388896..6720e033d0 100644
--- a/frontend/src/components/ProjectMember/ProjectMemberTable/ProjectMemberTable.vue
+++ b/frontend/src/components/ProjectMember/ProjectMemberTable/ProjectMemberTable.vue
@@ -34,7 +34,7 @@
<UserAvatar class="mt-1" :user="projectMember.user" />
<div class="flex flex-col">
<div class="flex flex-row items-center space-x-2">
- <template v-if="projectMember.user.email !== ALL_USERS_USER_NAME">
+ <template v-if="projectMember.user.email !== ALL_USERS_USER_EMAIL">
<router-link
:to="`/users/${projectMember.user.email}`"
class="normal-link"
@@ -49,7 +49,7 @@
</template>
</div>
<span
- v-if="projectMember.user.email !== ALL_USERS_USER_NAME"
+ v-if="projectMember.user.email !== ALL_USERS_USER_EMAIL"
class="textinfolabel"
>{{ projectMember.user.email }}</span
>
@@ -147,7 +147,7 @@ import UserAvatar from "@/components/User/UserAvatar.vue";
import YouTag from "@/components/misc/YouTag.vue";
import { featureToRef, useCurrentUserV1, useProjectIamPolicy } from "@/store";
import {
- ALL_USERS_USER_NAME,
+ ALL_USERS_USER_EMAIL,
ComposedProject,
PresetRoleTypeList,
} from "@/types";
diff --git a/frontend/src/components/v2/Model/DatabaseV1Name.vue b/frontend/src/components/v2/Model/DatabaseV1Name.vue
index f22d12408a..d16e6c3517 100644
--- a/frontend/src/components/v2/Model/DatabaseV1Name.vue
+++ b/frontend/src/components/v2/Model/DatabaseV1Name.vue
@@ -1,6 +1,6 @@
<template>
<component
- :is="link ? 'router-link' : tag"
+ :is="link ? 'router-link' : NEllipsis"
v-bind="bindings"
class="inline-flex items-center gap-x-1"
:class="[link && !plain && 'normal-link', link && 'hover:underline']"
@@ -11,6 +11,7 @@
</template>
<script lang="ts" setup>
+import { NEllipsis } from "naive-ui";
import { computed } from "vue";
import type { ComposedDatabase } from "@/types";
import { Engine } from "@/types/proto/v1/common";
@@ -19,12 +20,10 @@ import { databaseV1Slug } from "@/utils";
const props = withDefaults(
defineProps<{
database: ComposedDatabase;
- tag?: string;
link?: boolean;
plain?: boolean;
}>(),
{
- tag: "span",
link: true,
plain: false,
}
diff --git a/frontend/src/store/modules/user.ts b/frontend/src/store/modules/user.ts
index bd111b330b..c8679e1183 100644
--- a/frontend/src/store/modules/user.ts
+++ b/frontend/src/store/modules/user.ts
@@ -3,7 +3,7 @@ import { defineStore } from "pinia";
import { authServiceClient } from "@/grpcweb";
import {
ALL_USERS_USER_ID,
- ALL_USERS_USER_NAME,
+ ALL_USERS_USER_EMAIL,
Principal,
PrincipalType,
RoleType,
@@ -115,7 +115,7 @@ export const useUserStore = defineStore("user", {
return this.getUserByEmail(getUserEmailFromIdentifier(identifier));
},
getUserByEmail(email: string) {
- if (email === ALL_USERS_USER_NAME) {
+ if (email === ALL_USERS_USER_EMAIL) {
return allUsersUser();
}
return [...this.userMapByName.values()].find(
diff --git a/frontend/src/store/modules/v1/projectIamPolicy.ts b/frontend/src/store/modules/v1/projectIamPolicy.ts
index 52f4f82345..3fb609aa87 100644
--- a/frontend/src/store/modules/v1/projectIamPolicy.ts
+++ b/frontend/src/store/modules/v1/projectIamPolicy.ts
@@ -5,7 +5,7 @@ import { projectServiceClient } from "@/grpcweb";
import { resolveCELExpr } from "@/plugins/cel";
import { hasFeature, usePolicyV1Store } from "@/store";
import {
- ALL_USERS_USER_NAME,
+ ALL_USERS_USER_EMAIL,
ComposedDatabase,
MaybeRef,
PresetRoleType,
@@ -252,7 +252,7 @@ export const useCurrentUserIamPolicy = () => {
binding.role === PresetRoleType.PROJECT_OWNER &&
binding.members.find(
(member) =>
- member === ALL_USERS_USER_NAME ||
+ member === ALL_USERS_USER_EMAIL ||
member === `user:${currentUser.value.email}`
)
) {
@@ -262,7 +262,7 @@ export const useCurrentUserIamPolicy = () => {
binding.role === PresetRoleType.PROJECT_QUERIER &&
binding.members.find(
(member) =>
- member === ALL_USERS_USER_NAME ||
+ member === ALL_USERS_USER_EMAIL ||
member === `user:${currentUser.value.email}`
)
) {
@@ -316,7 +316,7 @@ export const useCurrentUserIamPolicy = () => {
binding.role === PresetRoleType.PROJECT_OWNER &&
binding.members.find(
(member) =>
- member === ALL_USERS_USER_NAME ||
+ member === ALL_USERS_USER_EMAIL ||
member === `user:${currentUser.value.email}`
)
) {
@@ -326,7 +326,7 @@ export const useCurrentUserIamPolicy = () => {
binding.role === PresetRoleType.PROJECT_EXPORTER &&
binding.members.find(
(member) =>
- member === ALL_USERS_USER_NAME ||
+ member === ALL_USERS_USER_EMAIL ||
member === `user:${currentUser.value.email}`
)
) {
diff --git a/frontend/src/types/v1/user.ts b/frontend/src/types/v1/user.ts
index 1fd8fb3c91..b7d4fef3a9 100644
--- a/frontend/src/types/v1/user.ts
+++ b/frontend/src/types/v1/user.ts
@@ -26,14 +26,14 @@ export const unknownUser = () => {
};
export const ALL_USERS_USER_ID = "2";
-export const ALL_USERS_USER_NAME = "allUsers";
+export const ALL_USERS_USER_EMAIL = "allUsers";
// Pseudo allUsers account.
export const allUsersUser = () => {
return {
...emptyUser(),
name: `users/${ALL_USERS_USER_ID}`,
title: "All users",
- email: ALL_USERS_USER_NAME,
+ email: ALL_USERS_USER_EMAIL,
};
};
@@ -49,8 +49,8 @@ export const filterUserListByKeyword = (userList: User[], keyword: string) => {
};
export const getUserEmailInBinding = (email: string) => {
- if (email === ALL_USERS_USER_NAME) {
- return ALL_USERS_USER_NAME;
+ if (email === ALL_USERS_USER_EMAIL) {
+ return ALL_USERS_USER_EMAIL;
}
return `user:${email}`;
};
diff --git a/frontend/src/utils/v1/project.ts b/frontend/src/utils/v1/project.ts
index e41801da7f..0832c4a19e 100644
--- a/frontend/src/utils/v1/project.ts
+++ b/frontend/src/utils/v1/project.ts
@@ -2,7 +2,7 @@ import { orderBy, uniq } from "lodash-es";
import slug from "slug";
import { extractUserEmail, useUserStore } from "@/store";
import {
- ALL_USERS_USER_NAME,
+ ALL_USERS_USER_EMAIL,
DEFAULT_PROJECT_V1_NAME,
PresetRoleType,
UNKNOWN_ID,
@@ -48,7 +48,7 @@ export const roleListInProjectV1 = (iamPolicy: IamPolicy, user: User) => {
.filter((binding) => {
return (
binding.members.includes(`user:${user.email}`) ||
- binding.members.includes(ALL_USERS_USER_NAME)
+ binding.members.includes(ALL_USERS_USER_EMAIL)
);
})
.map((binding) => binding.role);
diff --git a/frontend/src/views/SettingWorkspaceAccessControl.vue b/frontend/src/views/SettingWorkspaceAccessControl.vue
index ea1012b86f..8a90c99612 100644
--- a/frontend/src/views/SettingWorkspaceAccessControl.vue
+++ b/frontend/src/views/SettingWorkspaceAccessControl.vue
@@ -101,7 +101,7 @@ import {
useEnvironmentV1List,
} from "@/store";
import { usePolicyV1Store } from "@/store/modules/v1/policy";
-import { ALL_USERS_USER_NAME } from "@/types";
+import { ALL_USERS_USER_EMAIL } from "@/types";
import { Environment } from "@/types/proto/v1/environment_service";
import { Binding, IamPolicy } from "@/types/proto/v1/iam_policy";
import {
@@ -179,7 +179,7 @@ onMounted(async () => {
}
for (const binding of policy.workspaceIamPolicy.bindings) {
- if (!binding.members.includes(ALL_USERS_USER_NAME)) {
+ if (!binding.members.includes(ALL_USERS_USER_EMAIL)) {
continue;
}
@@ -249,7 +249,7 @@ const buildWorkspaceIAMPolicy = (envPolicyList: EnvironmentPolicy[]) => {
workspaceIamPolicy.bindings.push(
Binding.fromPartial({
role: "PresetRoleType.PROJECT_QUERIER",
- members: [ALL_USERS_USER_NAME],
+ members: [ALL_USERS_USER_EMAIL],
condition: {
expression: `resource.environment_name in ["${allowQueryEnvNameList.join(
'", "'
@@ -262,7 +262,7 @@ const buildWorkspaceIAMPolicy = (envPolicyList: EnvironmentPolicy[]) => {
workspaceIamPolicy.bindings.push(
Binding.fromPartial({
role: "PresetRoleType.PROJECT_EXPORTER",
- members: [ALL_USERS_USER_NAME],
+ members: [ALL_USERS_USER_EMAIL],
condition: {
expression: `resource.environment_name in ["${allowExportEnvNameList.join(
'", "'
diff --git a/frontend/src/views/SettingWorkspaceMember.vue b/frontend/src/views/SettingWorkspaceMember.vue
index c3514f101a..d2a2e13dd7 100644
--- a/frontend/src/views/SettingWorkspaceMember.vue
+++ b/frontend/src/views/SettingWorkspaceMember.vue
@@ -86,7 +86,11 @@ import {
} from "@/store";
import { UserType } from "@/types/proto/v1/auth_service";
import { State } from "@/types/proto/v1/common";
-import { SYSTEM_BOT_USER_NAME, filterUserListByKeyword } from "../types";
+import {
+ ALL_USERS_USER_EMAIL,
+ SYSTEM_BOT_USER_NAME,
+ filterUserListByKeyword,
+} from "../types";
import { hasWorkspacePermissionV1 } from "../utils";
type LocalState = {
@@ -119,8 +123,14 @@ onMounted(() => {
}
});
+const userList = computed(() => {
+ return userStore.userList.filter(
+ (user) => user.email !== ALL_USERS_USER_EMAIL
+ );
+});
+
const activeUserList = computed(() => {
- const list = userStore.userList.filter((user) => user.state === State.ACTIVE);
+ const list = userList.value.filter((user) => user.state === State.ACTIVE);
// Try to shift SYSTEM_BOT to the top of the list.
const systemBotUserIndex = list.findIndex(
@@ -136,7 +146,7 @@ const activeUserList = computed(() => {
});
const inactiveUserList = computed(() => {
- const list = userStore.userList.filter(
+ const list = userList.value.filter(
(user) =>
user.state === State.DELETED && user.userType !== UserType.SYSTEM_BOT
);
diff --git a/frontend/src/views/sql-editor/SecondarySidebar/SheetTabPane/SheetList/SheetList.vue b/frontend/src/views/sql-editor/SecondarySidebar/SheetTabPane/SheetList/SheetList.vue
index 5f3fe35167..be8bde4f30 100644
--- a/frontend/src/views/sql-editor/SecondarySidebar/SheetTabPane/SheetList/SheetList.vue
+++ b/frontend/src/views/sql-editor/SecondarySidebar/SheetTabPane/SheetList/SheetList.vue
@@ -325,7 +325,9 @@ const renderLabel = ({ option }: { option: TreeOption }) => {
};
const selectedKeys = computed(() => {
- return [currentSheet.value?.name, tabStore.currentTab.id];
+ return [currentSheet.value?.name, tabStore.currentTab.id].filter(
+ (item) => !!item
+ ) as string[];
});
const nodeProps = ({ option }: { option: TreeOption }) => {