Skip to content

pkp/pkp-lib#11297 Update the code to retrieve discussions on the submission list the same way it's done at the submission page #11300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: stable-3_3_0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion classes/services/PKPSubmissionService.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
use \PKP\Services\interfaces\EntityReadInterface;
use \PKP\Services\interfaces\EntityWriteInterface;
use \APP\Services\QueryBuilders\SubmissionQueryBuilder;
use \QueriesAccessHelper;

define('STAGE_STATUS_SUBMISSION_UNASSIGNED', 1);

Expand Down Expand Up @@ -413,13 +414,25 @@ public function getPropertyStages($submission, $stageIds = null) {
// Discussions in this stage
$stage['queries'] = array();
$request = Application::get()->getRequest();
$user = $request->getUser();
import('lib.pkp.controllers.grid.queries.QueriesAccessHelper');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe to move this line closer to the line with new QueriesAccessHelper() ?

$router = $request->getRouter();
$handler = $router->getHandler();
$handler->getAuthorizedContext()[ASSOC_TYPE_ACCESSIBLE_WORKFLOW_STAGES] = Services::get('user')->getAccessibleWorkflowStages(
$user->getId(),
$contextId,
$submission,
$handler->getAuthorizedContextObject(ASSOC_TYPE_USER_ROLES)
);

$accessHelper = new QueriesAccessHelper($handler->getAuthorizedContext(), $request->getUser());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use $user instead of $request->getUser() here

import('lib.pkp.classes.query.QueryDAO');
$queryDao = DAORegistry::getDAO('QueryDAO'); /* @var $queryDao QueryDAO */
$queries = $queryDao->getByAssoc(
ASSOC_TYPE_SUBMISSION,
$submission->getId(),
$stageId,
$request->getUser()->getId() // Current user restriction should prevent unauthorized access
$accessHelper->getCanListAll($stageId) ? null : $user->getId() // Current user restriction should prevent unauthorized access
);

while ($query = $queries->next()) {
Expand Down