Skip to content

Commit 11a0bca

Browse files
committed
fix: remove pid
1 parent 7fc5707 commit 11a0bca

File tree

3 files changed

+10
-83
lines changed

3 files changed

+10
-83
lines changed

src/main/java/com/cronos/onlinereview/actions/projectdetails/BaseProjectDetailsAction.java

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -181,76 +181,6 @@ protected CorrectnessCheckResult checkForCorrectUploadId(HttpServletRequest requ
181181
return result;
182182
}
183183

184-
/**
185-
* This method verifies the request for certain conditions to be met. This includes verifying
186-
* if the user has specified an ID of project he wants to perform an operation on, if the
187-
* ID of the project specified by user denotes an existing project, and whether the user
188-
* has enough rights to perform the operation specified by <code>permission</code> parameter.
189-
*
190-
* @return an instance of the {@link CorrectnessCheckResult} class, which specifies whether the
191-
* check was successful and, in the case the check was successful, contains additional
192-
* information retrieved during the check operation, which might be of some use for the
193-
* calling method.
194-
* @param request
195-
* the http request.
196-
* @param permission
197-
* permission to check against, or <code>null</code> if no check is required.
198-
* @throws BaseException
199-
* if any error occurs.
200-
*/
201-
protected CorrectnessCheckResult checkForCorrectProjectId(HttpServletRequest request,
202-
String permission) throws BaseException {
203-
// Prepare bean that will be returned as the result
204-
CorrectnessCheckResult result = new CorrectnessCheckResult();
205-
206-
if (permission == null || permission.trim().length() == 0) {
207-
permission = null;
208-
}
209-
210-
// Verify that Project ID was specified and denotes correct project
211-
String pidParam = request.getParameter("pid");
212-
if (pidParam == null || pidParam.trim().length() == 0) {
213-
result.setResult(ActionsHelper.produceErrorReport(
214-
this, request, permission, "Error.ProjectIdNotSpecified", null));
215-
// Return the result of the check
216-
return result;
217-
}
218-
219-
long pid;
220-
221-
try {
222-
// Try to convert specified pid parameter to its integer representation
223-
pid = Long.parseLong(pidParam, 10);
224-
} catch (NumberFormatException e) {
225-
result.setResult(ActionsHelper.produceErrorReport(
226-
this, request, permission, "Error.ProjectNotFound", null));
227-
// Return the result of the check
228-
return result;
229-
}
230-
231-
// Retrieve the project following submission's information chain
232-
Project project = ActionsHelper.createProjectManager().getProject(pid);
233-
if (project == null) {
234-
result.setResult(ActionsHelper.produceErrorReport(
235-
this, request, permission, "Error.ProjectNotFound", null));
236-
// Return the result of the check
237-
return result;
238-
}
239-
240-
request.setAttribute("pid", pid);
241-
242-
// Store Project object in the result bean
243-
result.setProject(project);
244-
// Place project as attribute in the request
245-
request.setAttribute("project", project);
246-
247-
// Gather the roles the user has for current request
248-
AuthorizationHelper.gatherUserRoles(request, project.getId());
249-
250-
// Return the result of the check
251-
return result;
252-
}
253-
254184
/**
255185
* <p>
256186
* Sends the content of specified file for downloading by client.

src/main/java/com/cronos/onlinereview/actions/projectdetails/DownloadFinalFixAction.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,10 @@ public String execute() throws BaseException, IOException {
5454
LoggingHelper.logAction(request);
5555

5656
// Verify that certain requirements are met before processing with the Action
57-
CorrectnessCheckResult verification_pid = checkForCorrectProjectId(request, Constants.DOWNLOAD_FINAL_FIX_PERM_NAME);
57+
CorrectnessCheckResult verification = checkForCorrectUploadId(request, Constants.DOWNLOAD_FINAL_FIX_PERM_NAME);
5858
// If any error has occurred, return action forward contained in the result bean
59-
if (!verification_pid.isSuccessful()) {
60-
return verification_pid.getResult();
61-
}
62-
63-
CorrectnessCheckResult verification_uid = checkForCorrectUploadId(request, Constants.DOWNLOAD_FINAL_FIX_PERM_NAME);
64-
// If any error has occurred, return action forward contained in the result bean
65-
if (!verification_uid.isSuccessful()) {
66-
return verification_uid.getResult();
59+
if (!verification.isSuccessful()) {
60+
return verification.getResult();
6761
}
6862

6963
boolean hasPermission = false, hasSubmitterRole = false;
@@ -100,7 +94,7 @@ public String execute() throws BaseException, IOException {
10094
}
10195

10296
// Get the upload the user wants to download
103-
Upload upload = verification_uid.getUpload();
97+
Upload upload = verification.getUpload();
10498

10599
if (!hasPermission) {
106100
ActionsHelper.logDownloadAttempt(request, upload, false);

web/includes/project/project_phase_reskin.jsp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -719,9 +719,12 @@
719719
</td>
720720
<td nowrap="nowrap">${orfn:displayDate(pageContext.request, group.finalFix.modificationTimestamp)}</td>
721721
<td nowrap="nowrap">
722-
<a href="<or:url value='/actions/DownloadFinalFix?uid=${group.finalFix.id}&pid=${project.id}' />"
723-
title="<or:text key='viewProjectDetails.box.FinalFix.Download.alt' />"><or:text
724-
key="viewProjectDetails.box.FinalFix.Download"/></a>
722+
<c:if test="${not empty group.finalFix}">
723+
<a href="<or:url value='/actions/DownloadFinalFix?uid=${group.finalFix.id}' />"
724+
title="<or:text key='viewProjectDetails.box.FinalFix.Download.alt' />">
725+
<or:text key="viewProjectDetails.box.FinalFix.Download"/>
726+
</a>
727+
</c:if>
725728
</td>
726729
<td nowrap="nowrap">
727730
<tc-webtag:handle

0 commit comments

Comments
 (0)