[ARVADOS-WORKBENCH2] updated: 2.1.0-204-g211054b9

Git user git at public.arvados.org
Wed Feb 17 20:54:54 UTC 2021


Summary of changes:
 src/store/auth/auth-action.ts                      |  2 ++
 src/store/token-dialog/token-dialog-actions.tsx    | 15 +++++++++++----
 src/views-components/token-dialog/token-dialog.tsx |  4 ++--
 3 files changed, 15 insertions(+), 6 deletions(-)

       via  211054b9494b034611467321203618d8fbdf05e2 (commit)
      from  1d7fbccb64462c349ea223df3ac02817ba60bfe1 (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 211054b9494b034611467321203618d8fbdf05e2
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Wed Feb 17 17:53:05 2021 -0300

    16848: Always use wb2 token when LoginCluster is set and isn't the home cluster
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/src/store/auth/auth-action.ts b/src/store/auth/auth-action.ts
index 49a82b95..fb94746f 100644
--- a/src/store/auth/auth-action.ts
+++ b/src/store/auth/auth-action.ts
@@ -99,7 +99,9 @@ export const saveApiToken = (token: string) => (dispatch: Dispatch, getState: ()
 export const getNewExtraToken = () =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
         const user = getState().auth.user;
+        const loginCluster = getState().auth.config.clusterConfig.Login.LoginCluster;
         if (user === undefined) { return; }
+        if (loginCluster !== "" && getState().auth.homeCluster !== loginCluster) { return; }
         try {
             // Do not show errors on the create call, cluster security configuration may not
             // allow token creation and there's no way to know that from workbench2 side in advance.
diff --git a/src/store/token-dialog/token-dialog-actions.tsx b/src/store/token-dialog/token-dialog-actions.tsx
index 656f532b..2cf573bc 100644
--- a/src/store/token-dialog/token-dialog-actions.tsx
+++ b/src/store/token-dialog/token-dialog-actions.tsx
@@ -13,14 +13,21 @@ const API_HOST_PROPERTY_NAME = 'apiHost';
 export interface TokenDialogData {
     token: string;
     apiHost: string;
+    canCreateNewTokens: boolean;
 }
 
 export const setTokenDialogApiHost = (apiHost: string) =>
     propertiesActions.SET_PROPERTY({ key: API_HOST_PROPERTY_NAME, value: apiHost });
 
-export const getTokenDialogData = (state: RootState): TokenDialogData => ({
-    apiHost: getProperty<string>(API_HOST_PROPERTY_NAME)(state.properties) || '',
-    token: state.auth.extraApiToken || state.auth.apiToken || '',
-});
+export const getTokenDialogData = (state: RootState): TokenDialogData => {
+    const loginCluster = state.auth.config.clusterConfig.Login.LoginCluster;
+    const canCreateNewTokens = !(loginCluster !== "" && state.auth.homeCluster !== loginCluster);
+
+    return {
+        apiHost: getProperty<string>(API_HOST_PROPERTY_NAME)(state.properties) || '',
+        token: state.auth.extraApiToken || state.auth.apiToken || '',
+        canCreateNewTokens,
+    };
+};
 
 export const openTokenDialog = dialogActions.OPEN_DIALOG({ id: TOKEN_DIALOG_NAME, data: {} });
diff --git a/src/views-components/token-dialog/token-dialog.tsx b/src/views-components/token-dialog/token-dialog.tsx
index 063bb2a5..5bbcaf57 100644
--- a/src/views-components/token-dialog/token-dialog.tsx
+++ b/src/views-components/token-dialog/token-dialog.tsx
@@ -121,7 +121,7 @@ unset ARVADOS_API_HOST_INSECURE`
                         COPY TO CLIPBOARD
                     </Button>
                 </CopyToClipboard>
-                <Button
+                { this.props.canCreateNewTokens && <Button
                     onClick={() => this.onGetNewToken()}
                     color="primary"
                     size="small"
@@ -129,7 +129,7 @@ unset ARVADOS_API_HOST_INSECURE`
                     className={classes.actionButton}
                 >
                     GET NEW TOKEN
-                </Button>
+                </Button> }
                 <Typography >
                     Arvados
                             <a href='http://doc.arvados.org/user/reference/api-tokens.html' target='blank' className={classes.link}>virtual machines</a>

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list