diff --git a/js/load.js b/js/load.js index 1ee1f943881..28f9d4235a2 100644 --- a/js/load.js +++ b/js/load.js @@ -108,6 +108,7 @@ import ListPanel from '@/components/ListPanel/ListPanel.vue'; // Manager components import UserInvitationManager from '@/managers/UserInvitationManager/UserInvitationManager.vue'; +import UserAccessManager from '@/managers/UserAccessManager/UserAccessManager.vue'; // Helper for initializing and tracking Vue controllers import VueRegistry from './classes/VueRegistry.js'; @@ -221,6 +222,8 @@ VueRegistry.registerComponent('PkpListPanel', ListPanel); // Register Invitation Manager VueRegistry.registerComponent('UserInvitationManager', UserInvitationManager); +// Register User Access Manager +VueRegistry.registerComponent('UserAccessManager', UserAccessManager); const pinia = createPinia(); diff --git a/locale/en/userAccess.po b/locale/en/userAccess.po new file mode 100644 index 00000000000..a235ac49d00 --- /dev/null +++ b/locale/en/userAccess.po @@ -0,0 +1,8 @@ +msgid "userAccess.tableHeader.startDate" +msgstr "Start Date" + +msgid "userAccess.tableHeader.name" +msgstr "Name" + +msgid "userAccess.search" +msgstr "Search User" diff --git a/pages/invitation/InvitationHandler.php b/pages/invitation/InvitationHandler.php index 28345859a73..ee976c9a3c1 100644 --- a/pages/invitation/InvitationHandler.php +++ b/pages/invitation/InvitationHandler.php @@ -229,6 +229,90 @@ public function invite(array $args, Request $request): void $templateMgr->display('/invitation/userInvitation.tpl'); } + /** + * Edit user using user access table action + * @param $args + * @param $request + * @return void + * @throws \Exception + */ + public function editUser($args, $request): void + { + $invitation = null; + $invitationPayload =[]; + if(!empty($args)) { + $invitationMode = 'edit'; + $user = Repo::user()->get($args[0]); + $invitationPayload['userId'] = $args[0]; + $invitationPayload['inviteeEmail'] = $user->getEmail(); + $invitationPayload['orcid'] = $user->getData('orcid'); + $invitationPayload['givenName'] = $user->getGivenName(null); + $invitationPayload['familyName'] = $user->getFamilyName(null); + $invitationPayload['affiliation'] = $user->getAffiliation(null); + $invitationPayload['country'] = $user->getCountry(); + $invitationPayload['userGroupsToAdd'] = []; + $invitationPayload['currentUserGroups'] = $this->getUserUserGroups($args[0]); + $invitationPayload['userGroupsToRemove'] = []; + $invitationPayload['emailComposer'] = [ + 'emailBody' => '', + 'emailSubject' => '', + ]; + $templateMgr = TemplateManager::getManager($request); + $breadcrumbs = $templateMgr->getTemplateVars('breadcrumbs'); + $this->setupTemplate($request); + $context = $request->getContext(); + $breadcrumbs[] = [ + 'id' => 'contexts', + 'name' => __('navigation.access'), + 'url' => $request + ->getDispatcher() + ->url( + $request, + PKPApplication::ROUTE_PAGE, + $request->getContext()->getPath(), + 'management', + 'settings', + ) + ]; + $breadcrumbs[] = [ + 'id' => 'invitationWizard', + 'name' => __('invitation.wizard.pageTitle'), + ]; + $steps = new SendInvitationStep(); + $templateMgr->setState([ + 'steps' => $steps->getSteps($invitation, $context,$user), + 'emailTemplatesApiUrl' => $request + ->getDispatcher() + ->url( + $request, + Application::ROUTE_API, + $context->getData('urlPath'), + 'emailTemplates' + ), + 'primaryLocale' => $context->getData('primaryLocale'), + 'invitationType' => 'userRoleAssignment', + 'invitationPayload' => $invitationPayload, + 'invitationMode' => $invitationMode, + 'pageTitle' => + $invitationPayload['givenName'][Locale::getLocale()] . ' ' + . $invitationPayload['familyName'][Locale::getLocale()], + 'pageTitleDescription' => + __( + 'invitation.wizard.viewPageTitleDescription', + ['name' => $invitationPayload['givenName'][Locale::getLocale()]] + ), + ]); + $templateMgr->assign([ + 'pageComponent' => 'PageOJS', + 'breadcrumbs' => $breadcrumbs, + 'pageWidth' => TemplateManager::PAGE_WIDTH_FULL, + ]); + $templateMgr->display('/invitation/userInvitation.tpl'); + } else { + $request->getDispatcher()->handle404(); + } + } + /** * Get current user user groups * @param int $id diff --git a/pages/invitation/index.php b/pages/invitation/index.php index d9d964fa01f..24720f14aca 100644 --- a/pages/invitation/index.php +++ b/pages/invitation/index.php @@ -17,5 +17,6 @@ case 'decline': case 'accept': case 'invite': + case 'editUser': return new PKP\pages\invitation\InvitationHandler(); } diff --git a/templates/management/accessUsers.tpl b/templates/management/accessUsers.tpl index 5ac71f670b3..f024ceb4a25 100644 --- a/templates/management/accessUsers.tpl +++ b/templates/management/accessUsers.tpl @@ -11,5 +11,4 @@ {* Help Link *} {help file="users-and-roles" class="pkp_help_tab"} -{capture assign=usersUrl}{url router=PKP\core\PKPApplication::ROUTE_COMPONENT component="grid.settings.user.UserGridHandler" op="fetchGrid" oldUserId=$oldUserId escape=false}{/capture} -{load_url_in_div id="userGridContainer" url=$usersUrl} +