Skip to content
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

pkp/pkp-lib#9658 user access table #10576

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions js/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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();

Expand Down
8 changes: 8 additions & 0 deletions locale/en/userAccess.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
msgid "userAccess.tableHeader.startDate"
msgstr "Start Date"

msgid "userAccess.tableHeader.name"
msgstr "Name"

msgid "userAccess.search"
msgstr "Search User"
84 changes: 84 additions & 0 deletions pages/invitation/InvitationHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions pages/invitation/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
case 'decline':
case 'accept':
case 'invite':
case 'editUser':
return new PKP\pages\invitation\InvitationHandler();
}
3 changes: 1 addition & 2 deletions templates/management/accessUsers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}
<user-access-manager></user-access-manager>