Open Journal Systems  3.3.0
ReviewRoundRequiredPolicy.inc.php
1 <?php
15 import('lib.pkp.classes.security.authorization.DataObjectRequiredPolicy');
16 
26  function __construct($request, &$args, $parameterName = 'reviewRoundId', $operations = null) {
27  parent::__construct($request, $args, $parameterName, 'user.authorization.invalidReviewRound', $operations);
28  }
29 
30  //
31  // Implement template methods from AuthorizationPolicy
32  //
36  function dataObjectEffect() {
37  // Get the review round id.
38  $reviewRoundId = $this->getDataObjectId();
39  if ($reviewRoundId === false) return AUTHORIZATION_DENY;
40 
41  // Validate the review round id.
42  $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); /* @var $reviewRoundDao ReviewRoundDAO */
43  $reviewRound = $reviewRoundDao->getById($reviewRoundId);
44  if (!is_a($reviewRound, 'ReviewRound')) return AUTHORIZATION_DENY;
45 
46  // Ensure that the review round actually belongs to the
47  // authorized submission.
48  $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
49  if ($reviewRound->getSubmissionId() != $submission->getId()) AUTHORIZATION_DENY;
50 
51  // Ensure that the review round is for this workflow stage
52  $stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE);
53  if ($reviewRound->getStageId() != $stageId) return AUTHORIZATION_DENY;
54 
55  // Save the review round to the authorization context.
56  $this->addAuthorizedContextObject(ASSOC_TYPE_REVIEW_ROUND, $reviewRound);
57  return AUTHORIZATION_PERMIT;
58  }
59 }
60 
61 
ReviewRoundRequiredPolicy\dataObjectEffect
dataObjectEffect()
Definition: ReviewRoundRequiredPolicy.inc.php:36
DAORegistry\getDAO
static & getDAO($name, $dbconn=null)
Definition: DAORegistry.inc.php:57
ReviewRoundRequiredPolicy
Policy that ensures that the request contains a valid review round.
Definition: ReviewRoundRequiredPolicy.inc.php:17
DataObjectRequiredPolicy\getDataObjectId
getDataObjectId($lookOnlyByParameterName=false)
Definition: DataObjectRequiredPolicy.inc.php:111
AuthorizationPolicy\getAuthorizedContextObject
& getAuthorizedContextObject($assocType)
Definition: AuthorizationPolicy.inc.php:117
AuthorizationPolicy\addAuthorizedContextObject
addAuthorizedContextObject($assocType, &$authorizedObject)
Definition: AuthorizationPolicy.inc.php:97
ReviewRoundRequiredPolicy\__construct
__construct($request, &$args, $parameterName='reviewRoundId', $operations=null)
Definition: ReviewRoundRequiredPolicy.inc.php:26
DataObjectRequiredPolicy
Abstract base class for policies that check for a data object from a parameter.
Definition: DataObjectRequiredPolicy.inc.php:17