Compare commits

..

No commits in common. "master" and "r4.17.0" have entirely different histories.

16 changed files with 158 additions and 248 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -1,16 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
@ -24,5 +13,16 @@
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -3,9 +3,7 @@ org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -1,78 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="workspace-widget-portlet">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<property name="context-root" value="workspace-widget-portlet"/>
<property name="java-output-path" value="/workspace-widget-portlet/target/classes"/>
</wb-module>
</project-modules>

View File

@ -1,37 +0,0 @@
# Changelog for Workspace Widget Portlet
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.5.2] - 2021-10-04
- Feature #22109 Workspace widget to load VRE Folders without using JCR indices
## [v1.5.1] - 2021-07-13
- Feature #21507 support new UMATokensProvider class
- Bug #21794 folder names were not URI encoded
## [v1.5.0] - 2021-04-06
- Removed legacy auth dependency
## [v1.4.1] - 2021-01-26
- Fix Bug #20552 Workspace widget item counter no longer works
## [v1.3.1] - 2019-10-09
- Updated to new storage hub api
## [v1.3.0] - 2019-03-04
- Updated to new storage hub exception handling<
- Feature #12796 Workspace widget: recent documents has a different behaviour on URL items
## [v1.0.0] - 2018-05-17
First release

View File

@ -1,26 +0,0 @@
# Acknowledgments
The projects leading to this software have received funding from a series of European Union programmes including:
- the Sixth Framework Programme for Research and Technological Development
- [DILIGENT](https://cordis.europa.eu/project/id/004260) (grant no. 004260).
- the Seventh Framework Programme for research, technological development and demonstration
- [D4Science](https://cordis.europa.eu/project/id/212488) (grant no. 212488);
- [D4Science-II](https://cordis.europa.eu/project/id/239019) (grant no.239019);
- [ENVRI](https://cordis.europa.eu/project/id/283465) (grant no. 283465);
- [iMarine](https://cordis.europa.eu/project/id/283644) (grant no. 283644);
- [EUBrazilOpenBio](https://cordis.europa.eu/project/id/288754) (grant no. 288754).
- the H2020 research and innovation programme
- [SoBigData](https://cordis.europa.eu/project/id/654024) (grant no. 654024);
- [PARTHENOS](https://cordis.europa.eu/project/id/654119) (grant no. 654119);
- [EGI-Engage](https://cordis.europa.eu/project/id/654142) (grant no. 654142);
- [ENVRI PLUS](https://cordis.europa.eu/project/id/654182) (grant no. 654182);
- [BlueBRIDGE](https://cordis.europa.eu/project/id/675680) (grant no. 675680);
- [PerformFISH](https://cordis.europa.eu/project/id/727610) (grant no. 727610);
- [AGINFRA PLUS](https://cordis.europa.eu/project/id/731001) (grant no. 731001);
- [DESIRA](https://cordis.europa.eu/project/id/818194) (grant no. 818194);
- [ARIADNEplus](https://cordis.europa.eu/project/id/823914) (grant no. 823914);
- [RISIS 2](https://cordis.europa.eu/project/id/824091) (grant no. 824091);
- [EOSC-Pillar](https://cordis.europa.eu/project/id/857650) (grant no. 857650);
- [Blue Cloud](https://cordis.europa.eu/project/id/862409) (grant no. 862409);
- [SoBigData-PlusPlus](https://cordis.europa.eu/project/id/871042) (grant no. 871042);

19
distro/changelog.xml Normal file
View File

@ -0,0 +1,19 @@
<ReleaseNotes>
<Changeset component="org.gcube.workspace-widget-portlet.1-3-1"
date="2019-10-09">
<Change>Updated to new storage hub api</Change>
</Changeset>
<Changeset component="org.gcube.workspace-widget-portlet.1-3-0"
date="2019-03-04">
<Change>Updated to new storage hub exception handling</Change>
<Change>Feature #12796 Workspace widget: recent documents has a different behaviour on URL items</Change>
</Changeset>
<Changeset component="org.gcube.workspace-widget-portlet.1-1-0"
date="2018-06-12">
<Change>Added mazimise feature</Change>
</Changeset>
<Changeset component="org.gcube.workspace-widget-portlet.1-0-0"
date="2018-05-17">
<Change>First Release</Change>
</Changeset>
</ReleaseNotes>

31
distro/descriptor.xml Normal file
View File

@ -0,0 +1,31 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>servicearchive</id>
<formats>
<format>tar.gz</format>
</formats>
<baseDirectory>/</baseDirectory>
<fileSets>
<fileSet>
<directory>${distroDirectory}</directory>
<outputDirectory>/</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<includes>
<include>README</include>
<include>LICENSE</include>
<include>changelog.xml</include>
<include>profile.xml</include>
</includes>
<fileMode>755</fileMode>
<filtered>true</filtered>
</fileSet>
</fileSets>
<files>
<file>
<source>target/${build.finalName}.${project.packaging}</source>
<outputDirectory>/${artifactId}</outputDirectory>
</file>
</files>
</assembly>

25
distro/profile.xml Normal file
View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<Resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ID></ID>
<Type>Service</Type>
<Profile>
<Description>${description}</Description>
<Class>PortletUser</Class>
<Name>${artifactId}</Name>
<Version>${version}</Version>
<Packages>
<Software>
<Name>${artifactId}</Name>
<Version>${version}</Version>
<MavenCoordinates>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
</MavenCoordinates>
<Files>
<File>target/${build.finalName}.war</File>
</Files>
</Software>
</Packages>
</Profile>
</Resource>

36
pom.xml
View File

@ -1,6 +1,5 @@
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@ -13,17 +12,19 @@
<artifactId>workspace-widget-portlet</artifactId>
<packaging>war</packaging>
<name>workspace-widget-portlet Portlet</name>
<version>1.5.2</version>
<version>1.3.2</version>
<description>
Workspace Widget Portlet is a small Front-end component looking like G Drive which exposes the content of the user's workspace or VRE Folders in read only mode.
</description>
Workspace Widget
</description>
<scm>
<connection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</connection>
<developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</developerConnection>
<url>https://code-repo.d4science.org/gCubeSystem/${project.artifactId}</url>
<connection>scm:git:https://code-repo.d4science.org/gCubeSystem/workspace-widget-portlet.git</connection>
<developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/workspace-widget-portlet.git</developerConnection>
<url>https://code-repo.d4science.org/gCubeSystem/workspace-widget-portlet</url>
</scm>
<properties>
<distroDirectory>distro</distroDirectory>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<liferay.version>6.2.5</liferay.version>
<liferay.maven.plugin.version>6.2.10.12</liferay.maven.plugin.version>
<liferay.auto.deploy.dir>/Users/massi/portal/liferay-portal-6.2-ce-ga6/deploy</liferay.auto.deploy.dir>
@ -36,7 +37,7 @@
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>3.6.3</version>
<version>3.5.0-4.16.0-181969</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -76,19 +77,10 @@
<artifactId>common-authorization</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>oidc-library-portal</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>oidc-library</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>portal-service</artifactId>
<version>${liferay.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -158,8 +150,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
@ -169,7 +161,7 @@
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>

View File

@ -25,7 +25,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings("deprecation")
public class ItemBuilder {
public static final Logger _log = LoggerFactory.getLogger(ItemBuilder.class);
@ -38,7 +37,6 @@ public class ItemBuilder {
* @param currentUserName
* @return
*/
@SuppressWarnings("deprecation")
public static WSItem getItem(WSItem parent, Item workspaceItem, String workspaceItemPath, String currentUserName) {
ItemType type = getItemType(workspaceItem);
boolean isFolder = type.equals(ItemType.PRIVATE_FOLDER)?true:false;
@ -46,7 +44,7 @@ public class ItemBuilder {
String itemName = workspaceItem.getName();
if(isSharedFolder){
_log.debug("Is shared folder: "+workspaceItem.getTitle());
_log.info("Is shared folder: "+workspaceItem.getTitle());
SharedFolder shared = (SharedFolder) workspaceItem;
itemName = shared.isVreFolder()?shared.getDisplayName():workspaceItem.getTitle();
}

View File

@ -7,28 +7,18 @@ import java.util.List;
import javax.portlet.ResourceRequest;
import javax.servlet.http.HttpServletRequest;
import org.gcube.common.authorization.library.provider.AccessTokenProvider;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.portal.GCubePortalConstants;
import org.gcube.common.portal.PortalContext;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.common.storagehub.client.plugins.AbstractPlugin;
import org.gcube.common.storagehub.client.proxies.ItemManagerClient;
import org.gcube.common.storagehub.client.proxies.WorkspaceManagerClient;
import org.gcube.common.storagehub.model.items.Item;
import org.gcube.oidc.rest.JWTToken;
import org.gcube.portal.oidc.lr62.InvalidTokenException;
import org.gcube.portal.oidc.lr62.JWTTokenUtil;
import org.gcube.portal.oidc.lr62.MissingTokenException;
import org.gcube.portal.oidc.lr62.NotAuthorizedException;
import org.gcube.portal.oidc.lr62.OIDCUmaUtil;
import org.gcube.portal.oidc.lr62.RefreshException;
import org.gcube.portal.oidc.lr62.UMAException;
import org.gcube.portlets.user.wswidget.shared.AuthorizedUser;
import org.gcube.portlets.user.wswidget.shared.WSItem;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.util.PortalUtil;
public class StorageHubServiceUtil {
private static Log _log = LogFactoryUtil.getLog(StorageHubServiceUtil.class);
@ -39,12 +29,13 @@ public class StorageHubServiceUtil {
* @param itemName
* @param from
* @param offset
* @return the list of items
* @return
*/
public static List<WSItem> getItemChildren(AuthorizedUser authUser, String itemId, String itemName, int from, int offset) {
WSItem toReturn = new WSItem(itemId, itemName, true);
_log.debug("getItemChildren folder/item = " + itemId);
ArrayList<WSItem> children = new ArrayList<>();
SecurityTokenProvider.instance.set(authUser.getSecurityToken());
ItemManagerClient client = AbstractPlugin.item().build();
List<? extends Item> theChildren = null;
try {
@ -70,17 +61,21 @@ public class StorageHubServiceUtil {
}
toReturn.setChildren(children);
Collections.sort(toReturn.getChildren(), new ItemComparator());
_log.debug("Returning children size: "+toReturn.getChildren().size());
_log.debug("*** Returning children size: "+toReturn.getChildren().size());
return children;
}
/**
*
*/
public static int getItemChildrenCount(ResourceRequest request, String itemId) {
String userName = Utils.getCurrentUser(request).getUsername();
String scope = Utils.getCurrentContext(request);
String authorizationToken = Utils.getCurrentUserToken(scope, userName);
SecurityTokenProvider.instance.set(authorizationToken);
ItemManagerClient client = AbstractPlugin.item().build();
int toReturn = -1;
try {
toReturn = client.childrenCount(itemId, false);
client.childrenCount(itemId, false);
}
catch (Exception e) {
e.printStackTrace();
@ -96,6 +91,7 @@ public class StorageHubServiceUtil {
*/
public static List<WSItem> getRootChildren(AuthorizedUser authUser, int from, int offset) {
try {
SecurityTokenProvider.instance.set(authUser.getSecurityToken());
WorkspaceManagerClient client = AbstractPlugin.workspace().build();
Item itemRoot = client.getWorkspace("hl:accounting");
WSItem root = new WSItem(itemRoot.getId(), Utils.HOME_LABEL, true);
@ -116,6 +112,7 @@ public class StorageHubServiceUtil {
WSItem toReturn = new WSItem("recents", "Recent Documents", true);
_log.debug("getRecentItems ");
ArrayList<WSItem> children = new ArrayList<>();
SecurityTokenProvider.instance.set(authUser.getSecurityToken());
WorkspaceManagerClient wsclient = AbstractPlugin.workspace().build();
List<? extends Item> theChildren = wsclient.getRecentModifiedFilePerVre();
@ -139,19 +136,14 @@ public class StorageHubServiceUtil {
* @return the id of the VRE Folder associated to the given context
*/
public static String getWorkspaceFolderURL(HttpServletRequest request) {
String userName = Utils.getCurrentUser(request).getUsername();
String scope = Utils.getCurrentContext(request);
String authorizationToken = Utils.getCurrentUserToken(scope, userName);
SecurityTokenProvider.instance.set(authorizationToken);
String siteLandingPagePath = PortalContext.getConfiguration().getSiteLandingPagePath(request);
String toReturn = siteLandingPagePath;
try {
String currentContext = Utils.getCurrentContext(request);
try {
long userId = PortalUtil.getUser(request).getUserId();
JWTToken umaToken = OIDCUmaUtil.getUMAToken(request, userId, currentContext);
AccessTokenProvider.instance.set(JWTTokenUtil.getAccessTokenString(umaToken));
} catch (Exception e1) {
e1.printStackTrace();
}
ScopeProvider.instance.set(currentContext);
WorkspaceManagerClient wsclient = AbstractPlugin.workspace().build();
String itemId = wsclient.getVreFolder("hl:accounting").getId();
toReturn = new String(new StringBuffer(siteLandingPagePath)
@ -168,31 +160,23 @@ public class StorageHubServiceUtil {
* @param request
* @return the VRE Folders Id
*/
public static String getVREFoldersId(long groupId, HttpServletRequest request, String currentUsername) {
public static String getVREFoldersId(HttpServletRequest request) {
String userName = Utils.getCurrentUser(request).getUsername();
String scope = Utils.getCurrentContext(request);
String authorizationToken = Utils.getCurrentUserToken(scope, userName);
SecurityTokenProvider.instance.set(authorizationToken);
String toReturn = "";
String currentContext = PortalContext.getConfiguration().getCurrentScope(""+groupId);
String username = currentUsername;
try {
JWTToken umaToken = OIDCUmaUtil.getUMAToken(request, username, currentContext);
AccessTokenProvider.instance.set(JWTTokenUtil.getAccessTokenString(umaToken));
} catch (InvalidTokenException | MissingTokenException | RefreshException | NotAuthorizedException
| UMAException e1) {
_log.warn("could not get UMA Token for context="+currentContext);
e1.printStackTrace();
}
_log.debug("getVREFoldersId, context="+currentContext);
ScopeProvider.instance.set(currentContext);
try {
WorkspaceManagerClient wsclient = AbstractPlugin.workspace().build();
try {
List<? extends Item> list = wsclient.getVreFolders("hl:accounting");
toReturn =list.iterator().next().getParentId();
} catch (java.util.NoSuchElementException ex) {
_log.info("This user has no VRE Folders");
} catch (Exception e) {
_log.info("This user has no VRE Folders", e);
return null;
}
}catch (Exception e) {
_log.warn("Could not load VREFolders id" + e.getMessage());
e.printStackTrace();
}
return toReturn;
}

View File

@ -3,7 +3,6 @@ package org.gcube.portlets.user.wswidget;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.Scanner;
import javax.portlet.PortletException;
@ -13,8 +12,7 @@ import javax.portlet.ResourceResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.gcube.common.authorization.library.provider.AccessTokenProvider;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.storagehub.client.StreamDescriptor;
import org.gcube.common.storagehub.client.dsl.FileContainer;
import org.gcube.common.storagehub.client.dsl.ItemContainer;
@ -25,9 +23,6 @@ import org.gcube.common.storagehub.model.exceptions.StorageHubException;
import org.gcube.common.storagehub.model.items.ExternalLink;
import org.gcube.common.storagehub.model.items.ExternalURL;
import org.gcube.common.storagehub.model.items.Item;
import org.gcube.oidc.rest.JWTToken;
import org.gcube.portal.oidc.lr62.JWTTokenUtil;
import org.gcube.portal.oidc.lr62.OIDCUmaUtil;
import org.gcube.portlets.user.wswidget.shared.AuthorizedUser;
import org.gcube.portlets.user.wswidget.shared.Breadcrumb;
import org.gcube.portlets.user.wswidget.shared.WSItem;
@ -63,17 +58,6 @@ public class WorkspaceWidget extends MVCPortlet {
//check if is a file download
if (fileToDownloadId != null) {
setAuthorizationToken(resourceRequest);
String currentContext = Utils.getCurrentContext(resourceRequest);
ScopeProvider.instance.set(currentContext);
HttpServletRequest httpReq = PortalUtil.getHttpServletRequest(resourceRequest);
long userId;
try {
userId = PortalUtil.getUser(resourceRequest).getUserId();
JWTToken umaToken = OIDCUmaUtil.getUMAToken(httpReq, userId, currentContext);
AccessTokenProvider.instance.set(JWTTokenUtil.getAccessTokenString(umaToken));
} catch (Exception e1) {
e1.printStackTrace();
}
String selectedItemId = fileToDownloadId.split("=")[1];
StorageHubClient client = new StorageHubClient();
FileContainer fileContainer = null;
@ -89,7 +73,6 @@ public class WorkspaceWidget extends MVCPortlet {
} else {
fileContainer = client.open(selectedItemId).asFile();
streamDescr = fileContainer.download(selectedItemId);
_log.info("*** DONE fileContainer.download for itemid=" +selectedItemId);
}
if (item instanceof ExternalURL) { //if is a type URL we open directly the link (HL Created it)
Scanner sc = new Scanner( streamDescr.getStream());
@ -103,6 +86,7 @@ public class WorkspaceWidget extends MVCPortlet {
e.printStackTrace();
}
if (! (item instanceof ExternalURL || item instanceof ExternalLink)) {
HttpServletRequest httpReq = PortalUtil.getHttpServletRequest(resourceRequest);
ServletResponseUtil.sendFile(httpReq,httpRes, streamDescr.getFileName(), streamDescr.getStream(), "application/download");
streamDescr.getStream().close();
}
@ -141,13 +125,8 @@ public class WorkspaceWidget extends MVCPortlet {
toSet = new Breadcrumb(itemId, Utils.getCurrentUser(request).getFirstName()+"\'s home");
request.getPortletSession().setAttribute(BREADCRUMB_ATTR, toSet, PortletSession.APPLICATION_SCOPE);
} else { //is in a VRE
_log.debug("looking for vre context");
String context = Utils.getCurrentContext(request);
final String vreContext = context.replace("/", "-").substring(1); //shub expects this name, e.g. gcube-devsec-devVRE
_log.debug("shub vre name to look for: "+vreContext);
StorageHubClient shc = new StorageHubClient();
Optional<ItemContainer<? extends Item>> vreContainer = shc.getVREFolders().getContainers().stream().filter(v -> v.get().getTitle().equals(vreContext)).findFirst();
itemId = vreContainer.get().getId();
WorkspaceManagerClient wsclient = AbstractPlugin.workspace().build();
itemId = wsclient.getVreFolder("hl:accounting").getId();
itemsList = StorageHubServiceUtil.getItemChildren(authUser, itemId, itemId, start, offset);
String groupName = GroupLocalServiceUtil.getGroup(groupId).getName();
groupName = groupName.replace("_", " ");
@ -278,6 +257,10 @@ public class WorkspaceWidget extends MVCPortlet {
}
private static WSItem getRootItem(ResourceRequest request) {
String userName = Utils.getCurrentUser(request).getUsername();
String scope = Utils.getCurrentContext(request);
String authorizationToken = Utils.getCurrentUserToken(scope, userName);
SecurityTokenProvider.instance.set(authorizationToken);
WorkspaceManagerClient client = AbstractPlugin.workspace().build();
Item itemRoot = client.getWorkspace("hl:accounting");
WSItem root = new WSItem(itemRoot.getId(), Utils.HOME_LABEL, true);
@ -293,6 +276,9 @@ public class WorkspaceWidget extends MVCPortlet {
*/
private AuthorizedUser setAuthorizationToken(ResourceRequest request) {
GCubeUser currentUser = Utils.getCurrentUser(request);
return new AuthorizedUser(currentUser);
String scope = Utils.getCurrentContext(request);
String authorizationToken = Utils.getCurrentUserToken(scope, currentUser.getUsername());
SecurityTokenProvider.instance.set(authorizationToken);
return new AuthorizedUser(currentUser, authorizationToken, scope);
}
}

View File

@ -6,10 +6,11 @@ public class AuthorizedUser {
private GCubeUser user;
private String token;
private String context;
public AuthorizedUser(GCubeUser user) {
public AuthorizedUser(GCubeUser user, String token, String context) {
super();
this.user = user;
this.token = token;
this.context = context;
}
public GCubeUser getUser() {
return user;
@ -17,7 +18,18 @@ public class AuthorizedUser {
public void setUser(GCubeUser user) {
this.user = user;
}
public String getSecurityToken() {
return token;
}
public void setSecurityToken(String token) {
this.token = token;
}
public String getContext() {
return context;
}
public void setContext(String context) {
this.context = context;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();

View File

@ -130,8 +130,7 @@
.workspace-widget-portlet .dataTables_wrapper {
margin-left: -5px;
overflow-x: hidden;
}
}
/* .dataTables_wrapper .dataTables_paginate .paginate_button.current, .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover */

View File

@ -3,10 +3,7 @@
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">
<%
pageContext.setAttribute("currentGroup", GroupLocalServiceUtil.getGroup(PortalUtil.getScopeGroupId(request)));
String currentUsername = PortalUtil.getUser(request).getScreenName();
pageContext.setAttribute("currentUsername", PortalUtil.getUser(request).getScreenName());
<% pageContext.setAttribute("currentGroup", GroupLocalServiceUtil.getGroup(PortalUtil.getScopeGroupId(request)));
%>
<script src="<%=renderRequest.getContextPath()%>/js/datatables.min.js"></script>
@ -24,7 +21,7 @@ pageContext.setAttribute("currentUsername", PortalUtil.getUser(request).getScree
<c:set var="maximised" scope="session"
value="${renderRequest.getWindowState().toString().equalsIgnoreCase('maximized')}" />
<table width="100%" style="border: none; border-collapse: inherit; overflow-x: hidden;">
<table width="100%" style="border: none; border-collapse: inherit;">
<tr>
<td><div class="ws-breadcrumb-container"></div></td>
<c:choose>
@ -45,7 +42,7 @@ pageContext.setAttribute("currentUsername", PortalUtil.getUser(request).getScree
</c:when>
<c:otherwise>
<td>
<%pageContext.setAttribute("vreFoldersId", StorageHubServiceUtil.getVREFoldersId(PortalUtil.getScopeGroupId(request), request, currentUsername));%>
<%pageContext.setAttribute("vreFoldersId", StorageHubServiceUtil.getVREFoldersId(request));%>
<c:if test="${not empty vreFoldersId}">
<div id="vreFoldersDiv" class="ws-recents">
<a
@ -91,7 +88,7 @@ $.fn.dataTable.ext.errMode = 'none';
function loadItemsListIntoTable(itemId, itemName, hideVreFolders) {
var table = $('#userTable').DataTable();
table.ajax.url('<%=usersCustomDataSourceURL%>'+itemId+'_selectedName='+encodeURIComponent(itemName)).load();
table.ajax.url('<%=usersCustomDataSourceURL%>'+itemId+'_selectedName='+itemName).load();
if (hideVreFolders) {
$('#vreFoldersDiv').hide();
} else {
@ -103,7 +100,7 @@ function loadItemsListIntoTable(itemId, itemName, hideVreFolders) {
function loadRecentItemsListIntoTable(itemId, itemName) {
var table = $('#userTable').DataTable();
table.ajax.url('<%=usersCustomDataSourceURL%>'+itemId+'_selectedName='+encodeURIComponent(itemName)).load();
table.ajax.url('<%=usersCustomDataSourceURL%>'+itemId+'_selectedName='+itemName).load();
$('#userTable_info').hide();
$('#userTable_length').hide();
}