_reviewRoundId = $reviewRoundId; } } // // Implement template methods from AuthorizationPolicy // /** * @see DataObjectRequiredPolicy::dataObjectEffect() */ public function dataObjectEffect() { // Get the review round id. if (!$this->_reviewRoundId) { $this->_reviewRoundId = $this->getDataObjectId(); } if ($this->_reviewRoundId === false) { return AuthorizationPolicy::AUTHORIZATION_DENY; } // Validate the review round id. $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); /** @var ReviewRoundDAO $reviewRoundDao */ $reviewRound = $reviewRoundDao->getById($this->_reviewRoundId); if (!$reviewRound instanceof ReviewRound) { return AuthorizationPolicy::AUTHORIZATION_DENY; } // Ensure that the review round actually belongs to the // authorized submission. $submission = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_SUBMISSION); if ($reviewRound->getSubmissionId() != $submission->getId()) { return AuthorizationPolicy::AUTHORIZATION_DENY; } // Ensure that the review round is for this workflow stage $stageId = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_WORKFLOW_STAGE); if ($reviewRound->getStageId() != $stageId) { return AuthorizationPolicy::AUTHORIZATION_DENY; } // Save the review round to the authorization context. $this->addAuthorizedContextObject(Application::ASSOC_TYPE_REVIEW_ROUND, $reviewRound); return AuthorizationPolicy::AUTHORIZATION_PERMIT; } } if (!PKP_STRICT_MODE) { class_alias('\PKP\security\authorization\internal\ReviewRoundRequiredPolicy', '\ReviewRoundRequiredPolicy'); }