mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-22 16:08:13 +00:00
fixed issue:- 4481 Unable to select role and Team even if auth is disabled (#4482)
This commit is contained in:
parent
d57c3343cf
commit
a81c8db8be
@ -140,6 +140,7 @@ const mockProp = {
|
||||
postFeedHandler: postFeed,
|
||||
isAdminUser: false,
|
||||
isLoggedinUser: false,
|
||||
isAuthDisabled: true,
|
||||
updateUserDetails,
|
||||
};
|
||||
|
||||
|
@ -94,6 +94,7 @@ const Users = ({
|
||||
updateUserDetails,
|
||||
isAdminUser,
|
||||
isLoggedinUser,
|
||||
isAuthDisabled,
|
||||
}: Props) => {
|
||||
const [activeTab, setActiveTab] = useState(1);
|
||||
const [fieldListVisible, setFieldListVisible] = useState<boolean>(false);
|
||||
@ -322,7 +323,7 @@ const Users = ({
|
||||
</Fragment>
|
||||
);
|
||||
|
||||
if (!isAdminUser) {
|
||||
if (!isAdminUser && !isAuthDisabled) {
|
||||
return (
|
||||
<Fragment>
|
||||
<div className="tw-flex">
|
||||
@ -435,7 +436,7 @@ const Users = ({
|
||||
</Fragment>
|
||||
);
|
||||
|
||||
if (!isAdminUser) {
|
||||
if (!isAdminUser && !isAuthDisabled) {
|
||||
return (
|
||||
<Fragment>
|
||||
<div className="tw-flex">
|
||||
|
@ -39,6 +39,7 @@ export interface Props {
|
||||
isFeedLoading: boolean;
|
||||
isAdminUser: boolean;
|
||||
isLoggedinUser: boolean;
|
||||
isAuthDisabled: boolean;
|
||||
updateUserDetails: (data: UserDetails) => void;
|
||||
feedFilterHandler: (v: FeedFilter) => void;
|
||||
fetchFeedHandler: (filterType: FeedFilter, after?: string) => void;
|
||||
|
@ -19,6 +19,7 @@ import { EntityThread } from 'Models';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import AppState from '../../AppState';
|
||||
import { useAuthContext } from '../../authentication/auth-provider/AuthProvider';
|
||||
import { getFeedsWithFilter, postFeedById } from '../../axiosAPIs/feedsAPI';
|
||||
import { getUserByName, updateUserDetail } from '../../axiosAPIs/userAPI';
|
||||
import PageContainerV1 from '../../components/containers/PageContainerV1';
|
||||
@ -40,6 +41,7 @@ import { showErrorToast } from '../../utils/ToastUtils';
|
||||
const UserPage = () => {
|
||||
const { username } = useParams<{ [key: string]: string }>();
|
||||
const { isAdminUser } = useAuth();
|
||||
const { isAuthDisabled } = useAuthContext();
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const [userData, setUserData] = useState<User>({} as User);
|
||||
const [isError, setIsError] = useState(false);
|
||||
@ -194,6 +196,7 @@ const UserPage = () => {
|
||||
feedFilterHandler={feedFilterHandler}
|
||||
fetchFeedHandler={getFeedData}
|
||||
isAdminUser={Boolean(isAdminUser)}
|
||||
isAuthDisabled={Boolean(isAuthDisabled)}
|
||||
isFeedLoading={isFeedLoading}
|
||||
isLoggedinUser={isLoggedinUser(username)}
|
||||
paging={paging}
|
||||
|
@ -91,6 +91,14 @@ const mockUserData = {
|
||||
],
|
||||
};
|
||||
|
||||
jest.mock('../../authentication/auth-provider/AuthProvider', () => {
|
||||
return {
|
||||
useAuthContext: jest.fn(() => ({
|
||||
isAuthDisabled: true,
|
||||
})),
|
||||
};
|
||||
});
|
||||
|
||||
jest.mock('react-router-dom', () => ({
|
||||
useParams: jest.fn().mockImplementation(() => ({ username: 'xyz' })),
|
||||
}));
|
||||
|
Loading…
x
Reference in New Issue
Block a user