From 3c07c6e8c07b9403e391fb655e0425a89ef0db9e Mon Sep 17 00:00:00 2001 From: konrad Date: Tue, 11 Aug 2020 18:18:59 +0000 Subject: [PATCH] Hide UI elements if the user does not have the right to use them (#211) Hide Team UI elements if the user does not have the rights to use them Fix replacing the right saved in the model when updating Hide UI-Elements on task if the user does not have the rights to use them Hide UI-Elements on gantt if the user does not have the rights to use them Hide UI-Elements on kanban if the user does not have rights to use them Fix canWrite condition Hide list components if the user has no right to write to the list Add max right to model Co-authored-by: kolaente Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/211 --- src/App.vue | 7 +- src/components/input/editor.vue | 7 +- src/components/tasks/gantt-component.vue | 11 ++- src/components/tasks/partials/attachments.vue | 12 ++- src/components/tasks/partials/comments.vue | 18 ++-- .../tasks/partials/editAssignees.vue | 8 +- src/components/tasks/partials/editLabels.vue | 4 + .../tasks/partials/percentDoneSelect.vue | 7 +- .../tasks/partials/prioritySelect.vue | 7 +- .../tasks/partials/relatedTasks.vue | 95 ++++++++++--------- src/components/tasks/partials/reminders.vue | 8 +- src/components/tasks/partials/repeatAfter.vue | 9 +- .../tasks/partials/singleTaskInList.vue | 6 +- src/models/abstractModel.js | 6 ++ src/services/abstractService.js | 16 +++- src/styles/components/base/multiselect.scss | 1 - src/styles/components/comments.scss | 2 +- src/styles/components/task.scss | 23 +++-- src/views/list/views/Kanban.vue | 31 ++++-- src/views/list/views/List.vue | 16 +++- src/views/tasks/TaskDetailView.vue | 93 +++++++++++++----- src/views/teams/EditTeam.vue | 27 +++--- 22 files changed, 282 insertions(+), 132 deletions(-) diff --git a/src/App.vue b/src/App.vue index 37978996..44fdd18a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -34,7 +34,10 @@ :style="{ 'opacity': currentList.title === '' ? '0': '1' }"> {{ currentList.title === '' ? 'Loading...': currentList.title}} - + @@ -291,6 +294,7 @@ import NamespaceService from './services/namespace' import authTypes from './models/authTypes' + import Rights from './models/rights.json' import swEvents from './ServiceWorker/events' import Notification from './components/misc/notification' @@ -427,6 +431,7 @@ background: 'background', imprintUrl: state => state.config.legal.imprintUrl, privacyPolicyUrl: state => state.config.legal.privacyPolicyUrl, + canWriteCurrentList: state => state.currentList.maxRight > Rights.READ, }), methods: { logout() { diff --git a/src/components/input/editor.vue b/src/components/input/editor.vue index c790297d..22525660 100644 --- a/src/components/input/editor.vue +++ b/src/components/input/editor.vue @@ -1,6 +1,6 @@ -
+ state.currentList.maxRight > Rights.READ, + }), methods: { buildTheGanttChart() { this.setDates() diff --git a/src/components/tasks/partials/attachments.vue b/src/components/tasks/partials/attachments.vue index 4b176ce1..120159a2 100644 --- a/src/components/tasks/partials/attachments.vue +++ b/src/components/tasks/partials/attachments.vue @@ -6,6 +6,7 @@ Attachments @@ -14,7 +15,7 @@ - + {{ attachmentService.uploadProgress }}% @@ -41,7 +42,7 @@ - + @@ -52,7 +53,7 @@
-
+
@@ -102,7 +103,10 @@ }, initialAttachments: { type: Array, - } + }, + editEnabled: { + default: true, + }, }, created() { this.attachmentService = new AttachmentService() diff --git a/src/components/tasks/partials/comments.vue b/src/components/tasks/partials/comments.vue index ac6f958d..20bb85e8 100644 --- a/src/components/tasks/partials/comments.vue +++ b/src/components/tasks/partials/comments.vue @@ -1,6 +1,6 @@