[ARVADOS-WORKBENCH2] updated: 1.3.0-331-g8df09b8e

Git user git at public.curoverse.com
Thu Jan 3 08:27:16 EST 2019


Summary of changes:
 src/services/auth-service/auth-service.ts |  4 ++--
 src/store/users/users-actions.ts          | 11 +++++++----
 2 files changed, 9 insertions(+), 6 deletions(-)

       via  8df09b8ee52974e5bcd5fea862c3639f54afb54b (commit)
      from  1b36bef0eadb1ee358e0ab7bf53e13cb6b7ed812 (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 8df09b8ee52974e5bcd5fea862c3639f54afb54b
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date:   Thu Jan 3 14:27:06 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/services/auth-service/auth-service.ts b/src/services/auth-service/auth-service.ts
index 8601e208..6fe27c8d 100644
--- a/src/services/auth-service/auth-service.ts
+++ b/src/services/auth-service/auth-service.ts
@@ -2,7 +2,7 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { getUserFullname, User, UserPrefs } from "~/models/user";
+import { getUserFullname, User, UserPrefs, UserResource } from '~/models/user';
 import { AxiosInstance } from "axios";
 import { ApiActions } from "~/services/api/api-actions";
 import * as uuid from "uuid/v4";
@@ -77,7 +77,7 @@ export class AuthService {
             : undefined;
     }
 
-    public saveUser(user: User) {
+    public saveUser(user: User | UserResource) {
         localStorage.setItem(USER_EMAIL_KEY, user.email);
         localStorage.setItem(USER_FIRST_NAME_KEY, user.firstName);
         localStorage.setItem(USER_LAST_NAME_KEY, user.lastName);
diff --git a/src/store/users/users-actions.ts b/src/store/users/users-actions.ts
index eec1ebbd..066aa80b 100644
--- a/src/store/users/users-actions.ts
+++ b/src/store/users/users-actions.ts
@@ -51,12 +51,15 @@ export const openSetupShellAccount = (uuid: string) =>
 
 export const loginAs = (uuid: string) =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        const { resources } = getState();
+        const data = getResource<UserResource>(uuid)(resources);
+        if (data) {
+            services.authService.saveUser(data);
+        }
         const client = await services.apiClientAuthorizationService.create({ ownerUuid: uuid });
         dispatch<any>(saveApiToken(`v2/${client.uuid}/${client.apiToken}`));
-        await location.reload();
-        dispatch<any>(getUserDetails()).then(() => {
-            dispatch<any>(navigateToRootProject);
-        });
+        location.reload();
+        dispatch<any>(navigateToRootProject);
     };
 
 export const openUserCreateDialog = () =>

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list