From: <rv...@us...> - 2010-01-13 17:57:45
|
Revision: 428 http://treebase.svn.sourceforge.net/treebase/?rev=428&view=rev Author: rvos Date: 2010-01-13 17:57:38 +0000 (Wed, 13 Jan 2010) Log Message: ----------- SearchSummaryController now uses super.getConditionalModelAndView to construct the view it returns. This way, an additional access check is performed, so that studies-in-progress are only viewable given an x-access-granted parameter, otherwise an access violation view is returned. Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java 2010-01-13 17:31:31 UTC (rev 427) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java 2010-01-13 17:57:38 UTC (rev 428) @@ -256,9 +256,8 @@ protected ModelAndView processFormSubmission(HttpServletRequest request, HttpServletResponse response, Object command, BindException bindException) throws Exception { - // TODO Auto-generated method stub LOGGER.debug("processFormSubmission found study " + (Study) command); - return showForm(request, response, bindException); + return getConditionalModelAndView(request, showForm(request, response, bindException)); } @Override @@ -401,7 +400,7 @@ // but what the heck, let's put it in just to be sure newModel.put("study", theStudy); - return new ModelAndView(pageName, newModel); + return getConditionalModelAndView(request, new ModelAndView(pageName, newModel)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2010-01-14 15:59:59
|
Revision: 438 http://treebase.svn.sourceforge.net/treebase/?rev=438&view=rev Author: rvos Date: 2010-01-14 15:59:53 +0000 (Thu, 14 Jan 2010) Log Message: ----------- Added more logging messages Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java 2010-01-14 14:56:33 UTC (rev 437) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java 2010-01-14 15:59:53 UTC (rev 438) @@ -82,7 +82,7 @@ protected Study formBackingObject(HttpServletRequest request) throws Exception { Map<String,String []> param = request.getParameterMap(); - + LOGGER.info("in formBackingObject"); theStudy = null; { Long studyID = getIDParam(param, "id"); @@ -133,7 +133,7 @@ @Override protected Map<String,Object> referenceData(HttpServletRequest pRequest) throws Exception { - + LOGGER.info("in referenceData"); Map<String,Object> resultMap = new HashMap<String,Object>(); Study study = ControllerUtil.findStudy(pRequest, getStudyService()); @@ -256,6 +256,7 @@ protected ModelAndView processFormSubmission(HttpServletRequest request, HttpServletResponse response, Object command, BindException bindException) throws Exception { + LOGGER.info("in processFormSubmission"); LOGGER.debug("processFormSubmission found study " + (Study) command); return getConditionalModelAndView(request, showForm(request, response, bindException)); } @@ -264,6 +265,7 @@ protected ModelAndView showForm(HttpServletRequest request, HttpServletResponse response, BindException errors) throws Exception { String pageName = request.getServletPath(); + LOGGER.info("in showForm"); // LOGGER.debug("GetServletPath returns " + pageName); if (pageName == null) { pageName = getDefaultPage(); @@ -408,6 +410,7 @@ // The code should be shared private void setupForPhyloWidget(HttpServletRequest request) { // set up NEWICKSTRINGNAME and NEWICKSTRINGSMAP + LOGGER.info("setupForPhyloWidget"); String separator = "@"; Map<String, String> treeMap = new HashMap<String, String>(); String newickStringName = null; @@ -428,6 +431,7 @@ * The code should be shared */ private String getMapKey(PhyloTree pTree) { + LOGGER.info("in getMapKey"); StringBuilder key = new StringBuilder("TreeId: " + pTree.getId()); if (!TreebaseUtil.isEmpty(pTree.getLabel())) { key.append("|").append(pTree.getLabel()); @@ -446,58 +450,72 @@ } public String getDefaultPage() { + LOGGER.info("in getDefaultPage"); return defaultPage; } public void setDefaultPage(String defaultView) { + LOGGER.info("in setDefaultPage"); this.defaultPage = defaultView; } public StudyService getStudyService() { + LOGGER.info("in getStudyService"); return studyService; } public void setStudyService(StudyService studyService) { + LOGGER.info("in setStudyService"); this.studyService = studyService; } public MatrixService getMatrixService() { + LOGGER.info("in getMatrixService"); return matrixService; } public void setMatrixService(MatrixService matrixService) { + LOGGER.info("in setMatrixService"); this.matrixService = matrixService; } public MatrixRowService getMatrixRowService() { + LOGGER.info("in getMatrixRowService"); return matrixRowService; } public void setMatrixRowService(MatrixRowService matrixRowService) { + LOGGER.info("in setMatrixRowService"); this.matrixRowService = matrixRowService; } public PhyloTreeService getPhyloTreeService() { + LOGGER.info("in getPhyloTreeService"); return phyloTreeService; } public void setPhyloTreeService(PhyloTreeService phyloTreeService) { + LOGGER.info("in setPhyloTreeService"); this.phyloTreeService = phyloTreeService; } public AnalysisService getAnalysisService() { + LOGGER.info("in getAnalysisService"); return analysisService; } public void setAnalysisService(AnalysisService analysisService) { + LOGGER.info("in setAnalysisService"); this.analysisService = analysisService; } public TaxonLabelService getTaxonLabelService() { + LOGGER.info("in getTaxonLabelService"); return taxonLabelService; } public void setTaxonLabelService(TaxonLabelService taxonLabelService) { + LOGGER.info("in setTaxonLabelService"); this.taxonLabelService = taxonLabelService; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2010-01-14 16:12:34
|
Revision: 439 http://treebase.svn.sourceforge.net/treebase/?rev=439&view=rev Author: rvos Date: 2010-01-14 16:12:28 +0000 (Thu, 14 Jan 2010) Log Message: ----------- Now throws exception if access isn't granted through x-access-code Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java 2010-01-14 15:59:53 UTC (rev 438) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java 2010-01-14 16:12:28 UTC (rev 439) @@ -70,6 +70,7 @@ class NoStudySpecifiedError extends Error { } class UnknownStudyError extends Error { } + class RestrictedStudyError extends Error { } Study theStudy = null; CharacterMatrix theMatrix = null; // XXX What if it isn't a CharacterMatrix? @@ -90,6 +91,13 @@ theStudy = getStudyService().findByID(studyID); if (theStudy == null) { throw new UnknownStudyError(); } LOGGER.debug("formBackingObject found study " + theStudy); + if ( ! theStudy.isPublished() ) { + String hashedId = theStudy.getNamespacedGUID().getHashedIDString(); + String xAccessCode = request.getParameter(Constants.X_ACCESS_CODE); + if ( ! hashedId.equals(xAccessCode) ) { + throw new RestrictedStudyError(); + } + } } theTree = null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2010-01-15 13:32:14
|
Revision: 444 http://treebase.svn.sourceforge.net/treebase/?rev=444&view=rev Author: rvos Date: 2010-01-15 13:32:07 +0000 (Fri, 15 Jan 2010) Log Message: ----------- Removed early throwing of RestrictedStudyError Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java 2010-01-15 12:41:32 UTC (rev 443) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java 2010-01-15 13:32:07 UTC (rev 444) @@ -91,6 +91,7 @@ theStudy = getStudyService().findByID(studyID); if (theStudy == null) { throw new UnknownStudyError(); } LOGGER.debug("formBackingObject found study " + theStudy); + /* if ( ! theStudy.isPublished() ) { String hashedId = theStudy.getNamespacedGUID().getHashedIDString(); String xAccessCode = request.getParameter(Constants.X_ACCESS_CODE); @@ -98,6 +99,7 @@ throw new RestrictedStudyError(); } } + */ } theTree = null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2010-01-15 13:56:35
|
Revision: 445 http://treebase.svn.sourceforge.net/treebase/?rev=445&view=rev Author: rvos Date: 2010-01-15 13:56:27 +0000 (Fri, 15 Jan 2010) Log Message: ----------- Now a priori explicitly denies access to unpublished studies. Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java 2010-01-15 13:32:07 UTC (rev 444) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java 2010-01-15 13:56:27 UTC (rev 445) @@ -91,15 +91,13 @@ theStudy = getStudyService().findByID(studyID); if (theStudy == null) { throw new UnknownStudyError(); } LOGGER.debug("formBackingObject found study " + theStudy); - /* if ( ! theStudy.isPublished() ) { - String hashedId = theStudy.getNamespacedGUID().getHashedIDString(); - String xAccessCode = request.getParameter(Constants.X_ACCESS_CODE); - if ( ! hashedId.equals(xAccessCode) ) { - throw new RestrictedStudyError(); - } + // we assume access is denied, unless specifically granted! + setAuthorizationChecked(false); } - */ + else { + setAuthorizationChecked(true); + } } theTree = null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hl...@us...> - 2010-05-24 16:54:34
|
Revision: 697 http://treebase.svn.sourceforge.net/treebase/?rev=697&view=rev Author: hlapp Date: 2010-05-24 16:54:27 +0000 (Mon, 24 May 2010) Log Message: ----------- Fix for the null pointer exception in TaxonLabelByLabelComparator. Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java 2010-05-01 15:13:17 UTC (rev 696) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/SearchSummaryController.java 2010-05-24 16:54:27 UTC (rev 697) @@ -547,7 +547,11 @@ private class TaxonLabelByLabelComparator implements Comparator<TaxonLabel> { public int compare(TaxonLabel a, TaxonLabel b) { - return a.getTaxonLabel().compareTo(b.getTaxonLabel()); + String l1 = (a == null) ? "" : a.getTaxonLabel(); + String l2 = (b == null) ? "" : b.getTaxonLabel(); + if (l1 == null) l1 = ""; + if (l2 == null) l2 = ""; + return l1.compareTo(l2); } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |