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

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

00001 <?php
00014 import('lib.pkp.classes.security.authorization.DataObjectRequiredPolicy');
00015 
00016 class ReviewAssignmentRequiredPolicy extends DataObjectRequiredPolicy {
00024    function ReviewAssignmentRequiredPolicy(&$request, &$args, $parameterName = 'reviewAssignmentId', $operations = null) {
00025       parent::DataObjectRequiredPolicy($request, $args, $parameterName, 'user.authorization.invalidReviewAssignment', $operations);
00026    }
00027 
00028    //
00029    // Implement template methods from AuthorizationPolicy
00030    //
00034    function dataObjectEffect() {
00035       $reviewId = (int)$this->getDataObjectId();
00036       if (!$reviewId) return AUTHORIZATION_DENY;
00037 
00038       $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); /* @var $reviewAssignmentDao ReviewAssignmentDAO */
00039       $reviewAssignment =& $reviewAssignmentDao->getById($reviewId);
00040       if (!is_a($reviewAssignment, 'ReviewAssignment')) return AUTHORIZATION_DENY;
00041 
00042       // Ensure that the review assignment actually belongs to the
00043       // authorized monograph.
00044       $monograph =& $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH);
00045       if ($reviewAssignment->getSubmissionId() != $monograph->getId()) AUTHORIZATION_DENY;
00046 
00047       // Ensure that the review assignment is for this workflow stage
00048       $stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE);
00049       if ($reviewAssignment->getStageId() != $stageId) return AUTHORIZATION_DENY;
00050 
00051       // Save the review Assignment to the authorization context.
00052       $this->addAuthorizedContextObject(ASSOC_TYPE_REVIEW_ASSIGNMENT, $reviewAssignment);
00053       return AUTHORIZATION_PERMIT;
00054    }
00055 }
00056 
00057 ?>

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