[ Mini Kiebo ]
Server: Windows NT AKFAR_SERVER 10.0 build 26200 (Windows 10) AMD64
Path:
D:
/
Jurnal PSCP
/
lib
/
pkp
/
classes
/
security
/
authorization
/
internal
/
[
Home
]
File: ManagerRequiredPolicy.inc.php
<?php /** * @file classes/security/authorization/internal/ManagerRequiredPolicy.inc.php * * Copyright (c) 2014-2021 Simon Fraser University * Copyright (c) 2000-2021 John Willinsky * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. * * @class ManagerRequiredPolicy * @ingroup security_authorization_internal * * @brief Class to prevent access unless a manager is assigned to the stage. * * NB: This policy expects a previously authorized submission and a stage id * in the authorization context. */ import('lib.pkp.classes.security.authorization.AuthorizationPolicy'); class ManagerRequiredPolicy extends AuthorizationPolicy { /** @var PKPRequest */ var $_request; /** * Constructor * @param $request PKPRequest */ function __construct($request) { parent::__construct('user.authorization.managerRequired'); $this->_request = $request; } // // Implement template methods from AuthorizationPolicy // /** * @see AuthorizationPolicy::effect() */ function effect() { // Get the submission $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION); if (!is_a($submission, 'Submission')) return AUTHORIZATION_DENY; // Get the stage $stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE); if (!is_numeric($stageId)) return AUTHORIZATION_DENY; $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); /* @var $stageAssignmentDao StageAssignmentDAO */ if ($stageAssignmentDao->editorAssignedToStage($submission->getId(), $stageId)) { return AUTHORIZATION_PERMIT; } else { return AUTHORIZATION_DENY; } } }