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
00030
00034 function effect() {
00035 $request =& $this->getRequest();
00036 $reviewRoundDao =& DAORegistry::getDAO('ReviewRoundDAO');
00037
00038
00039 $monographFile =& $this->getMonographFile($request);
00040 if (!is_a($monographFile, 'MonographFile')) return AUTHORIZATION_DENY;
00041
00042
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
00048
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
00057 $reviewRound =& $reviewRoundDao->getByMonographFileId($monographFile->getFileId());
00058 if (!is_a($reviewRound, 'ReviewRound')) return AUTHORIZATION_DENY;
00059
00060
00061 $stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE);
00062 if ($reviewRound->getStageId() != $stageId) return AUTHORIZATION_DENY;
00063
00064
00065 $seriesEditorSubmissionDao =& DAORegistry::getDAO('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
00072 return AUTHORIZATION_PERMIT;
00073 }
00074 }
00075
00076 ?>