|
6 | 6 | */ |
7 | 7 |
|
8 | 8 | import { Env, GsLangUser, GsTheme } from '@gridsuite/commons-ui'; |
9 | | -import { User } from 'oidc-client'; |
10 | 9 | import { APP_NAME, getAppName, PARAM_LANGUAGE, PARAM_THEME } from './config-params'; |
11 | 10 | import { store } from '../redux/store'; |
12 | 11 | import ReconnectingWebSocket, { Event } from 'reconnecting-websocket'; |
@@ -114,30 +113,6 @@ export function backendFetchJson(url: Url, init?: InitRequest, token?: Token): P |
114 | 113 | return backendFetch(url, init, token).then((safeResponse: Response) => safeResponse.json()); |
115 | 114 | } |
116 | 115 |
|
117 | | -export function fetchValidateUser(user: User): Promise<boolean> { |
118 | | - const sub = user?.profile?.sub; |
119 | | - if (!sub) { |
120 | | - return Promise.reject(new Error(`Error : Fetching access for missing user.profile.sub : ${user}`)); |
121 | | - } |
122 | | - |
123 | | - console.info(`Fetching access for user...`); |
124 | | - const CheckAccessUrl = `${PREFIX_USER_ADMIN_SERVER_QUERIES}/v1/users/${sub}`; |
125 | | - console.debug(CheckAccessUrl); |
126 | | - |
127 | | - return backendFetch(CheckAccessUrl, { method: 'head' }, user?.id_token) |
128 | | - .then((response: Response) => { |
129 | | - //if the response is ok, the responseCode will be either 200 or 204 otherwise it's a Http error and it will be caught |
130 | | - return response.status === 200; |
131 | | - }) |
132 | | - .catch((error) => { |
133 | | - if (error.status === 403) { |
134 | | - return false; |
135 | | - } else { |
136 | | - throw error; |
137 | | - } |
138 | | - }); |
139 | | -} |
140 | | - |
141 | 116 | export type EnvJson = Env & typeof import('../../public/env.json'); |
142 | 117 |
|
143 | 118 | function fetchEnv(): Promise<EnvJson> { |
|
0 commit comments