Fixed other methods do remove ASL session and test.user

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@134771 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2016-11-25 11:16:32 +00:00
parent efa2a9aca0
commit 7aadc44989
3 changed files with 9 additions and 23 deletions

View File

@ -78,7 +78,6 @@ import org.gcube.portlets.user.workspace.client.workspace.folder.item.gcube.GWTD
import org.gcube.portlets.user.workspace.client.workspace.folder.item.gcube.GWTImageDocument;
import org.gcube.portlets.user.workspace.client.workspace.folder.item.gcube.GWTUrlDocument;
import org.gcube.portlets.user.workspace.server.util.UserUtil;
import org.gcube.portlets.user.workspace.server.util.WsUtil;
import org.gcube.portlets.user.workspace.shared.WorkspaceACL;
import org.gcube.portlets.user.workspace.shared.WorkspaceACL.USER_TYPE;
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingEntryType;
@ -131,7 +130,6 @@ public class GWTWorkspaceBuilder {
hashTestUser.put("pasquale.pagano", new InfoContactModel("pasquale.pagano", "pasquale.pagano", "Pasquale Pagano",false));
hashTestUser.put("valentina.marioli", new InfoContactModel("valentina.marioli", "valentina.marioli", "Valentina Marioli",false));
hashTestUser.put("roberto.cirillo", new InfoContactModel("roberto.cirillo", "roberto.cirillo", "Roberto Cirillo",false));
hashTestUser.put(WsUtil.TEST_USER.toString(), new InfoContactModel(WsUtil.TEST_USER, WsUtil.TEST_USER, WsUtil.TEST_USER_FULL_NAME,false));
hashTestUser.put("francesco.mangiacrapa", new InfoContactModel("francesco.mangiacrapa", "francesco.mangiacrapa", "Francesco Mangiacrapa",false));
hashTestUser.put("massimiliano.assante", new InfoContactModel("massimiliano.assante", "massimiliano.assante", "Massimiliano Assante",false));

View File

@ -2682,7 +2682,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
String lastName = "User";
boolean publishRights = false;
if (isWithinPortal() && username.compareTo(WsUtil.TEST_USER) != 0) {
if (isWithinPortal() && username != null) {
try {
LiferayUserManager l = new LiferayUserManager();
GCubeUser user = l.getUserByUsername(username);
@ -2718,7 +2718,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
PortalContextInfo info = WsUtil.getPortalContext(this.getThreadLocalRequest());
String username = info.getUsername();
String firstName = "";
if (isWithinPortal() && username.compareTo(WsUtil.TEST_USER) != 0) {
if (isWithinPortal() && username != null) {
try {
LiferayUserManager l = new LiferayUserManager();
GCubeUser user = l.getUserByUsername(username);
@ -3483,7 +3483,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
return false;
}
if(username.equals(WsUtil.TEST_USER)){
if(username == null){
workspaceLogger.warn("Session expired");
return false;
}

View File

@ -40,6 +40,8 @@ import com.liferay.portal.service.UserLocalServiceUtil;
*/
public class WsUtil {
protected static Logger logger = Logger.getLogger(WsUtil.class);
public static final String FOLDERIMPORTER_ATTRIBUTE = "FOLDER_IMPORTER";
public static final String METADATACONVERTER_ATTRIBUTE = "METADATA_CONVERTER";
public static final String WORKSPACE_EVENT_COLLECTOR_ATTRIBUTE = "EVENT_COLLECTOR";
@ -53,25 +55,11 @@ public class WsUtil {
public static final String PROPERTY_SPECIAL_FOLDER = "PROPERTY_SPECIAL_FOLDER";
public static final String NOTIFICATION_PORTLET_CLASS_ID = "org.gcube.portlets.user.workspace.server.GWTWorkspaceServiceImpl"; //IN DEV
// public static final String TEST_SCOPE = "/d4science.research-infrastructures.eu";
// public static final String TEST_TOKEN = "57b42a99-6239-44c4-9a68-591c18363222-843339462"; //username Francesco Mangiacrapa scope: BiodiversityLab
public static final String TEST_SCOPE = "/gcube";
public static final String TEST_TOKEN = "89257623-0570-4fbe-a15b-458bb84f4902-98187548"; //username Francesco Mangiacrapa scope: NextNext
//UNCOMMENT THIS FOR RELEASE
public static String TEST_USER = "test.user";
public static String TEST_USER_FULL_NAME = "Test User";
protected static Logger logger = Logger.getLogger(WsUtil.class);
// public static boolean withoutPortal = false;
/**
* Checks if is within portal.
*
* @return true if you're running into the portal, false if in development
*/
* Checks if is within portal.
*
* @return true if you're running into the portal, false if in development
*/
public static boolean isWithinPortal() {
try {
UserLocalServiceUtil.getService();