From 6967b0e8b073e7209644c92cb84e864832a3c1d7 Mon Sep 17 00:00:00 2001 From: Mateus Machado Luna Date: Wed, 20 Mar 2019 12:50:15 -0300 Subject: [PATCH] Hides edit button when user is not allowed to do it in item's page. Also redirects edition dition page to items list when user cant edit. Ref. #205. --- src/admin/components/edition/item-edition-form.vue | 6 +++++- src/admin/pages/singles/item-page.vue | 3 ++- src/js/store/modules/item/actions.js | 4 ++-- src/theme-helper/view-mode-slideshow.vue | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/admin/components/edition/item-edition-form.vue b/src/admin/components/edition/item-edition-form.vue index fab70be91..0bebe8d8a 100644 --- a/src/admin/components/edition/item-edition-form.vue +++ b/src/admin/components/edition/item-edition-form.vue @@ -1067,9 +1067,13 @@ export default { // Initializes Media Frames now that itemId exists this.initializeMediaFrames(); - this.fetchItem(this.itemId).then(res => { + this.fetchItem({ itemId: this.itemId, contextEdit: true }).then(res => { this.item = res; + // Checks if user has permission to edit + if (!this.item.current_user_can_edit) + this.$router.push(this.$routerHelper.getCollectionPath(this.collectionId)); + // Updates Collection BreadCrumb if (this.isOnSequenceEdit) { this.$root.$emit('onCollectionBreadCrumbUpdate', [ diff --git a/src/admin/pages/singles/item-page.vue b/src/admin/pages/singles/item-page.vue index 7bf2ef8ff..81e9c8513 100644 --- a/src/admin/pages/singles/item-page.vue +++ b/src/admin/pages/singles/item-page.vue @@ -336,6 +336,7 @@