Open Journal Systems  3.3.0
AssignedStageRoleHandlerOperationPolicy.inc.php
1 <?php
16 import('lib.pkp.classes.security.authorization.RoleBasedHandlerOperationPolicy');
17 
19 
21  var $_stageId;
22 
34  function __construct($request, $roles, $operations, $stageId,
35  $message = 'user.authorization.assignedStageRoleBasedAccessDenied',
36  $allRoles = false) {
37  parent::__construct($request, $roles, $operations, $message, $allRoles);
38 
39  $this->_stageId = $stageId;
40  }
41 
42  //
43  // Implement template methods from AuthorizationPolicy
44  //
48  function effect() {
49  // Check whether the user has one of the allowed roles
50  // assigned. If that's the case we'll permit access.
51  // Get user roles grouped by context.
52  $userRoles = $this->getAuthorizedContextObject(ASSOC_TYPE_ACCESSIBLE_WORKFLOW_STAGES);
53  if (empty($userRoles) || empty($userRoles[$this->_stageId])) return AUTHORIZATION_DENY;
54 
55  if (!$this->_checkUserRoleAssignment($userRoles[$this->_stageId])) return AUTHORIZATION_DENY;
56  if (!$this->_checkOperationWhitelist()) return AUTHORIZATION_DENY;
57 
58  return AUTHORIZATION_PERMIT;
59  }
60 }
61 
62 
RoleBasedHandlerOperationPolicy\_checkUserRoleAssignment
_checkUserRoleAssignment($userRoles)
Definition: RoleBasedHandlerOperationPolicy.inc.php:90
AssignedStageRoleHandlerOperationPolicy\effect
effect()
Definition: AssignedStageRoleHandlerOperationPolicy.inc.php:51
AssignedStageRoleHandlerOperationPolicy\__construct
__construct($request, $roles, $operations, $stageId, $message='user.authorization.assignedStageRoleBasedAccessDenied', $allRoles=false)
Definition: AssignedStageRoleHandlerOperationPolicy.inc.php:37
AssignedStageRoleHandlerOperationPolicy
Class to control access to handler operations based on assigned role(s) in a submission's workflow st...
Definition: AssignedStageRoleHandlerOperationPolicy.inc.php:18
AuthorizationPolicy\getAuthorizedContextObject
& getAuthorizedContextObject($assocType)
Definition: AuthorizationPolicy.inc.php:117
HandlerOperationPolicy\_checkOperationWhitelist
_checkOperationWhitelist()
Definition: HandlerOperationPolicy.inc.php:80
AssignedStageRoleHandlerOperationPolicy\$_stageId
$_stageId
Definition: AssignedStageRoleHandlerOperationPolicy.inc.php:24
RoleBasedHandlerOperationPolicy
Class to control access to handler operations via role based access control.
Definition: RoleBasedHandlerOperationPolicy.inc.php:18