management buttons set to hidden when view is set per vre

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@158866 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2017-11-28 13:41:53 +00:00
parent a80eccc44d
commit 83eacef2df
5 changed files with 49 additions and 3 deletions

View File

@ -79,4 +79,9 @@ public interface GcubeCkanDataCatalogService extends RemoteService {
* @return
*/
boolean isManageProductEnabled();
/**
* Check if the management panels but publish/share link must be removed
*/
boolean isViewPerVREEnabled();
}

View File

@ -84,4 +84,6 @@ public interface GcubeCkanDataCatalogServiceAsync {
* @return
*/
void isManageProductEnabled(AsyncCallback<Boolean> callback);
void isViewPerVREEnabled(AsyncCallback<Boolean> callback);
}

View File

@ -344,4 +344,21 @@ public class CkanMetadataManagementPanel extends FlowPanel{
manageProduct.setVisible(false);
}
public void removeGenericManagementButtons() {
home.setVisible(false);
organizations.setVisible(false);
groups.setVisible(false);
items.setVisible(false);
types.setVisible(false);
separatorMyInfo.setVisible(false);
separatorAdminButtons.setVisible(false);
myDatasets.setVisible(false);
myOrganizations.setVisible(false);
myGroups.setVisible(false);
statistics.setVisible(false);
manageProduct.setVisible(false);
}
}

View File

@ -150,6 +150,27 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
}
});
// check if management buttons need to be removed
GCubeCkanDataCatalog.service.isViewPerVREEnabled(new AsyncCallback<Boolean>() {
@Override
public void onSuccess(Boolean result) {
if(result){
// hide all management buttons
managementPanel.removeGenericManagementButtons();
}
}
@Override
public void onFailure(Throwable caught) {
}
});
// retrieve organizations
GCubeCkanDataCatalog.service.getCkanOrganizationsNamesAndUrlsForUser(new AsyncCallback<List<BeanUserInOrgGroupRole>>() {

View File

@ -93,7 +93,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
}
if(pathInfoParameter == null || pathInfoParameter.isEmpty()){
boolean viewEnabled = viewPerOrganizationEnabled();
boolean viewEnabled = isViewPerVREEnabled();
if(viewEnabled){
GroupManager gm = new LiferayGroupManager();
String groupName = gm.getGroup(gm.getGroupIdFromInfrastructureScope(scopePerCurrentUrl)).getGroupName().toLowerCase();
@ -555,7 +555,8 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
* Ask to liferay
* @return
*/
public boolean viewPerOrganizationEnabled(){
@Override
public boolean isViewPerVREEnabled(){
boolean enabled = false;
String scopePerCurrentUrl = SessionUtil.getScopeFromClientUrl(getThreadLocalRequest());