From 0e8b2ef7f3fd145be7fa0ddafce64dc3c9faa631 Mon Sep 17 00:00:00 2001 From: Martin Weise <martin.weise@tuwien.ac.at> Date: Thu, 11 May 2023 21:56:59 +0200 Subject: [PATCH] Hotfix frontend private databases --- .../java/at/tuwien/endpoints/TableEndpoint.java | 4 ++-- dbrepo-ui/components/DBToolbar.vue | 2 +- dbrepo-ui/components/TableToolbar.vue | 2 +- dbrepo-ui/layouts/default.vue | 17 +---------------- dbrepo-ui/store/index.js | 6 ++++++ 5 files changed, 11 insertions(+), 20 deletions(-) diff --git a/dbrepo-table-service/rest-service/src/main/java/at/tuwien/endpoints/TableEndpoint.java b/dbrepo-table-service/rest-service/src/main/java/at/tuwien/endpoints/TableEndpoint.java index a028e5da8f..bc5c696fd9 100644 --- a/dbrepo-table-service/rest-service/src/main/java/at/tuwien/endpoints/TableEndpoint.java +++ b/dbrepo-table-service/rest-service/src/main/java/at/tuwien/endpoints/TableEndpoint.java @@ -180,8 +180,8 @@ public class TableEndpoint { throws TableNotFoundException, DatabaseNotFoundException, ContainerNotFoundException, NotAllowedException { log.debug("endpoint find table, containerId={}, databaseId={}, tableId={}, principal={}", containerId, databaseId, tableId, principal); - endpointValidator.validateOnlyPrivateAccess(containerId, databaseId, principal); - endpointValidator.validateOnlyPrivateHasRole(containerId, databaseId, principal, "find-table"); +// endpointValidator.validateOnlyPrivateAccess(containerId, databaseId, principal); +// endpointValidator.validateOnlyPrivateHasRole(containerId, databaseId, principal, "find-table"); final Table table = tableService.findById(containerId, databaseId, tableId); final TableDto dto = tableMapper.tableToTableDto(table); log.trace("find table resulted in table {}", dto); diff --git a/dbrepo-ui/components/DBToolbar.vue b/dbrepo-ui/components/DBToolbar.vue index ecbc4fe11e..b8590bc855 100644 --- a/dbrepo-ui/components/DBToolbar.vue +++ b/dbrepo-ui/components/DBToolbar.vue @@ -55,7 +55,7 @@ <v-tab :to="`/container/${$route.params.container_id}/database/${$route.params.database_id}/table`"> {{ $t('databases.toolbar.tables', { name: 'vue-i18n' }) }} </v-tab> - <v-tab :to="`/container/${$route.params.container_id}/database/${$route.params.database_id}/query`"> + <v-tab v-if="hasReadAccess" :to="`/container/${$route.params.container_id}/database/${$route.params.database_id}/query`"> {{ $t('databases.toolbar.subsets', { name: 'vue-i18n' }) }} </v-tab> <v-tab :to="`/container/${$route.params.container_id}/database/${$route.params.database_id}/view`"> diff --git a/dbrepo-ui/components/TableToolbar.vue b/dbrepo-ui/components/TableToolbar.vue index c11713dd33..b3f22595c9 100644 --- a/dbrepo-ui/components/TableToolbar.vue +++ b/dbrepo-ui/components/TableToolbar.vue @@ -2,7 +2,7 @@ <div v-if="table"> <v-toolbar flat> <v-toolbar-title> - <v-btn id="back-btn" class="mr-2" :to="`/container/${$route.params.container_id}/database/${$route.params.database_id}/table`"> + <v-btn id="back-btn" plain class="mr-2" :to="`/container/${$route.params.container_id}/database/${$route.params.database_id}/table`"> <v-icon left>mdi-arrow-left</v-icon> </v-btn> </v-toolbar-title> diff --git a/dbrepo-ui/layouts/default.vue b/dbrepo-ui/layouts/default.vue index 82ed12293a..8f9358cb23 100644 --- a/dbrepo-ui/layouts/default.vue +++ b/dbrepo-ui/layouts/default.vue @@ -125,7 +125,6 @@ import AuthenticationService from '@/api/authentication.service' import DatabaseService from '@/api/database.service' import TableService from '@/api/table.service' -import IdentifierService from '@/api/identifier.service' export default { data () { @@ -262,7 +261,7 @@ export default { this.loading = false this.loadTable() }) - .catch(() => { + .finally(() => { this.loading = false }) }, @@ -296,20 +295,6 @@ export default { this.loading = false }) }, - loadIdentifier () { - if (!this.database || 'identifier' in this.database) { - return - } - this.loading = true - IdentifierService.find(this.database.identifier.id) - .then((identifier) => { - this.database.identifier = identifier - this.$store.commit('SET_DATABASE', this.database) - }) - .finally(() => { - this.loading = false - }) - }, retrieve () { this.$router.push({ path: '/search', query: { q: this.search } }) } diff --git a/dbrepo-ui/store/index.js b/dbrepo-ui/store/index.js index 70ffc1c317..e42e49e0d0 100644 --- a/dbrepo-ui/store/index.js +++ b/dbrepo-ui/store/index.js @@ -61,6 +61,12 @@ const store = new Store({ commit('SET_USER', user) }) }, + reloadAccess ({ state, commit }) { + DatabaseService.checkAccess(state.container.id, state.database.id) + .then((access) => { + commit('SET_ACCESS', access) + }) + }, reloadDatabase ({ state, commit }) { DatabaseService.findOne(state.database.container.id, state.database.id) .then((database) => { -- GitLab