@ -7,9 +7,9 @@ import java.util.List;
import javax.portlet.ResourceRequest ;
import javax.servlet.http.HttpServletRequest ;
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 ;
@ -35,7 +35,6 @@ public class StorageHubServiceUtil {
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 {
@ -68,10 +67,6 @@ public class StorageHubServiceUtil {
*
* /
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 {
@ -91,7 +86,6 @@ 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 ) ;
@ -112,7 +106,6 @@ 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 ( ) ;
@ -136,10 +129,6 @@ 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 ;
@ -161,11 +150,9 @@ public class StorageHubServiceUtil {
* @return the VRE Folders Id
* /
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 ( request ) ;
ScopeProvider . instance . set ( currentContext ) ;
try {
WorkspaceManagerClient wsclient = AbstractPlugin . workspace ( ) . build ( ) ;
try {