[ARVADOS-WORKBENCH2] created: 2.3.0-148-gf9d1c360
Git user
git at public.arvados.org
Mon Jan 31 21:38:05 UTC 2022
at f9d1c360e059ed07909abd7bc83a61fcd3e2746d (commit)
commit f9d1c360e059ed07909abd7bc83a61fcd3e2746d
Author: Lucas Di Pentima <lucas.dipentima at curii.com>
Date: Mon Jan 31 18:37:28 2022 -0300
17914: Replaces deprecated substr() with substring().
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>
diff --git a/src/common/app-info.ts b/src/common/app-info.ts
index de6708eb..a6e3af74 100644
--- a/src/common/app-info.ts
+++ b/src/common/app-info.ts
@@ -7,7 +7,7 @@ export const getBuildInfo = (): string => {
return "v" + process.env.REACT_APP_VERSION;
} else {
const getBuildNumber = "BN-" + (process.env.REACT_APP_BUILD_NUMBER || "dev");
- const getGitCommit = "GIT-" + (process.env.REACT_APP_GIT_COMMIT || "latest").substr(0, 7);
+ const getGitCommit = "GIT-" + (process.env.REACT_APP_GIT_COMMIT || "latest").substring(0, 7);
return getBuildNumber + " / " + getGitCommit;
}
};
diff --git a/src/common/url.ts b/src/common/url.ts
index 6d66778a..db12cb8e 100644
--- a/src/common/url.ts
+++ b/src/common/url.ts
@@ -13,7 +13,7 @@ export function normalizeURLPath(url: string) {
const u = new URL(url);
u.pathname = u.pathname.replace(/\/\//, '/');
if (u.pathname[u.pathname.length - 1] === '/') {
- u.pathname = u.pathname.substr(0, u.pathname.length - 1);
+ u.pathname = u.pathname.substring(0, u.pathname.length - 1);
}
return u.toString();
}
diff --git a/src/routes/routes.ts b/src/routes/routes.ts
index 528a0376..41c71f7c 100644
--- a/src/routes/routes.ts
+++ b/src/routes/routes.ts
@@ -68,7 +68,7 @@ export const getResourceUrl = (uuid: string) => {
export const getNavUrl = (uuid: string, config: FederationConfig) => {
const path = getResourceUrl(uuid) || "";
- const cls = uuid.substr(0, 5);
+ const cls = uuid.substring(0, 5);
if (cls === config.localCluster || extractUuidKind(uuid) === ResourceKind.USER || COLLECTION_PDH_REGEX.exec(uuid)) {
return path;
} else if (config.remoteHostsConfig[cls]) {
diff --git a/src/services/api/url-builder.ts b/src/services/api/url-builder.ts
index 32039a50..d94aab35 100644
--- a/src/services/api/url-builder.ts
+++ b/src/services/api/url-builder.ts
@@ -30,13 +30,13 @@ export function joinUrls(url0?: string, url1?: string) {
if (url0) {
let idx0 = url0.length - 1;
while (url0[idx0] === '/') { --idx0; }
- u0 = url0.substr(0, idx0 + 1);
+ u0 = url0.substring(0, idx0 + 1);
}
let u1 = "";
if (url1) {
let idx1 = 0;
while (url1[idx1] === '/') { ++idx1; }
- u1 = url1.substr(idx1);
+ u1 = url1.substring(idx1);
}
let url = u0;
if (u1.length > 0) {
diff --git a/src/services/auth-service/auth-service.ts b/src/services/auth-service/auth-service.ts
index 5b975969..548dbcaa 100644
--- a/src/services/auth-service/auth-service.ts
+++ b/src/services/auth-service/auth-service.ts
@@ -64,7 +64,7 @@ export class AuthService {
this.getStorage().setItem(API_TOKEN_KEY, token);
const sp = token.split('/');
if (sp.length === 3) {
- this.getStorage().setItem(HOME_CLUSTER, sp[1].substr(0, 5));
+ this.getStorage().setItem(HOME_CLUSTER, sp[1].substring(0, 5));
}
}
diff --git a/src/store/auth/auth-action-session.ts b/src/store/auth/auth-action-session.ts
index 2712f136..7e81f2d9 100644
--- a/src/store/auth/auth-action-session.ts
+++ b/src/store/auth/auth-action-session.ts
@@ -99,7 +99,7 @@ export const getSaltedToken = (clusterId: string, token: string) => {
throw new Error(invalidV2Token);
}
let salted = secret;
- if (uuid.substr(0, 5) !== clusterId) {
+ if (uuid.substring(0, 5) !== clusterId) {
shaObj.setHMACKey(secret, "TEXT");
shaObj.update(clusterId);
salted = shaObj.getHMAC("HEX");
diff --git a/src/store/auth/auth-reducer.ts b/src/store/auth/auth-reducer.ts
index ce836a55..c109acaf 100644
--- a/src/store/auth/auth-reducer.ts
+++ b/src/store/auth/auth-reducer.ts
@@ -79,12 +79,12 @@ export const authReducer = (services: ServiceRepository) => (state = initialStat
apiToken: token,
apiTokenExpiration: tokenExpiration,
apiTokenLocation: tokenLocation,
- homeCluster: user.uuid.substr(0, 5)
+ homeCluster: user.uuid.substring(0, 5)
}),
LOGIN: () => state,
LOGOUT: () => ({ ...state, apiToken: undefined }),
USER_DETAILS_SUCCESS: (user: User) =>
- ({ ...state, user, homeCluster: user.uuid.substr(0, 5) }),
+ ({ ...state, user, homeCluster: user.uuid.substring(0, 5) }),
SET_SSH_KEYS: (sshKeys: SshKeyResource[]) => ({ ...state, sshKeys }),
ADD_SSH_KEY: (sshKey: SshKeyResource) =>
({ ...state, sshKeys: state.sshKeys.concat(sshKey) }),
diff --git a/src/views-components/data-explorer/renderers.tsx b/src/views-components/data-explorer/renderers.tsx
index 901704d9..47c1eaa9 100644
--- a/src/views-components/data-explorer/renderers.tsx
+++ b/src/views-components/data-explorer/renderers.tsx
@@ -221,7 +221,7 @@ const renderIsHidden = (props: {
permissionLinkUuid: string,
visible: boolean,
canManage: boolean,
- setMemberIsHidden: (memberLinkUuid: string, permissionLinkUuid: string, hide: boolean) => void
+ setMemberIsHidden: (memberLinkUuid: string, permissionLinkUuid: string, hide: boolean) => void
}) => {
if (props.memberLinkUuid) {
return <Checkbox
@@ -319,7 +319,7 @@ const clusterColors = [
export const ResourceCluster = (props: { uuid: string }) => {
const CLUSTER_ID_LENGTH = 5;
const pos = props.uuid.length > CLUSTER_ID_LENGTH ? props.uuid.indexOf('-') : 5;
- const clusterId = pos >= CLUSTER_ID_LENGTH ? props.uuid.substr(0, pos) : '';
+ const clusterId = pos >= CLUSTER_ID_LENGTH ? props.uuid.substring(0, pos) : '';
const ci = pos >= CLUSTER_ID_LENGTH ? (((((
(props.uuid.charCodeAt(0) * props.uuid.charCodeAt(1))
+ props.uuid.charCodeAt(2))
diff --git a/src/views-components/main-app-bar/account-menu.tsx b/src/views-components/main-app-bar/account-menu.tsx
index 9356e077..7faf27c2 100644
--- a/src/views-components/main-app-bar/account-menu.tsx
+++ b/src/views-components/main-app-bar/account-menu.tsx
@@ -90,7 +90,7 @@ export const AccountMenuComponent =
title="Account Management"
key={currentRoute}>
<MenuItem disabled>
- {getUserDisplayName(user)} {user.uuid.substr(0, 5) !== localCluster && `(${user.uuid.substr(0, 5)})`}
+ {getUserDisplayName(user)} {user.uuid.substring(0, 5) !== localCluster && `(${user.uuid.substring(0, 5)})`}
</MenuItem>
{user.isActive && accountMenuItems}
<Divider />
diff --git a/src/views/link-account-panel/link-account-panel-root.tsx b/src/views/link-account-panel/link-account-panel-root.tsx
index eb52ba18..c5c86eb2 100644
--- a/src/views/link-account-panel/link-account-panel-root.tsx
+++ b/src/views/link-account-panel/link-account-panel-root.tsx
@@ -55,7 +55,7 @@ function displayUser(user: UserResource, showCreatedAt: boolean = false, showClu
const disp: JSX.Element[] = [];
disp.push(<span><b>{user.email}</b> ({user.username}, {user.uuid})</span>);
if (showCluster) {
- const homeCluster = user.uuid.substr(0, 5);
+ const homeCluster = user.uuid.substring(0, 5);
disp.push(<span> hosted on cluster <b>{homeCluster}</b> and </span>);
}
if (showCreatedAt) {
@@ -134,7 +134,7 @@ export const LinkAccountPanelRoot = withStyles(styles)(
This a remote account. You can link a local Arvados account to this one.
After linking, you can access the local account's data by logging into the
<b>{localCluster}</b> cluster as user <b>{targetUser.email}</b>
- from <b>{targetUser.uuid.substr(0, 5)}</b>.
+ from <b>{targetUser.uuid.substring(0, 5)}</b>.
</Grid >
<Grid item>
<Button color="primary" variant="contained" onClick={() => startLinking(LinkAccountType.ADD_LOCAL_TO_REMOTE)}>
diff --git a/src/views/my-account-panel/my-account-panel-root.tsx b/src/views/my-account-panel/my-account-panel-root.tsx
index 02a8ba67..283b9acc 100644
--- a/src/views/my-account-panel/my-account-panel-root.tsx
+++ b/src/views/my-account-panel/my-account-panel-root.tsx
@@ -68,7 +68,7 @@ type MyAccountPanelRootProps = InjectedFormProps<MyAccountPanelRootActionProps>
type LocalClusterProp = { localCluster: string };
const renderField: React.ComponentType<WrappedFieldProps & LocalClusterProp> = ({ input, localCluster }) => (
- <span>{localCluster === input.value.substr(0, 5) ? "" : "federated"} user {input.value}</span>
+ <span>{localCluster === input.value.substring(0, 5) ? "" : "federated"} user {input.value}</span>
);
export const MyAccountPanelRoot = withStyles(styles)(
diff --git a/src/views/search-results-panel/search-results-panel-view.tsx b/src/views/search-results-panel/search-results-panel-view.tsx
index 5d6b580b..45181410 100644
--- a/src/views/search-results-panel/search-results-panel-view.tsx
+++ b/src/views/search-results-panel/search-results-panel-view.tsx
@@ -106,7 +106,7 @@ export const searchResultsPanelColumns: DataColumns<string> = [
export const SearchResultsPanelView = withStyles(styles, { withTheme: true })(
(props: SearchResultsPanelProps & WithStyles<CssRules, true>) => {
- const homeCluster = props.user.uuid.substr(0, 5);
+ const homeCluster = props.user.uuid.substring(0, 5);
const loggedIn = props.sessions.filter((ss) => ss.loggedIn && ss.userIsActive);
return <span data-cy='search-results'><DataExplorer
id={SEARCH_RESULTS_PANEL_ID}
commit ee3ec96e1241b4cc3afe99da3d9ea86bb784dc5f
Author: Lucas Di Pentima <lucas.dipentima at curii.com>
Date: Mon Jan 31 18:27:57 2022 -0300
17914: Fixes regression introduced in ticket 17568.
Ticket 17568 fixed a token expiration display issue. Still, it introduced
a problem on peer federations because the code attempts to use the salted token
to query the home cluster, which isn't an authorized operation.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>
diff --git a/src/store/auth/auth-action.ts b/src/store/auth/auth-action.ts
index c7074704..d58a8103 100644
--- a/src/store/auth/auth-action.ts
+++ b/src/store/auth/auth-action.ts
@@ -86,9 +86,15 @@ export const saveApiToken = (token: string) => async (dispatch: Dispatch, getSta
const auth = getState().auth;
config = dispatch<any>(getConfig);
- // If federated token, get user & token data from the token issuing cluster
- if (tokenParts.length === 3 && tokenParts[1].substring(0, 5) !== auth.localCluster) {
- config = await getRemoteHostConfig(auth.remoteHosts[tokenParts[1].substring(0, 5)]);
+ // If the token is from a LoginCluster federation, get user & token data
+ // from the token issuing cluster.
+ const lc = (config as Config).loginCluster
+ const tokenCluster = tokenParts.length === 3
+ ? tokenParts[1].substring(0, 5)
+ : undefined;
+ if (tokenCluster && tokenCluster !== auth.localCluster &&
+ lc && lc === tokenCluster) {
+ config = await getRemoteHostConfig(auth.remoteHosts[tokenCluster]);
}
const svc = createServices(config, { progressFn: () => { }, errorFn: () => { } });
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list