diff --git a/classes/security/authorization/UserRolesRequiredPolicy.php b/classes/security/authorization/UserRolesRequiredPolicy.php index 8f5acf5e032..ec4497cd503 100644 --- a/classes/security/authorization/UserRolesRequiredPolicy.php +++ b/classes/security/authorization/UserRolesRequiredPolicy.php @@ -18,7 +18,7 @@ use APP\core\Application; use APP\core\Request; -use APP\facades\Repo; +use PKP\userGroup\UserGroup; class UserRolesRequiredPolicy extends AuthorizationPolicy { @@ -53,10 +53,10 @@ public function effect() } $context = $request->getRouter()->getContext($request); - $userGroups = Repo::userGroup()->getCollector() - ->filterByUserIds([$user->getId()]) - ->filterByContextIds($context ? [$context->getId(), Application::SITE_CONTEXT_ID] : [Application::SITE_CONTEXT_ID]) - ->getMany()->toArray(); + $userGroups = UserGroup::withUserIds([$user->getId()]) + ->withContextIds($context ? [$context->getId(), Application::SITE_CONTEXT_ID] : [Application::SITE_CONTEXT_ID]) + ->get() + ->toArray(); $roleIds = array_map(fn ($userGroup) => $userGroup->getRoleId(), $userGroups); $this->addAuthorizedContextObject(Application::ASSOC_TYPE_USER_ROLES, $roleIds); diff --git a/classes/user/form/RolesForm.php b/classes/user/form/RolesForm.php index 0a8520d3e43..7f5752b4165 100644 --- a/classes/user/form/RolesForm.php +++ b/classes/user/form/RolesForm.php @@ -17,7 +17,6 @@ namespace PKP\user\form; use APP\core\Application; -use APP\facades\Repo; use APP\template\TemplateManager; use PKP\user\InterestManager; use PKP\user\User; @@ -46,7 +45,6 @@ public function fetch($request, $template = null, $display = false) $userGroupIds = UserGroup::getIdsByUserId($request->getUser()->getId()); - $templateMgr->assign('userGroupIds', $userGroupIds); $userFormHelper = new UserFormHelper();