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:
parent
e7dbe3a74d
commit
b9558710dd
|
@ -64,10 +64,31 @@ public class SessionUtil {
|
||||||
scope = pContext.getCurrentScope(httpServletRequest);
|
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)
|
userName = pContext.getCurrentUser(httpServletRequest)
|
||||||
.getUsername();
|
.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);
|
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)
|
String name = pContext.getCurrentUser(httpServletRequest)
|
||||||
.getFirstName();
|
.getFirstName();
|
||||||
String lastName = pContext.getCurrentUser(httpServletRequest)
|
String lastName = pContext.getCurrentUser(httpServletRequest)
|
||||||
|
@ -85,8 +106,8 @@ public class SessionUtil {
|
||||||
String groupName = pContext.getCurrentGroupName(httpServletRequest);
|
String groupName = pContext.getCurrentGroupName(httpServletRequest);
|
||||||
|
|
||||||
sCredentials = new ServiceCredentials(userName, fullName, name,
|
sCredentials = new ServiceCredentials(userName, fullName, name,
|
||||||
lastName, email, scope, groupId, groupName, userAvatarURL, token);
|
lastName, email, scope, groupId, groupName, userAvatarURL,
|
||||||
|
token);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("ServiceCredentials: " + sCredentials);
|
logger.info("ServiceCredentials: " + sCredentials);
|
||||||
|
@ -94,10 +115,6 @@ public class SessionUtil {
|
||||||
return sCredentials;
|
return sCredentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
public static ArrayList<Recipient> getRecipients(
|
public static ArrayList<Recipient> getRecipients(
|
||||||
ServletContext servletContest) {
|
ServletContext servletContest) {
|
||||||
|
|
Loading…
Reference in New Issue