/** * @see DataObjectRequiredPolicy::dataObjectEffect() */ function dataObjectEffect() { $publishedMonographId = $this->getDataObjectId(); if (!$publishedMonographId) { return AUTHORIZATION_DENY; } // Make sure the published monographs belongs to the press. $publishedMonographDao = DAORegistry::getDAO('PublishedMonographDAO'); $publishedMonograph = $publishedMonographDao->getByBestId($publishedMonographId, $this->context->getId()); if (!is_a($publishedMonograph, 'PublishedMonograph')) { return AUTHORIZATION_DENY; } // Save the published monograph to the authorization context. $this->addAuthorizedContextObject(ASSOC_TYPE_PUBLISHED_MONOGRAPH, $publishedMonograph); return AUTHORIZATION_PERMIT; }
/** * Determines whether or not this user can expedite this submission. * @param User $user * @param Context $context */ function canExpedite($user, $context) { $userGroupAssignmentDao = DAORegistry::getDAO('UserGroupAssignmentDAO'); $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); $userGroupAssignments = $userGroupAssignmentDao->getByUserId($user->getId(), $context->getId()); if (!$userGroupAssignments->wasEmpty()) { while ($userGroupAssignment = $userGroupAssignments->next()) { $userGroup = $userGroupDao->getById($userGroupAssignment->getUserGroupId()); if (in_array($userGroup->getRoleId(), array(ROLE_ID_MANAGER, ROLE_ID_SUB_EDITOR))) { return true; } } } return false; }