task_21363 #1
|
@ -123,9 +123,7 @@ public class CkanContentModeratorCheckConfigs {
|
||||||
};
|
};
|
||||||
|
|
||||||
timer.scheduleRepeating(500);
|
timer.scheduleRepeating(500);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
<b:Label ui:field="orderInfo" type="DEFAULT" addStyleNames="{style.margin-top-12}"></b:Label>
|
<b:Label ui:field="orderInfo" type="DEFAULT" addStyleNames="{style.margin-top-12}"></b:Label>
|
||||||
</b:Nav>
|
</b:Nav>
|
||||||
<b:Nav alignment="RIGHT">
|
<b:Nav alignment="RIGHT">
|
||||||
<b:NavLink ui:field="closeAllTabs">Close All Tabs
|
<b:NavLink ui:field="closeAllTabs" visible="false">Close All Tabs
|
||||||
</b:NavLink>
|
</b:NavLink>
|
||||||
</b:Nav>
|
</b:Nav>
|
||||||
</b:Navbar>
|
</b:Navbar>
|
||||||
|
|
|
@ -3,14 +3,17 @@ package org.gcube.portlets.widgets.ckancontentmoderator.client.ui;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.widgets.ckancontentmoderator.client.resources.ContentModeratorWidgetResources;
|
||||||
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.util.UtilFunct;
|
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.util.UtilFunct;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.Icon;
|
||||||
import com.github.gwtbootstrap.client.ui.Tab;
|
import com.github.gwtbootstrap.client.ui.Tab;
|
||||||
import com.github.gwtbootstrap.client.ui.TabPanel;
|
import com.github.gwtbootstrap.client.ui.TabPanel;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.core.client.Scheduler;
|
import com.google.gwt.core.client.Scheduler;
|
||||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||||
|
import com.google.gwt.dom.client.Style.Cursor;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
import com.google.gwt.event.dom.client.LoadEvent;
|
import com.google.gwt.event.dom.client.LoadEvent;
|
||||||
|
@ -18,6 +21,7 @@ import com.google.gwt.event.dom.client.LoadHandler;
|
||||||
import com.google.gwt.uibinder.client.UiBinder;
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
import com.google.gwt.user.client.Element;
|
import com.google.gwt.user.client.Element;
|
||||||
|
import com.google.gwt.user.client.ui.AbstractImagePrototype;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
@ -87,6 +91,26 @@ public class MainTabPanel extends Composite {
|
||||||
public void onLoad(LoadEvent event) {
|
public void onLoad(LoadEvent event) {
|
||||||
tab.setIcon(IconType.BOOK);
|
tab.setIcon(IconType.BOOK);
|
||||||
setNoSpinner(tab);
|
setNoSpinner(tab);
|
||||||
|
|
||||||
|
Icon icon = new Icon(IconType.REMOVE);
|
||||||
|
icon.setTitle("Close this tab");
|
||||||
|
icon.getElement().getStyle().setCursor(Cursor.POINTER);
|
||||||
|
ClickHandler clickHandler = new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
try {
|
||||||
|
mainTabPanel.remove(tab);
|
||||||
|
results.remove(tab);
|
||||||
|
mainTabPanel.selectTab(results.size() - 1);
|
||||||
|
}catch (Exception e) {
|
||||||
|
//silent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
icon.addDomHandler(clickHandler, ClickEvent.getType());
|
||||||
|
tab.addDecorate(icon);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,4 +35,6 @@
|
||||||
.as_simple_link {
|
.as_simple_link {
|
||||||
background: none !important;
|
background: none !important;
|
||||||
border: none !important;
|
border: none !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
margin: 0 !important;
|
||||||
}
|
}
|
|
@ -248,12 +248,34 @@ public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implem
|
||||||
String scope = setContexts();
|
String scope = setContexts();
|
||||||
DataCatalogueImpl catalogueImpl = CatalogueCMSFactory.getFactory().getCatalogueImplPerScope(scope);
|
DataCatalogueImpl catalogueImpl = CatalogueCMSFactory.getFactory().getCatalogueImplPerScope(scope);
|
||||||
GCubeUser user = GcubeContextUtil.getCurrentUser(this.getThreadLocalRequest());
|
GCubeUser user = GcubeContextUtil.getCurrentUser(this.getThreadLocalRequest());
|
||||||
|
|
||||||
|
boolean moderationCheckPassed = false;
|
||||||
|
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
CkanDataset ckanDataset = catalogueImpl.getDataset(itemName, user.getUsername());
|
CkanDataset ckanDataset = catalogueImpl.getDataset(itemName, user.getUsername());
|
||||||
ds = null;
|
ds = null;
|
||||||
if (ckanDataset != null) {
|
if (ckanDataset != null) {
|
||||||
ds = toPatchedCatalogueDataset(ckanDataset, catalogueImpl.getCatalogueUrl());
|
ds = toPatchedCatalogueDataset(ckanDataset, catalogueImpl.getCatalogueUrl());
|
||||||
|
|
||||||
|
Boolean userModerator = isModeratorRoleAssigned();
|
||||||
|
moderationCheckPassed = userModerator?true:false;
|
||||||
|
LOG.info("Moderation check: is the user a Moderator? "+moderationCheckPassed);
|
||||||
|
//The user is not a Moderator, yes otherwise
|
||||||
|
if(!moderationCheckPassed) {
|
||||||
|
String datasetAuthorMail = ds.getAuthorEmail();
|
||||||
|
String userMail = user.getEmail();
|
||||||
|
if(datasetAuthorMail!=null && userMail!=null && datasetAuthorMail.compareTo(userMail)==0) {
|
||||||
|
//The user is the owner of the dataset, so he/she can view the dataset (moderation check passed)
|
||||||
|
moderationCheckPassed = true;
|
||||||
}
|
}
|
||||||
|
LOG.info("Moderation check: is the user the owner of the dataset? "+moderationCheckPassed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!moderationCheckPassed) {
|
||||||
|
LOG.info("Moderation ckeck not passed, returning null");
|
||||||
|
ds = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -261,7 +283,7 @@ public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implem
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.info("returning: " + ds);
|
LOG.info("getItemForName "+itemName+", returning: " + ds);
|
||||||
return ds;
|
return ds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue