• Main Page
  • Modules
  • Classes
  • Files
  • File List

classes/security/authorization/internal/MonographFileRequestedRevisionRequiredPolicy.inc.php

00001 <?php
00016 import('classes.security.authorization.internal.MonographFileBaseAccessPolicy');
00017 
00018 class MonographFileRequestedRevisionRequiredPolicy extends MonographFileBaseAccessPolicy {
00023    function MonographFileRequestedRevisionRequiredPolicy(&$request, $fileIdAndRevision = null) {
00024       parent::MonographFileBaseAccessPolicy($request, $fileIdAndRevision);
00025    }
00026 
00027 
00028    //
00029    // Implement template methods from AuthorizationPolicy
00030    //
00034    function effect() {
00035       $request =& $this->getRequest();
00036       $reviewRoundDao =& DAORegistry::getDAO('ReviewRoundDAO'); /* @var $reviewRoundDao ReviewRoundDAO */
00037 
00038       // Get the monograph file.
00039       $monographFile =& $this->getMonographFile($request);
00040       if (!is_a($monographFile, 'MonographFile')) return AUTHORIZATION_DENY;
00041 
00042       // Make sure the file belongs to the monograph in request.
00043       $monograph =& $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH);
00044       if (!is_a($monograph, 'Monograph')) return AUTHORIZATION_DENY;
00045       if ($monograph->getId() != $monographFile->getSubmissionId()) return AUTHORIZATION_DENY;
00046 
00047       // Make sure the file is part of a review round
00048       // with a requested revision decision.
00049       $reviewRound =& $reviewRoundDao->getByMonographFileId($monographFile->getFileId());
00050       if (!is_a($reviewRound, 'ReviewRound')) return AUTHORIZATION_DENY;
00051       import('classes.workflow.EditorDecisionActionsManager');
00052       if (!EditorDecisionActionsManager::getEditorTakenActionInReviewRound($reviewRound, array(SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS))) {
00053          return AUTHORIZATION_DENY;
00054       }
00055 
00056       // Make sure that it's in the review stage.
00057       $reviewRound =& $reviewRoundDao->getByMonographFileId($monographFile->getFileId());
00058       if (!is_a($reviewRound, 'ReviewRound')) return AUTHORIZATION_DENY;
00059 
00060       // Make sure review round stage is the same of the current stage in request.
00061       $stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE);
00062       if ($reviewRound->getStageId() != $stageId) return AUTHORIZATION_DENY;
00063 
00064       // Make sure that the last review round editor decision is request revisions.
00065       $seriesEditorSubmissionDao =& DAORegistry::getDAO('SeriesEditorSubmissionDAO'); /* @var $seriesEditorSubmissionDao SeriesEditorSubmissionDAO */
00066       $reviewRoundDecisions = $seriesEditorSubmissionDao->getEditorDecisions($monographFile->getMonographId(), $reviewRound->getStageId(), $reviewRound->getRound());
00067       if (empty($reviewRoundDecisions)) return AUTHORIZATION_DENY;
00068       $lastEditorDecision = array_pop($reviewRoundDecisions);
00069       if ($lastEditorDecision['decision'] != SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS) return AUTHORIZATION_DENY;
00070 
00071       // Made it through -- permit access.
00072       return AUTHORIZATION_PERMIT;
00073    }
00074 }
00075 
00076 ?>

Generated on Mon Sep 17 2012 13:58:55 for Open Monograph Press by  doxygen 1.7.1