Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
SeriesEditorSubmissionRequiredPolicy.inc.php
1 <?php
16 import('lib.pkp.classes.security.authorization.DataObjectRequiredPolicy');
17 
25  function SeriesEditorSubmissionRequiredPolicy($request, &$args, $submissionParameterName = 'submissionId', $operations = null) {
26  parent::DataObjectRequiredPolicy($request, $args, $submissionParameterName, 'user.authorization.invalidSeriesEditorSubmission', $operations);
27  }
28 
29  //
30  // Implement template methods from DataObjectRequiredPolicy
31  //
35  function dataObjectEffect() {
36  // Get the monograph id.
37  $monographId = $this->getDataObjectId();
38  if ($monographId === false) return AUTHORIZATION_DENY;
39 
40  // Validate the monograph id.
41  $seriesEditorSubmissionDao = DAORegistry::getDAO('SeriesEditorSubmissionDAO');
42  $seriesEditorSubmission = $seriesEditorSubmissionDao->getById($monographId);
43  if (!is_a($seriesEditorSubmission, 'SeriesEditorSubmission')) return AUTHORIZATION_DENY;
44 
45  // Validate that this monograph belongs to the current press.
46  $press = $this->_request->getPress();
47  if ($press->getId() !== $seriesEditorSubmission->getPressId()) return AUTHORIZATION_DENY;
48 
49  // Save the monograph to the authorization context.
50  $this->addAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH, $seriesEditorSubmission);
51  return AUTHORIZATION_PERMIT;
52  }
53 }
54 
55 ?>
static & getDAO($name, $dbconn=null)
Abstract base class for policies that check for a data object from a parameter.
Policy that ensures that the request contains a valid series editor submission.
addAuthorizedContextObject($assocType, &$authorizedObject)
SeriesEditorSubmissionRequiredPolicy($request, &$args, $submissionParameterName= 'submissionId', $operations=null)