mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-25 01:18:14 +00:00
Fix: restricted actions in insecure mode (#3073)
This commit is contained in:
parent
6c4bb1f401
commit
d959a49f8d
@ -15,6 +15,7 @@ import { Configuration } from '@azure/msal-browser';
|
|||||||
import { MsalProvider } from '@azure/msal-react';
|
import { MsalProvider } from '@azure/msal-react';
|
||||||
import { LoginCallback } from '@okta/okta-react';
|
import { LoginCallback } from '@okta/okta-react';
|
||||||
import { AxiosError, AxiosResponse } from 'axios';
|
import { AxiosError, AxiosResponse } from 'axios';
|
||||||
|
import { CookieStorage } from 'cookie-storage';
|
||||||
import { isEmpty, isNil } from 'lodash';
|
import { isEmpty, isNil } from 'lodash';
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import { UserPermissions } from 'Models';
|
import { UserPermissions } from 'Models';
|
||||||
@ -66,6 +67,7 @@ interface AuthProviderProps {
|
|||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const cookieStorage = new CookieStorage();
|
||||||
const userAPIQueryFields = 'profile,teams,roles';
|
const userAPIQueryFields = 'profile,teams,roles';
|
||||||
|
|
||||||
export const AuthProvider = ({ children }: AuthProviderProps) => {
|
export const AuthProvider = ({ children }: AuthProviderProps) => {
|
||||||
@ -150,7 +152,16 @@ export const AuthProvider = ({ children }: AuthProviderProps) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getUpdatedUser = (data: User, user: OidcUser) => {
|
const getUpdatedUser = (data: User, user: OidcUser) => {
|
||||||
const getAdminCookie = localStorage.getItem(isAdminUpdated);
|
let getAdminCookie = localStorage.getItem(isAdminUpdated);
|
||||||
|
|
||||||
|
// TODO: Remove when using cookie no more
|
||||||
|
if (!getAdminCookie) {
|
||||||
|
getAdminCookie = cookieStorage.getItem(isAdminUpdated);
|
||||||
|
if (getAdminCookie) {
|
||||||
|
localStorage.setItem(isAdminUpdated, getAdminCookie);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (getAdminCookie) {
|
if (getAdminCookie) {
|
||||||
appState.updateUserDetails(data);
|
appState.updateUserDetails(data);
|
||||||
} else {
|
} else {
|
||||||
@ -366,6 +377,10 @@ export const AuthProvider = ({ children }: AuthProviderProps) => {
|
|||||||
);
|
);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
appState.updateAuthState(isAuthDisabled);
|
||||||
|
}, [isAuthDisabled]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
return history.listen((location) => {
|
return history.listen((location) => {
|
||||||
if (!isAuthDisabled && !appState.userDetails) {
|
if (!isAuthDisabled && !appState.userDetails) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user