X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/ad5208965b91e020b431cd9d2c1d15ff4b856450..7a81b9d2c37ceb5add5df8fe9fe48b409d971e37:/src/store/auth/auth-action.ts diff --git a/src/store/auth/auth-action.ts b/src/store/auth/auth-action.ts index 1e2620e4..d72a3ece 100644 --- a/src/store/auth/auth-action.ts +++ b/src/store/auth/auth-action.ts @@ -14,6 +14,7 @@ import { ServiceRepository } from "~/services/services"; import { getAuthorizedKeysServiceError, AuthorizedKeysServiceError } from '~/services/authorized-keys-service/authorized-keys-service'; import { KeyType, SshKeyResource } from '~/models/ssh-key'; import { User } from "~/models/user"; +import * as Routes from '~/routes/routes'; export const authActions = unionize({ SAVE_API_TOKEN: ofType(), @@ -153,9 +154,13 @@ export const createSshKey = (data: SshKeyCreateFormDialogData) => export const loadSshKeysPanel = () => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { try { - dispatch(setBreadcrumbs([{ label: 'SSH Keys'}])); + const userUuid = getState().auth.user!.uuid; + const { router } = getState(); + const pathname = router.location ? router.location.pathname : ''; + dispatch(setBreadcrumbs([{ label: 'SSH Keys' }])); const response = await services.authorizedKeysService.list(); - dispatch(authActions.SET_SSH_KEYS(response.items)); + const userSshKeys = response.items.find(it => it.ownerUuid === userUuid); + return Routes.matchSshKeysAdminRoute(pathname) ? dispatch(authActions.SET_SSH_KEYS(response.items)) : dispatch(authActions.SET_SSH_KEYS([userSshKeys!])); } catch (e) { return; }