Added PortalContext

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@134844 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2016-11-25 15:54:19 +00:00
parent e7dbe3a74d
commit b9558710dd
1 changed files with 28 additions and 11 deletions

View File

@ -64,10 +64,31 @@ public class SessionUtil {
scope = pContext.getCurrentScope(httpServletRequest);
}
if (scope == null || scope.isEmpty()) {
String error = "Error retrieving scope: " + scope;
logger.error(error);
throw new StatAlgoImporterServiceException(error);
}
userName = pContext.getCurrentUser(httpServletRequest)
.getUsername();
if (userName == null || userName.isEmpty()) {
String error = "Error retrieving username in scope " + scope
+ ": " + userName;
logger.error(error);
throw new StatAlgoImporterServiceException(error);
}
token = pContext.getCurrentUserToken(httpServletRequest);
if (token == null || token.isEmpty()) {
String error = "Error retrieving token for " + userName
+ " in " + scope + ": " + token;
logger.error(error);
throw new StatAlgoImporterServiceException(error);
}
String name = pContext.getCurrentUser(httpServletRequest)
.getFirstName();
String lastName = pContext.getCurrentUser(httpServletRequest)
@ -85,8 +106,8 @@ public class SessionUtil {
String groupName = pContext.getCurrentGroupName(httpServletRequest);
sCredentials = new ServiceCredentials(userName, fullName, name,
lastName, email, scope, groupId, groupName, userAvatarURL, token);
lastName, email, scope, groupId, groupName, userAvatarURL,
token);
}
logger.info("ServiceCredentials: " + sCredentials);
@ -94,10 +115,6 @@ public class SessionUtil {
return sCredentials;
}
//
public static ArrayList<Recipient> getRecipients(
ServletContext servletContest) {