add authentik api get users
This commit is contained in:
parent
143ea888c8
commit
35a4f29f07
18 changed files with 223 additions and 81 deletions
|
|
@ -9,7 +9,7 @@ import { useApps } from 'src/services/apps';
|
|||
|
||||
const navigation = [
|
||||
{ name: 'Users', to: '/users', requiresAdmin: true },
|
||||
{ name: 'Apps', to: '/apps', requiresAdmin: true },
|
||||
// { name: 'Apps', to: '/apps', requiresAdmin: true },
|
||||
];
|
||||
|
||||
function classNames(...classes: any[]) {
|
||||
|
|
@ -33,8 +33,6 @@ const HeaderLIT: React.FC<HeaderProps> = () => {
|
|||
const { pathname } = useLocation();
|
||||
const { apps } = useApps();
|
||||
const navigationItems = filterNavigationByDashboardRole(isAdmin);
|
||||
console.log(isAdmin);
|
||||
console.log(navigationItems);
|
||||
|
||||
const signOutUrl = useMemo(() => {
|
||||
// @ts-ignore
|
||||
|
|
@ -86,9 +84,9 @@ const HeaderLIT: React.FC<HeaderProps> = () => {
|
|||
key={item.name}
|
||||
to={item.to}
|
||||
className={clsx(
|
||||
'border-primary-50 text-gray-900 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium',
|
||||
'border-primary-50 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium litbutton',
|
||||
{
|
||||
'border-primary-500 text-gray-500 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 text-sm font-medium':
|
||||
'border-primary-500 litbutton-active hover:border-gray-300 inline-flex items-center px-1 pt-1 text-sm font-medium':
|
||||
pathname.includes(item.to),
|
||||
},
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -53,6 +53,11 @@ export const Users: React.FC = () => {
|
|||
|
||||
const columns: any = React.useMemo(
|
||||
() => [
|
||||
{
|
||||
Header: 'Username',
|
||||
accessor: 'preferredUsername',
|
||||
width: 'auto',
|
||||
},
|
||||
{
|
||||
Header: 'Name',
|
||||
accessor: 'name',
|
||||
|
|
@ -75,11 +80,12 @@ export const Users: React.FC = () => {
|
|||
|
||||
if (isAdmin) {
|
||||
return (
|
||||
<div className="text-right lg:opacity-0 group-hover:opacity-100 transition-opacity">
|
||||
<div className="text-right lg:opacity-0 transition-opacity">
|
||||
<button
|
||||
disabled
|
||||
onClick={() => configureModalOpen(row.original.id)}
|
||||
type="button"
|
||||
className="inline-flex items-center px-4 py-2 border border-gray-200 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500"
|
||||
className="inline-flex items-center px-4 py-2 border border-gray-200 shadow-sm text-sm font-medium rounded-md text-gray bg-gray hover:bg-gray focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500"
|
||||
>
|
||||
<CogIcon className="-ml-0.5 mr-2 h-4 w-4" aria-hidden="true" />
|
||||
Configure
|
||||
|
|
@ -109,17 +115,19 @@ export const Users: React.FC = () => {
|
|||
{isAdmin && (
|
||||
<div className="mt-3 sm:mt-0 sm:ml-4">
|
||||
<button
|
||||
disabled
|
||||
onClick={() => configureModalOpen(null)}
|
||||
type="button"
|
||||
className="inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-primary-700 hover:bg-primary-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-800 mx-5 "
|
||||
className="inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-gray-200 hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-800 mx-5 "
|
||||
>
|
||||
<PlusIcon className="-ml-0.5 mr-2 h-4 w-4" aria-hidden="true" />
|
||||
Add new user
|
||||
</button>
|
||||
<button
|
||||
disabled
|
||||
onClick={() => setMultipleUsersModal(true)}
|
||||
type="button"
|
||||
className="inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-primary-700 hover:bg-primary-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-800"
|
||||
className="inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-gray-200 hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-800"
|
||||
>
|
||||
<ViewGridAddIcon className="-ml-0.5 mr-2 h-4 w-4" aria-hidden="true" />
|
||||
Add new users
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ export const signIn = (params: string) =>
|
|||
);
|
||||
|
||||
export function signOut() {
|
||||
return async (dispatch: any) => {
|
||||
return (dispatch: any) => {
|
||||
dispatch(signOutAction());
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ export const getCurrentUser = (state: State) => state.auth.userInfo;
|
|||
export const getIsAdmin = (state: State) => {
|
||||
// check since old users wont have this
|
||||
if (state.auth.userInfo) {
|
||||
console.log(state.auth.userInfo);
|
||||
if (!state.auth.userInfo.app_roles) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue