From 9d9f548eb34ebaa82e8c2991b1690496272c8832 Mon Sep 17 00:00:00 2001 From: Costantino Perciante Date: Tue, 31 Oct 2017 11:17:44 +0000 Subject: [PATCH] manage panel hide when user is not admin nor vre manager git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@158045 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/CkanEventHandlerManager.java | 15 ++++++++++++++- .../client/view/GCubeCkanDataCatalogPanel.java | 10 ++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/CkanEventHandlerManager.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/CkanEventHandlerManager.java index 4e61395..1227476 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/CkanEventHandlerManager.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/CkanEventHandlerManager.java @@ -1,6 +1,8 @@ package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client; +import org.gcube.datacatalogue.grsf_manage_widget.client.events.HideManagementPanelEvent; +import org.gcube.datacatalogue.grsf_manage_widget.client.events.HideManagementPanelEventHandler; import org.gcube.datacatalogue.grsf_manage_widget.client.view.ManageProductWidget; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.EditMetadataEvent; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.EditMetadataEventHandler; @@ -216,7 +218,7 @@ public class CkanEventHandlerManager { @Override public void onShowManageProductWidget(ShowManageProductWidgetEvent event) { - new ManageProductWidget(event.getProductIdentifier()); + new ManageProductWidget(event.getProductIdentifier(), eventBus); } }); @@ -229,6 +231,17 @@ public class CkanEventHandlerManager { } }); + + // hide management panel if user is not allowed to manage + eventBus.addHandler(HideManagementPanelEvent.TYPE, new HideManagementPanelEventHandler() { + + @Override + public void onEvent(HideManagementPanelEvent hideEvent) { + + panel.showManagementPanel(false); + + } + }); } /** diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/GCubeCkanDataCatalogPanel.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/GCubeCkanDataCatalogPanel.java index d083e2d..c07df93 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/GCubeCkanDataCatalogPanel.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/GCubeCkanDataCatalogPanel.java @@ -487,4 +487,14 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate { ckanOrganizationsPanel.setVisible(false); ckanFramePanel.setVisible(false); } + + /** + * Show management panel + * @param show + */ + public void showManagementPanel(boolean show){ + + managementPanel.showManageProductButton(show); + + } }