diff --git a/api/v1/_dois/BackendDoiController.php b/api/v1/_dois/BackendDoiController.php index 1d06d8dfcb5..ff4f7c385a1 100644 --- a/api/v1/_dois/BackendDoiController.php +++ b/api/v1/_dois/BackendDoiController.php @@ -24,6 +24,7 @@ use Illuminate\Support\Facades\Route; use Illuminate\Support\LazyCollection; use PKP\db\DAORegistry; +use PKP\userGroup\UserGroup; class BackendDoiController extends \PKP\API\v1\_dois\PKPBackendDoiController { @@ -145,9 +146,7 @@ public function editIssue(Request $illuminateRequest): JsonResponse protected function getUserGroups(int $contextId): LazyCollection { - return Repo::userGroup()->getCollector() - ->filterByContextIds([$contextId]) - ->getMany(); + return UserGroup::where('contextId', $contextId)->get(); } protected function getGenres(int $contextId): array diff --git a/api/v1/issues/IssueController.php b/api/v1/issues/IssueController.php index 593d3b45d4f..63c6627f441 100644 --- a/api/v1/issues/IssueController.php +++ b/api/v1/issues/IssueController.php @@ -36,6 +36,7 @@ use PKP\security\authorization\UserRolesRequiredPolicy; use PKP\security\Role; use PKP\submission\GenreDAO; +use PKP\userGroup\UserGroup; class IssueController extends PKPBaseController { @@ -268,9 +269,8 @@ public function get(Request $illuminateRequest): JsonResponse protected function getUserGroups(int $contextId): LazyCollection { - return Repo::userGroup()->getCollector() - ->filterByContextIds([$contextId]) - ->getMany(); + return UserGroup::where('contextId', $contextId)->get(); + } protected function getGenres(int $contextId): array diff --git a/classes/search/ArticleSearch.php b/classes/search/ArticleSearch.php index 7d25044fd42..d8f0ba22e07 100644 --- a/classes/search/ArticleSearch.php +++ b/classes/search/ArticleSearch.php @@ -28,6 +28,7 @@ use PKP\plugins\Hook; use PKP\search\SubmissionSearch; use PKP\submission\PKPSubmission; +use PKP\userGroup\UserGroup; class ArticleSearch extends SubmissionSearch { @@ -77,7 +78,8 @@ public function getSparseArray($unorderedResults, $orderBy, $orderDir, $exclude) } $i = 0; // Used to prevent ties from clobbering each other - $authorUserGroups = Repo::userGroup()->getCollector()->filterByRoleIds([\PKP\security\Role::ROLE_ID_AUTHOR])->getMany(); + $authorUserGroups = UserGroup::where('roleId', \PKP\security\Role::ROLE_ID_AUTHOR)->get(); + foreach ($unorderedResults as $submissionId => $data) { // Exclude unwanted IDs. if (in_array($submissionId, $exclude)) { diff --git a/classes/submission/Submission.php b/classes/submission/Submission.php index d908ec2208d..71862a5821e 100644 --- a/classes/submission/Submission.php +++ b/classes/submission/Submission.php @@ -28,6 +28,7 @@ use APP\publication\Publication; use PKP\facades\Locale; use PKP\submission\PKPSubmission; +use PKP\userGroup\UserGroup; class Submission extends PKPSubmission { @@ -69,7 +70,7 @@ public function _getContextLicenseFieldValue($locale, $field, $publication = nul $publication = $this->getCurrentPublication(); } - $authorUserGroups = Repo::userGroup()->getCollector()->filterByRoleIds([\PKP\security\Role::ROLE_ID_AUTHOR])->filterByContextIds([$context->getId()])->getMany(); + $authorUserGroups = UserGroup::where('roleId', \PKP\security\Role::ROLE_ID_AUTHOR)->where('contextId', $context->getId())->get(); $fieldValue = [$context->getPrimaryLocale() => $publication->getAuthorString($authorUserGroups)]; break; case 'context': diff --git a/controllers/grid/users/subscriberSelect/SubscriberSelectGridHandler.php b/controllers/grid/users/subscriberSelect/SubscriberSelectGridHandler.php index bf7d57978df..f452e9373e3 100644 --- a/controllers/grid/users/subscriberSelect/SubscriberSelectGridHandler.php +++ b/controllers/grid/users/subscriberSelect/SubscriberSelectGridHandler.php @@ -25,6 +25,7 @@ use PKP\controllers\grid\users\userSelect\UserSelectGridCellProvider; use PKP\security\authorization\ContextAccessPolicy; use PKP\security\Role; +use PKP\userGroup\UserGroup; class SubscriberSelectGridHandler extends GridHandler { @@ -65,13 +66,17 @@ public function initialize($request, $args = null) parent::initialize($request, $args); $stageId = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_WORKFLOW_STAGE); - $userGroups = Repo::userGroup()->getUserGroupsByStage( - $request->getContext()->getId(), - $stageId - ); + $contextId = $request->getContext()->getId(); + + $userGroups = UserGroup::where('contextId', $contextId) + ->whereHas('userGroupStages', function ($query) use ($stageId) { + $query->where('stageId', $stageId); + }) + ->get(); + $this->_userGroupOptions = []; foreach ($userGroups as $userGroup) { - $this->_userGroupOptions[$userGroup->getId()] = $userGroup->getLocalizedName(); + $this->_userGroupOptions[$userGroup->id] = $userGroup->getLocalizedData('name'); } $this->setTitle('editor.submission.findAndSelectUser'); @@ -95,7 +100,8 @@ public function initialize($request, $args = null) null, null, $cellProvider, - ['alignment' => GridColumn::COLUMN_ALIGNMENT_LEFT, + [ + 'alignment' => GridColumn::COLUMN_ALIGNMENT_LEFT, 'width' => 30 ] ) @@ -146,16 +152,12 @@ protected function loadData($request, $filter) */ public function renderFilter($request, $filterData = []) { - $context = $request->getContext(); - $userGroups = Repo::userGroup()->getCollector() - ->filterByContextIds([$context->getId()]) - ->getMany(); + $contextId = $request->getContext()->getId(); + $userGroups = UserGroup::where('contextId', $contextId)->get(); - $userGroupOptions = ['' => __('grid.user.allRoles')]; foreach ($userGroups as $userGroup) { - $userGroupOptions[$userGroup->getId()] = $userGroup->getLocalizedName(); + $userGroupOptions[$userGroup->id] = $userGroup->getLocalizedData('name'); } - return parent::renderFilter( $request, [ diff --git a/pages/article/ArticleHandler.php b/pages/article/ArticleHandler.php index a40ad52ec32..3d83184a361 100644 --- a/pages/article/ArticleHandler.php +++ b/pages/article/ArticleHandler.php @@ -42,6 +42,7 @@ use PKP\submission\GenreDAO; use PKP\submission\PKPSubmission; use PKP\submissionFile\SubmissionFile; +use PKP\userGroup\UserGroup; use stdClass; class ArticleHandler extends Handler @@ -286,7 +287,9 @@ public function view($args, $request) $templateMgr->assign([ 'primaryGalleys' => $primaryGalleys, 'supplementaryGalleys' => $supplementaryGalleys, - 'userGroupsById' => Repo::userGroup()->getCollector()->filterByPublicationIds([$this->publication->getId()])->getMany()->toArray() + 'userGroupsById' => UserGroup::withPublicationIds([$this->publication->getId()]) + ->get() + ->toArray() ]); // Citations diff --git a/pages/issue/IssueHandler.php b/pages/issue/IssueHandler.php index 8b2cd2aeca9..570d7fb2715 100644 --- a/pages/issue/IssueHandler.php +++ b/pages/issue/IssueHandler.php @@ -41,6 +41,7 @@ use PKP\security\Validation; use PKP\submission\GenreDAO; use PKP\submission\PKPSubmission; +use PKP\userGroup\UserGroup; class IssueHandler extends Handler { @@ -390,7 +391,9 @@ public static function _setupIssueTemplate(Request $request, Issue $issue, ?Jour $issueSubmissionsInSection[$sectionId]['articles'][] = $submission; } - $authorUserGroups = Repo::userGroup()->getCollector()->filterByRoleIds([\PKP\security\Role::ROLE_ID_AUTHOR])->filterByContextIds([$journal->getId()])->getMany()->remember(); + $authorUserGroups = UserGroup::withRoleIds([\PKP\security\Role::ROLE_ID_AUTHOR]) + ->withContextIds([$journal->getId()]) + ->get(); $templateMgr->assign([ 'issue' => $issue, 'issueGalleys' => $issueGalleyDao->getByIssueId($issue->getId()), diff --git a/pages/search/SearchHandler.php b/pages/search/SearchHandler.php index 2010a9bff7b..bc03769917b 100644 --- a/pages/search/SearchHandler.php +++ b/pages/search/SearchHandler.php @@ -21,6 +21,7 @@ use APP\search\ArticleSearch; use APP\security\authorization\OjsJournalMustPublishPolicy; use APP\template\TemplateManager; +use PKP\userGroup\UserGroup; class SearchHandler extends Handler { @@ -160,16 +161,17 @@ public function search($args, $request) $this->_assignSearchFilters($request, $templateMgr, $searchFilters); [$orderBy, $orderDir] = $articleSearch->getResultSetOrdering($request); + $authorUserGroups = UserGroup::withRoleIds([\PKP\security\Role::ROLE_ID_AUTHOR]) + ->withContextIds($searchFilters['searchJournal'] ? [$searchFilters['searchJournal']->getId()] : null) + ->get(); + $templateMgr->assign([ 'orderBy' => $orderBy, 'orderDir' => $orderDir, 'simDocsEnabled' => true, 'results' => $results, 'error' => $error, - 'authorUserGroups' => Repo::userGroup()->getCollector() - ->filterByRoleIds([\PKP\security\Role::ROLE_ID_AUTHOR]) - ->filterByContextIds($searchFilters['searchJournal'] ? [$searchFilters['searchJournal']->getId()] : null) - ->getMany()->remember(), + 'authorUserGroups' => $authorUserGroups, 'searchResultOrderOptions' => $articleSearch->getResultSetOrderingOptions($request), 'searchResultOrderDirOptions' => $articleSearch->getResultSetOrderingDirectionOptions(), ]); diff --git a/plugins/generic/citationStyleLanguage b/plugins/generic/citationStyleLanguage index 90ea703be70..785b41361fa 160000 --- a/plugins/generic/citationStyleLanguage +++ b/plugins/generic/citationStyleLanguage @@ -1 +1 @@ -Subproject commit 90ea703be706dd5ca6f86993bdb4e6d7be1de53b +Subproject commit 785b41361facd699507a8fa01e876f3a5bd5ec80 diff --git a/plugins/generic/webFeed b/plugins/generic/webFeed index 12c9e93d53e..9c35c3b28b5 160000 --- a/plugins/generic/webFeed +++ b/plugins/generic/webFeed @@ -1 +1 @@ -Subproject commit 12c9e93d53ead5f22c3ad6979667f3affe1fb80f +Subproject commit 9c35c3b28b5bc1e542270376ef055cd5ce51ae35 diff --git a/plugins/reports/articles/ArticleReportPlugin.php b/plugins/reports/articles/ArticleReportPlugin.php index e3a419a496e..90e2c63839d 100644 --- a/plugins/reports/articles/ArticleReportPlugin.php +++ b/plugins/reports/articles/ArticleReportPlugin.php @@ -28,6 +28,7 @@ use PKP\submission\SubmissionDisciplineDAO; use PKP\submission\SubmissionKeywordDAO; use PKP\submission\SubmissionSubjectDAO; +use PKP\userGroup\UserGroup; class ArticleReportPlugin extends ReportPlugin { @@ -90,15 +91,12 @@ public function display($args, $request) $submissionDisciplineDao = DAORegistry::getDAO('SubmissionDisciplineDAO'); /** @var SubmissionDisciplineDAO $submissionDisciplineDao */ $submissionAgencyDao = DAORegistry::getDAO('SubmissionAgencyDAO'); /** @var SubmissionAgencyDAO $submissionAgencyDao */ - $userGroups = Repo::userGroup()->getCollector() - ->filterByContextIds([$context->getId()]) - ->getMany() - ->toArray(); + $userGroups = UserGroup::withContextIds([$context->getId()])->get()->toArray(); $editorUserGroupIds = array_map(function ($userGroup) { - return $userGroup->getId(); + return $userGroup->id; }, array_filter($userGroups, function ($userGroup) { - return in_array($userGroup->getRoleId(), [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR]); + return in_array($userGroup->roleId, [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR]); })); // Load the data from the database and store it in an array.