diff --git a/webapp/packages/plugin-data-viewer/src/DataViewerService.ts b/webapp/packages/plugin-data-viewer/src/DataViewerService.ts index 27b95e75c3..c72a5278c4 100644 --- a/webapp/packages/plugin-data-viewer/src/DataViewerService.ts +++ b/webapp/packages/plugin-data-viewer/src/DataViewerService.ts @@ -7,19 +7,33 @@ */ import type { Connection } from '@cloudbeaver/core-connections'; import { injectable } from '@cloudbeaver/core-di'; +import { EAdminPermission, SessionPermissionsResource } from '@cloudbeaver/core-root'; import { DataViewerSettingsService } from './DataViewerSettingsService'; @injectable() export class DataViewerService { get canCopyData() { + if (this.sessionPermissionsResource.has(EAdminPermission.admin)) { + return true; + } + return !this.dataViewerSettingsService.settings.getValue('disableCopyData'); } - constructor(private readonly dataViewerSettingsService: DataViewerSettingsService) {} + constructor( + private readonly dataViewerSettingsService: DataViewerSettingsService, + private readonly sessionPermissionsResource: SessionPermissionsResource, + ) {} isDataEditable(connection: Connection) { + if (connection.readOnly) { + return false; + } + + const isAdmin = this.sessionPermissionsResource.has(EAdminPermission.admin); const disabled = this.dataViewerSettingsService.settings.getValue('disableEdit'); - return !disabled && !connection.readOnly; + + return isAdmin || !disabled; } } diff --git a/webapp/packages/plugin-data-viewer/src/locales/en.ts b/webapp/packages/plugin-data-viewer/src/locales/en.ts index 6831fdab89..afeb6a8def 100644 --- a/webapp/packages/plugin-data-viewer/src/locales/en.ts +++ b/webapp/packages/plugin-data-viewer/src/locales/en.ts @@ -50,9 +50,9 @@ export default [ ['data_viewer_model_not_loaded', 'Table model is not loaded'], ['settings_data_editor', 'Data Editor'], ['settings_data_editor_disable_edit_name', 'Disable Edit'], - ['settings_data_editor_disable_edit_description', 'Disable editing of data in Data Viewer'], + ['settings_data_editor_disable_edit_description', 'Disable editing of data in Data Viewer for non-admin users'], ['settings_data_editor_disable_data_copy_name', 'Disable Copy'], - ['settings_data_editor_disable_data_copy_description', 'Disable copying of data in Data Viewer'], + ['settings_data_editor_disable_data_copy_description', 'Disable copying of data in Data Viewer for non-admin users'], ['settings_data_editor_fetch_min_name', 'Minimum fetch size'], ['settings_data_editor_fetch_min_description', 'Minimum number of rows to fetch'], ['settings_data_editor_fetch_max_name', 'Maximum fetch size'], diff --git a/webapp/packages/plugin-data-viewer/src/locales/it.ts b/webapp/packages/plugin-data-viewer/src/locales/it.ts index 35306f85a3..a35769e675 100644 --- a/webapp/packages/plugin-data-viewer/src/locales/it.ts +++ b/webapp/packages/plugin-data-viewer/src/locales/it.ts @@ -43,9 +43,9 @@ export default [ ['data_viewer_model_not_loaded', 'Table model is not loaded'], ['settings_data_editor', 'Data Editor'], ['settings_data_editor_disable_edit_name', 'Disable Edit'], - ['settings_data_editor_disable_edit_description', 'Disable editing of data in Data Viewer'], + ['settings_data_editor_disable_edit_description', 'Disable editing of data in Data Viewer for non-admin users'], ['settings_data_editor_disable_data_copy_name', 'Disable Copy'], - ['settings_data_editor_disable_data_copy_description', 'Disable copying of data in Data Viewer'], + ['settings_data_editor_disable_data_copy_description', 'Disable copying of data in Data Viewer for non-admin users'], ['settings_data_editor_fetch_min_name', 'Minimum fetch size'], ['settings_data_editor_fetch_min_description', 'Minimum number of rows to fetch'], ['settings_data_editor_fetch_max_name', 'Maximum fetch size'], diff --git a/webapp/packages/plugin-data-viewer/src/locales/ru.ts b/webapp/packages/plugin-data-viewer/src/locales/ru.ts index 05dd579c74..307b45cd6b 100644 --- a/webapp/packages/plugin-data-viewer/src/locales/ru.ts +++ b/webapp/packages/plugin-data-viewer/src/locales/ru.ts @@ -44,9 +44,9 @@ export default [ ['data_viewer_model_not_loaded', 'Не удалось загрузить модель таблицы'], ['settings_data_editor', 'Редактор данных'], ['settings_data_editor_disable_edit_name', 'Отключить редактирование'], - ['settings_data_editor_disable_edit_description', 'Отключить редактирование данных'], + ['settings_data_editor_disable_edit_description', 'Отключить редактирование данных для пользователей без прав администратора'], ['settings_data_editor_disable_data_copy_name', 'Отключить копирование'], - ['settings_data_editor_disable_data_copy_description', 'Отключить копирование данных'], + ['settings_data_editor_disable_data_copy_description', 'Отключить копирование данных для пользователей без прав администратора'], ['settings_data_editor_fetch_min_name', 'Минимальный размер выборки'], ['settings_data_editor_fetch_min_description', 'Минимальное количество строк для выборки'], ['settings_data_editor_fetch_max_name', 'Максимальный размер выборки'], diff --git a/webapp/packages/plugin-data-viewer/src/locales/zh.ts b/webapp/packages/plugin-data-viewer/src/locales/zh.ts index 4c0bba6c65..d5bf26d577 100644 --- a/webapp/packages/plugin-data-viewer/src/locales/zh.ts +++ b/webapp/packages/plugin-data-viewer/src/locales/zh.ts @@ -50,9 +50,9 @@ export default [ ['data_viewer_model_not_loaded', 'Table model is not loaded'], ['settings_data_editor', 'Data Editor'], ['settings_data_editor_disable_edit_name', 'Disable Edit'], - ['settings_data_editor_disable_edit_description', 'Disable editing of data in Data Viewer'], + ['settings_data_editor_disable_edit_description', 'Disable editing of data in Data Viewer for non-admin users'], ['settings_data_editor_disable_data_copy_name', 'Disable Copy'], - ['settings_data_editor_disable_data_copy_description', 'Disable copying of data in Data Viewer'], + ['settings_data_editor_disable_data_copy_description', 'Disable copying of data in Data Viewer for non-admin users'], ['settings_data_editor_fetch_min_name', 'Minimum fetch size'], ['settings_data_editor_fetch_min_description', 'Minimum number of rows to fetch'], ['settings_data_editor_fetch_max_name', 'Maximum fetch size'],