Compare commits
11 Commits
Author | SHA1 | Date |
---|---|---|
Massimiliano Assante | b6463ff598 | |
Massimiliano Assante | c7c962414d | |
Massimiliano Assante | 80b24443e0 | |
Massimiliano Assante | 3d4667d504 | |
Massimiliano Assante | 0acb08f4ba | |
Massimiliano Assante | fa373c0ff7 | |
Massimiliano Assante | 90baf04995 | |
Massimiliano Assante | 9890dfe01c | |
Massimiliano Assante | b9e4aea1db | |
Massimiliano Assante | f87d7e85cf | |
Massimiliano Assante | e9330f651e |
|
@ -1,49 +1,76 @@
|
|||
<?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"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<property name="context-root" value="workspace-widget-portlet"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<property name="java-output-path" value="/workspace-widget-portlet/target/classes"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</wb-module>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
12
CHANGELOG.md
12
CHANGELOG.md
|
@ -4,9 +4,19 @@
|
|||
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
|
||||
- Removed legacy auth dependency
|
||||
|
||||
## [v1.4.1] - 2021-01-26
|
||||
|
||||
|
|
10
pom.xml
10
pom.xml
|
@ -13,7 +13,7 @@
|
|||
<artifactId>workspace-widget-portlet</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<name>workspace-widget-portlet Portlet</name>
|
||||
<version>1.5.0</version>
|
||||
<version>1.5.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>
|
||||
|
@ -36,7 +36,7 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>maven-portal-bom</artifactId>
|
||||
<version>3.6.1</version>
|
||||
<version>3.6.3</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
@ -79,7 +79,11 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.portal</groupId>
|
||||
<artifactId>oidc-library-portal</artifactId>
|
||||
<version>[1.3.0-SNAPSHOT, 2.0.0)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>oidc-library</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -7,7 +7,7 @@ import java.util.List;
|
|||
import javax.portlet.ResourceRequest;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.gcube.common.authorization.library.provider.UmaJWTProvider;
|
||||
import org.gcube.common.authorization.library.provider.AccessTokenProvider;
|
||||
import org.gcube.common.portal.GCubePortalConstants;
|
||||
import org.gcube.common.portal.PortalContext;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
|
@ -17,6 +17,7 @@ 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;
|
||||
|
@ -146,7 +147,7 @@ public class StorageHubServiceUtil {
|
|||
try {
|
||||
long userId = PortalUtil.getUser(request).getUserId();
|
||||
JWTToken umaToken = OIDCUmaUtil.getUMAToken(request, userId, currentContext);
|
||||
UmaJWTProvider.instance.set(umaToken.getRaw());
|
||||
AccessTokenProvider.instance.set(JWTTokenUtil.getAccessTokenString(umaToken));
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
@ -173,7 +174,7 @@ public class StorageHubServiceUtil {
|
|||
String username = currentUsername;
|
||||
try {
|
||||
JWTToken umaToken = OIDCUmaUtil.getUMAToken(request, username, currentContext);
|
||||
UmaJWTProvider.instance.set(umaToken.getRaw());
|
||||
AccessTokenProvider.instance.set(JWTTokenUtil.getAccessTokenString(umaToken));
|
||||
} catch (InvalidTokenException | MissingTokenException | RefreshException | NotAuthorizedException
|
||||
| UMAException e1) {
|
||||
_log.warn("could not get UMA Token for context="+currentContext);
|
||||
|
|
|
@ -3,6 +3,7 @@ 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;
|
||||
|
@ -12,7 +13,7 @@ import javax.portlet.ResourceResponse;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.gcube.common.authorization.library.provider.UmaJWTProvider;
|
||||
import org.gcube.common.authorization.library.provider.AccessTokenProvider;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.common.storagehub.client.StreamDescriptor;
|
||||
import org.gcube.common.storagehub.client.dsl.FileContainer;
|
||||
|
@ -25,14 +26,13 @@ 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;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||
|
||||
import com.liferay.portal.kernel.exception.PortalException;
|
||||
import com.liferay.portal.kernel.exception.SystemException;
|
||||
import com.liferay.portal.kernel.json.JSONArray;
|
||||
import com.liferay.portal.kernel.json.JSONFactoryUtil;
|
||||
import com.liferay.portal.kernel.json.JSONObject;
|
||||
|
@ -70,7 +70,7 @@ public class WorkspaceWidget extends MVCPortlet {
|
|||
try {
|
||||
userId = PortalUtil.getUser(resourceRequest).getUserId();
|
||||
JWTToken umaToken = OIDCUmaUtil.getUMAToken(httpReq, userId, currentContext);
|
||||
UmaJWTProvider.instance.set(umaToken.getRaw());
|
||||
AccessTokenProvider.instance.set(JWTTokenUtil.getAccessTokenString(umaToken));
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
@ -102,9 +102,7 @@ public class WorkspaceWidget extends MVCPortlet {
|
|||
} catch (StorageHubException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (! (item instanceof ExternalURL || item instanceof ExternalLink)) {
|
||||
|
||||
|
||||
if (! (item instanceof ExternalURL || item instanceof ExternalLink)) {
|
||||
ServletResponseUtil.sendFile(httpReq,httpRes, streamDescr.getFileName(), streamDescr.getStream(), "application/download");
|
||||
streamDescr.getStream().close();
|
||||
}
|
||||
|
@ -143,8 +141,13 @@ 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
|
||||
WorkspaceManagerClient wsclient = AbstractPlugin.workspace().build();
|
||||
itemId = wsclient.getVreFolder("hl:accounting").getId();
|
||||
_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();
|
||||
itemsList = StorageHubServiceUtil.getItemChildren(authUser, itemId, itemId, start, offset);
|
||||
String groupName = GroupLocalServiceUtil.getGroup(groupId).getName();
|
||||
groupName = groupName.replace("_", " ");
|
||||
|
|
|
@ -91,7 +91,7 @@ $.fn.dataTable.ext.errMode = 'none';
|
|||
|
||||
function loadItemsListIntoTable(itemId, itemName, hideVreFolders) {
|
||||
var table = $('#userTable').DataTable();
|
||||
table.ajax.url('<%=usersCustomDataSourceURL%>'+itemId+'_selectedName='+itemName).load();
|
||||
table.ajax.url('<%=usersCustomDataSourceURL%>'+itemId+'_selectedName='+encodeURIComponent(itemName)).load();
|
||||
if (hideVreFolders) {
|
||||
$('#vreFoldersDiv').hide();
|
||||
} else {
|
||||
|
@ -103,7 +103,7 @@ function loadItemsListIntoTable(itemId, itemName, hideVreFolders) {
|
|||
|
||||
function loadRecentItemsListIntoTable(itemId, itemName) {
|
||||
var table = $('#userTable').DataTable();
|
||||
table.ajax.url('<%=usersCustomDataSourceURL%>'+itemId+'_selectedName='+itemName).load();
|
||||
table.ajax.url('<%=usersCustomDataSourceURL%>'+itemId+'_selectedName='+encodeURIComponent(itemName)).load();
|
||||
$('#userTable_info').hide();
|
||||
$('#userTable_length').hide();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue