Skip to content

Commit

Permalink
Merge branch 'devel' into fix/cb-4740/sql-editor-value-equal-check
Browse files Browse the repository at this point in the history
  • Loading branch information
dariamarutkina authored Feb 26, 2024
2 parents 0cdf4a8 + a4f50c2 commit 7b8c7ea
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ public WebSession(
this.lastAccessTime = this.createTime;
setLocale(CommonUtils.toString(httpSession.getAttribute(ATTR_LOCALE), this.locale));
this.sessionHandlers = sessionHandlers;
//force authorization of anonymous session to avoid access error,
//because before authorization could be called by any request,
//but now 'updateInfo' is called only in special requests,
//and the order of requests is not guaranteed.
//look at CB-4747
refreshSessionAuth();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ public WebSession getWebSession(
log.debug((restored ? "Restored " : "New ") + "web session '" + webSession.getSessionId() + "'");

webSession.setCacheExpired(!httpSession.isNew());
webSession.updateInfo(request, response);

sessionMap.put(sessionId, webSession);
} else {
Expand Down
18 changes: 16 additions & 2 deletions webapp/packages/plugin-data-viewer/src/DataViewerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
4 changes: 2 additions & 2 deletions webapp/packages/plugin-data-viewer/src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
4 changes: 2 additions & 2 deletions webapp/packages/plugin-data-viewer/src/locales/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
4 changes: 2 additions & 2 deletions webapp/packages/plugin-data-viewer/src/locales/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', 'Максимальный размер выборки'],
Expand Down
4 changes: 2 additions & 2 deletions webapp/packages/plugin-data-viewer/src/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down

0 comments on commit 7b8c7ea

Please sign in to comment.