masked farmId and batchType

git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/branches/portlets/user/PerformFISH-Apps/1.3@178513 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2019-03-08 09:28:40 +00:00
parent 7c0128fe82
commit eeaae5fae4
2 changed files with 16 additions and 1 deletions

View File

@ -933,6 +933,15 @@ public class Utils {
return null;
}
public static String maskId(String toMask) {
try {
return URLEncoder.encode(Base64.getEncoder().encodeToString(toMask.getBytes("utf-8")), "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return null;
}
public static long unmaskId(String idToUnmask) {
String unmasked = new String(Base64.getDecoder().decode(idToUnmask));
return Long.parseLong(unmasked);

View File

@ -20,6 +20,8 @@
long currentGroupId = group.getGroupId();
String currentURL = PortalUtil.getCurrentURL(request);
pageContext.setAttribute("AnalyticalToolkitPortletEndpoint", Utils.ANALYTICAL_TOOLKIT_PORTLET_ENDPOINT);
pageContext.setAttribute("farmIdParamEncoded", Utils.maskId("farmid"));
pageContext.setAttribute("batchTypeParamEncoded", Utils.maskId("batchtype"));
%>
<script>
function closeAndReload() {
@ -84,6 +86,10 @@ function closeAndReload() {
String userProfileLinkPublisher = "";
pageContext.setAttribute("rowBgColor", "#FFF");
pageContext.setAttribute("buttonCheckProgressStyle", "display: none;");
pageContext.setAttribute("farmIdEncoded", Utils.maskId(theFarm.getTeamId()));
pageContext.setAttribute("batchTypeEncoded", Utils.maskId(submittedForm.getBatchType()));
if (submittedForm.getSubmitterIdentity() != null) {
fullNamePublisher = Utils.getUserByUsername(submittedForm.getSubmitterIdentity()).getFullname();
pageContext.setAttribute("fullNamePublisher", fullNamePublisher);
@ -131,7 +137,7 @@ function closeAndReload() {
<c:set var="buttonDisabled" value="disabled title='Analysis not available for this Batch type' "/>
</c:if>
<button class="btn" type="button" ${buttonDisabled}
onClick="location.href='${AnalyticalToolkitPortletEndpoint}?batchtype=${form.batchType}&farmid=${farmId}'">Analyse </button>
onClick="location.href='${AnalyticalToolkitPortletEndpoint}?${batchTypeParamEncoded}=${batchTypeEncoded}&${farmIdParamEncoded}=${farmIdEncoded}'">Analyse </button>
</c:if>
</td>
</tr>