Add another debug statement; reformat.
This commit is contained in:
parent
0093590bba
commit
d6e507691a
1 changed files with 34 additions and 32 deletions
|
@ -145,31 +145,31 @@ public class ImageUploadController extends FreemarkerHttpServlet {
|
||||||
* </ul>
|
* </ul>
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ResponseValues processRequest(VitroRequest vreq) {
|
protected ResponseValues processRequest(VitroRequest vreq) {
|
||||||
try {
|
try {
|
||||||
// Parse the multi-part request.
|
// Parse the multi-part request.
|
||||||
FileUploadServletRequest request = FileUploadServletRequest.parseRequest(vreq,
|
FileUploadServletRequest request = FileUploadServletRequest
|
||||||
MAXIMUM_FILE_SIZE);
|
.parseRequest(vreq, MAXIMUM_FILE_SIZE);
|
||||||
if (log.isTraceEnabled()) {
|
if (log.isTraceEnabled()) {
|
||||||
dumpRequestDetails(vreq);
|
dumpRequestDetails(vreq);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If they aren't authorized to do this, send them to login.
|
// If they aren't authorized to do this, send them to login.
|
||||||
if (!checkAuthorized(vreq)) {
|
if (!checkAuthorized(vreq)) {
|
||||||
String loginPage = request.getContextPath() + Controllers.LOGIN;
|
String loginPage = request.getContextPath() + Controllers.LOGIN;
|
||||||
return new RedirectResponseValues(loginPage);
|
return new RedirectResponseValues(loginPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
return buildTheResponse(vreq);
|
return buildTheResponse(vreq);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//log.error("Could not produce response page", e);
|
// log.error("Could not produce response page", e);
|
||||||
return new ExceptionResponseValues(e);
|
return new ExceptionResponseValues(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the different actions. If not specified, the default action is to
|
* Handle the different actions. If not specified, the default action is to
|
||||||
* show the intro screen.
|
* show the intro screen.
|
||||||
|
@ -480,8 +480,8 @@ public class ImageUploadController extends FreemarkerHttpServlet {
|
||||||
* URI.
|
* URI.
|
||||||
*/
|
*/
|
||||||
private String formAction(String entityUri, String action) {
|
private String formAction(String entityUri, String action) {
|
||||||
UrlBuilder.ParamMap params = new UrlBuilder.ParamMap(PARAMETER_ENTITY_URI,
|
UrlBuilder.ParamMap params = new UrlBuilder.ParamMap(
|
||||||
entityUri, PARAMETER_ACTION, action);
|
PARAMETER_ENTITY_URI, entityUri, PARAMETER_ACTION, action);
|
||||||
return UrlBuilder.getPath(URL_HERE, params);
|
return UrlBuilder.getPath(URL_HERE, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -580,8 +580,6 @@ public class ImageUploadController extends FreemarkerHttpServlet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If they are logged in as an Editor or better, they can do whatever they
|
* If they are logged in as an Editor or better, they can do whatever they
|
||||||
* want.
|
* want.
|
||||||
|
@ -591,7 +589,8 @@ public class ImageUploadController extends FreemarkerHttpServlet {
|
||||||
*/
|
*/
|
||||||
private boolean checkAuthorized(VitroRequest vreq)
|
private boolean checkAuthorized(VitroRequest vreq)
|
||||||
throws UserMistakeException {
|
throws UserMistakeException {
|
||||||
if (LoginStatusBean.getBean(vreq).isLoggedInAtLeast(LoginStatusBean.EDITOR)) {
|
if (LoginStatusBean.getBean(vreq).isLoggedInAtLeast(
|
||||||
|
LoginStatusBean.EDITOR)) {
|
||||||
log.debug("Authorized because logged in as Editor");
|
log.debug("Authorized because logged in as Editor");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -618,9 +617,12 @@ public class ImageUploadController extends FreemarkerHttpServlet {
|
||||||
VitroVocabulary.IND_MAIN_IMAGE,
|
VitroVocabulary.IND_MAIN_IMAGE,
|
||||||
RequestActionConstants.SOME_LITERAL, null, null);
|
RequestActionConstants.SOME_LITERAL, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
AuthorizationHelper helper = new AuthorizationHelper(vreq);
|
AuthorizationHelper helper = new AuthorizationHelper(vreq);
|
||||||
return helper.isAuthorizedForRequestedAction(ra);
|
boolean authorized = helper.isAuthorizedForRequestedAction(ra);
|
||||||
|
log.debug((authorized ? "" : "Not ") + "Authorized for '" + action
|
||||||
|
+ "' as self-editor; requested action = " + ra);
|
||||||
|
return authorized;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue