[ARVADOS-WORKBENCH2] updated: 1.3.0-328-gf71049ee

Git user git at public.curoverse.com
Thu Jan 3 04:25:25 EST 2019


Summary of changes:
 src/store/users/users-actions.ts                   |  9 +++------
 src/views-components/user-dialog/manage-dialog.tsx | 11 +++++------
 2 files changed, 8 insertions(+), 12 deletions(-)

       via  f71049ee5bf2560fbbca09c1f141e176e1a7eb06 (commit)
      from  4ba3f6420c77ad3bc1cdd877e4f3ed12ab63ccf7 (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 f71049ee5bf2560fbbca09c1f141e176e1a7eb06
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date:   Thu Jan 3 10:25:16 2019 +0100

    refs #14565-login-as-other-user
    
    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 42406858..7ea927de 100644
--- a/src/store/users/users-actions.ts
+++ b/src/store/users/users-actions.ts
@@ -36,11 +36,8 @@ export const openUserAttributes = (uuid: string) =>
 export const openUserManagement = (uuid: string) =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
         const { resources } = getState();
-        const user = getResource<UserResource>(uuid)(resources);
-        const clients = await services.apiClientAuthorizationService.list();
-        const client = clients.items.find(it => it.ownerUuid === uuid);
-        console.log(client);
-        dispatch(dialogActions.OPEN_DIALOG({ id: USER_MANAGEMENT_DIALOG, data: { user, client } }));
+        const data = getResource<UserResource>(uuid)(resources);
+        dispatch(dialogActions.OPEN_DIALOG({ id: USER_MANAGEMENT_DIALOG, data }));
     };
 
 export const openSetupShellAccount = (uuid: string) =>
@@ -54,7 +51,7 @@ export const openSetupShellAccount = (uuid: string) =>
 
 export const loginAs = (uuid: string) =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
-        const client = await services.apiClientAuthorizationService.get(uuid);
+        const client = await services.apiClientAuthorizationService.create({ ownerUuid: uuid });
         dispatch<any>(saveApiToken(client.apiToken));
         dispatch<any>(getUserDetails()).then(() => {
             location.reload();
diff --git a/src/views-components/user-dialog/manage-dialog.tsx b/src/views-components/user-dialog/manage-dialog.tsx
index 12c5d2b6..05e4a3fc 100644
--- a/src/views-components/user-dialog/manage-dialog.tsx
+++ b/src/views-components/user-dialog/manage-dialog.tsx
@@ -10,7 +10,6 @@ import { WithStyles, withStyles } from '@material-ui/core/styles';
 import { ArvadosTheme } from '~/common/custom-theme';
 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";
 
 type CssRules = 'spacing';
@@ -47,21 +46,21 @@ export const UserManageDialog = compose(
                 onClose={props.closeDialog}
                 fullWidth
                 maxWidth="md">
-                {props.data.user &&
+                {props.data &&
                     <span>
-                        <DialogTitle>{`Manage - ${props.data.user.firstName} ${props.data.user.lastName}`}</DialogTitle>
+                        <DialogTitle>{`Manage - ${props.data.firstName} ${props.data.lastName}`}</DialogTitle>
                         <DialogContent>
                             <Typography variant='body1' 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.client.uuid)}>
-                                {`LOG IN AS ${props.data.user.firstName} ${props.data.user.lastName}`}
+                            <Button variant="contained" color="primary" onClick={() => props.loginAs(props.data.uuid)}>
+                                {`LOG IN AS ${props.data.firstName} ${props.data.lastName}`}
                             </Button>
                             <Typography variant='body1' 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.user.firstName} ${props.data.user.lastName}`}
+                                {`SETUP SHELL ACCOUNT FOR ${props.data.firstName} ${props.data.lastName}`}
                             </Button>
                         </DialogContent></span>}
 

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list