[ARVADOS-WORKBENCH2] updated: 1.3.0-266-g80925b51
Git user
git at public.curoverse.com
Thu Dec 27 08:24:32 EST 2018
Summary of changes:
src/store/users/users-actions.ts | 16 ++++++++--------
src/views-components/user-dialog/manage-dialog.tsx | 16 ++++++++++------
2 files changed, 18 insertions(+), 14 deletions(-)
via 80925b518233f7ef75615917a1e3503b2e9a7874 (commit)
from 7a3531ac6ea4794e44d5218b37792eb286416d75 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 80925b518233f7ef75615917a1e3503b2e9a7874
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date: Thu Dec 27 14:24:16 2018 +0100
refs #14565-login-as-someone-proper-uuid
Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
diff --git a/src/store/users/users-actions.ts b/src/store/users/users-actions.ts
index 334800d4..b7944524 100644
--- a/src/store/users/users-actions.ts
+++ b/src/store/users/users-actions.ts
@@ -34,10 +34,11 @@ export const openUserAttributes = (uuid: string) =>
};
export const openUserManagement = (uuid: string) =>
- (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+ async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
const { resources } = getState();
- const data = getResource<UserResource>(uuid)(resources);
- dispatch(dialogActions.OPEN_DIALOG({ id: USER_MANAGEMENT_DIALOG, data }));
+ const user = getResource<UserResource>(uuid)(resources);
+ const clients = await services.apiClientAuthorizationService.list();
+ dispatch(dialogActions.OPEN_DIALOG({ id: USER_MANAGEMENT_DIALOG, data: { user, ...clients } }));
};
export const openSetupShellAccount = (uuid: string) =>
@@ -49,11 +50,10 @@ export const openSetupShellAccount = (uuid: string) =>
dispatch(dialogActions.OPEN_DIALOG({ id: SETUP_SHELL_ACCOUNT_DIALOG, data: { user, ...virtualMachines } }));
};
-export const loginAs = (createdAt: string) =>
+export const loginAs = (uuid: string) =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- const clients = await services.apiClientAuthorizationService.list();
- const client = clients.items.find(it => it.createdAt === createdAt);
- dispatch<any>(saveApiToken(client!.apiToken));
+ const client = await services.apiClientAuthorizationService.get(uuid);
+ dispatch<any>(saveApiToken(client.apiToken));
dispatch<any>(getUserDetails()).then(() => {
location.reload();
dispatch<any>(navigateToRootProject);
@@ -132,4 +132,4 @@ export const loadUsersData = () =>
export const loadUsersPanel = () =>
(dispatch: Dispatch) => {
dispatch(userBindedActions.REQUEST_ITEMS());
- };
\ No newline at end of file
+ };
diff --git a/src/views-components/user-dialog/manage-dialog.tsx b/src/views-components/user-dialog/manage-dialog.tsx
index 59779928..5b69dcbe 100644
--- a/src/views-components/user-dialog/manage-dialog.tsx
+++ b/src/views-components/user-dialog/manage-dialog.tsx
@@ -12,6 +12,7 @@ import { compose, Dispatch } from "redux";
import { USER_MANAGEMENT_DIALOG, openSetupShellAccount, loginAs } from "~/store/users/users-actions";
import { UserResource } from "~/models/user";
import { connect } from "react-redux";
+import { ApiClientAuthorization } from '~/models/api-client-authorization';
type CssRules = 'spacing';
@@ -23,7 +24,10 @@ const styles = withStyles<CssRules>((theme: ArvadosTheme) => ({
}));
interface UserManageDataProps {
- data: UserResource;
+ data: {
+ user: UserResource;
+ client: ApiClientAuthorization;
+ };
}
interface UserManageActionProps {
@@ -47,19 +51,19 @@ export const UserManageDialog = compose(
onClose={props.closeDialog}
fullWidth
maxWidth="md">
- <DialogTitle>{`Manage - ${props.data.firstName} ${props.data.lastName}`}</DialogTitle>
+ <DialogTitle>{`Manage - ${props.data.user.firstName} ${props.data.user.lastName}`}</DialogTitle>
<DialogContent>
<Typography variant="body2" className={props.classes.spacing}>
As an admin, you can log in as this user. When you’ve finished, you will need to log out and log in again with your own account.
</Typography>
- <Button variant="contained" color="primary" onClick={() => props.loginAs(props.data.createdAt)}>
- {`LOG IN AS ${props.data.firstName} ${props.data.lastName}`}
+ <Button variant="contained" color="primary" onClick={() => props.loginAs(props.data.client.uuid)}>
+ {`LOG IN AS ${props.data.user.firstName} ${props.data.user.lastName}`}
</Button>
<Typography variant="body2" className={props.classes.spacing}>
As an admin, you can setup a shell account for this user. The login name is automatically generated from the user's e-mail address.
</Typography>
- <Button variant="contained" color="primary" onClick={() => props.openSetupShellAccount(props.data.uuid)}>
- {`SETUP SHELL ACCOUNT FOR ${props.data.firstName} ${props.data.lastName}`}
+ <Button variant="contained" color="primary" onClick={() => props.openSetupShellAccount(props.data.user.uuid)}>
+ {`SETUP SHELL ACCOUNT FOR ${props.data.user.firstName} ${props.data.user.lastName}`}
</Button>
</DialogContent>
<DialogActions>
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list