diff --git a/src/component/Task/helper.tsx b/src/component/Task/helper.tsx index a2161b6e6..37f0b5952 100644 --- a/src/component/Task/helper.tsx +++ b/src/component/Task/helper.tsx @@ -27,14 +27,18 @@ export { TaskTypeMap } from '@/component/Task/component/TaskTable'; export const ENABLED_SYS_FROM_ITEM = false; export const hasPermission = (taskType: TaskType, permissions: DatabasePermissionType[]) => { + /* 如果有ACCESS(没有库权限, 只有库下的某个表权限), 则先全部粗颗粒放开 */ + if (permissions.includes(DatabasePermissionType.ACCESS)) { + return permissions?.length > 0; // 考虑有表没有库权限的情况 + } let _permissions = []; switch (taskType) { case TaskType.EXPORT: - return permissions?.length > 0; // 考虑有表没有库权限的情况 + _permissions = [DatabasePermissionType.EXPORT]; + break; case TaskType.EXPORT_RESULT_SET: - return permissions?.length > 0; // 考虑有表没有库权限的情况 - case TaskType.ASYNC: - return permissions?.length > 0; // 考虑有表没有库权限的情况 + _permissions = [DatabasePermissionType.EXPORT, DatabasePermissionType.QUERY]; + break; default: _permissions = [DatabasePermissionType.CHANGE]; } diff --git a/src/d.ts/table.ts b/src/d.ts/table.ts index 0ee76c084..fd9708e1f 100644 --- a/src/d.ts/table.ts +++ b/src/d.ts/table.ts @@ -210,6 +210,11 @@ export enum TablePermissionType { EXPORT = 'EXPORT', } +export enum UnauthorizedPermissionTypeInSQLExecute { + ODC_TABLE = 'ODC_TABLE', + ODC_DATABASE = 'ODC_DATABASE', +} + export interface IUnauthorizedDBResources { unauthorizedPermissionTypes: (DatabasePermissionType & TablePermissionType)[]; dataSourceId: number; @@ -220,6 +225,7 @@ export interface IUnauthorizedDBResources { tableName: string; tableId: number; applicable: boolean; + type: UnauthorizedPermissionTypeInSQLExecute; } export interface IColumnStoreServerType { allColumns?: boolean; diff --git a/src/page/Workspace/components/SQLResultSet/DBPermissionTable.tsx b/src/page/Workspace/components/SQLResultSet/DBPermissionTable.tsx index 043118f24..86d863ff7 100644 --- a/src/page/Workspace/components/SQLResultSet/DBPermissionTable.tsx +++ b/src/page/Workspace/components/SQLResultSet/DBPermissionTable.tsx @@ -20,7 +20,11 @@ import { CloseCircleFilled } from '@ant-design/icons'; import { ModalStore } from '@/store/modal'; import DisplayTable from '@/component/DisplayTable'; import { DatabasePermissionType } from '@/d.ts/database'; -import { IUnauthorizedDBResources, TablePermissionType } from '@/d.ts/table'; +import { + IUnauthorizedDBResources, + TablePermissionType, + UnauthorizedPermissionTypeInSQLExecute, +} from '@/d.ts/table'; import Action from '@/component/Action'; import { permissionOptionsMap } from '@/component/Task/ApplyDatabasePermission'; import MultiLineOverflowText from '@/component/MultiLineOverflowText'; @@ -76,6 +80,9 @@ const getColumns = ( ellipsis: true, render: (action, _) => { const dbDisabled = !_.applicable; + const isTablePermissionError = _.type === UnauthorizedPermissionTypeInSQLExecute.ODC_TABLE; + const isDatabasePermissionError = + _.type === UnauthorizedPermissionTypeInSQLExecute.ODC_DATABASE; let dbTooltip = null, tableTooltip = null; if (dbDisabled) { @@ -99,7 +106,7 @@ const getColumns = ( return ( { @@ -114,7 +121,7 @@ const getColumns = ( { { applyTableTask?.(