-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Merge pull request #2298 from KelvinTegelaar/dev"
- Loading branch information
1 parent
e3cb141
commit 043b6d3
Showing
22 changed files
with
1,297 additions
and
2,073 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
5.4.1 | ||
5.4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import React from 'react' | ||
|
||
const CIPPSettings = React.lazy(() => import('src/views/cipp/app-settings/CIPPSettings')) | ||
const Setup = React.lazy(() => import('src/views/cipp/Setup')) | ||
const ApplyStandard = React.lazy(() => import('src/views/tenant/standards/ListStandards')) | ||
const GDAPStatus = React.lazy(() => import('src/views/tenant/administration/ListGDAPQueue')) | ||
const GDAP = React.lazy(() => import('src/views/tenant/administration/GDAPWizard')) | ||
const GDAPInvite = React.lazy(() => import('src/views/tenant/administration/GDAPInviteWizard')) | ||
const GDAPRoleWizard = React.lazy(() => import('src/views/tenant/administration/GDAPRoleWizard')) | ||
const GDAPRoles = React.lazy(() => import('src/views/tenant/administration/ListGDAPRoles')) | ||
const GDAPRelationships = React.lazy(() => | ||
import('./views/tenant/administration/ListGDAPRelationships'), | ||
) | ||
const appapproval = React.lazy(() => import('src/views/cipp/AppApproval')) | ||
const TenantOffboardingWizard = React.lazy(() => | ||
import('src/views/tenant/administration/TenantOffboardingWizard'), | ||
) | ||
const TenantOnboardingWizard = React.lazy(() => | ||
import('src/views/tenant/administration/TenantOnboardingWizard'), | ||
) | ||
|
||
const adminRoutes = [ | ||
{ path: '/cipp', name: 'CIPP' }, | ||
{ path: '/cipp/cipp', name: 'CIPP' }, | ||
{ path: '/cipp/settings', name: 'Settings', component: CIPPSettings }, | ||
{ path: '/cipp/setup', name: 'Setup', component: Setup }, | ||
|
||
{ path: '/tenant/administration/gdap', name: 'GDAP Wizard', component: GDAP }, | ||
{ | ||
path: '/tenant/administration/gdap-invite', | ||
name: 'GDAP Invite Wizard', | ||
component: GDAPInvite, | ||
}, | ||
{ | ||
path: '/tenant/administration/gdap-role-wizard', | ||
name: 'GDAP Role Wizard', | ||
component: GDAPRoleWizard, | ||
}, | ||
{ | ||
path: '/tenant/administration/gdap-roles', | ||
name: 'GDAP Roles', | ||
component: GDAPRoles, | ||
}, | ||
{ | ||
path: '/tenant/administration/gdap-relationships', | ||
name: 'GDAP Relationships', | ||
component: GDAPRelationships, | ||
}, | ||
{ | ||
path: '/tenant/administration/appapproval', | ||
name: 'App Approval', | ||
component: appapproval, | ||
}, | ||
{ | ||
path: '/tenant/administration/gdap-status', | ||
name: 'GDAP Status', | ||
component: GDAPStatus, | ||
}, | ||
{ | ||
path: '/tenant/standards/list-standards', | ||
name: 'List Standard', | ||
component: ApplyStandard, | ||
}, | ||
{ | ||
path: '/tenant/administration/tenant-offboarding-wizard', | ||
name: 'Tenant Offboarding', | ||
component: TenantOffboardingWizard, | ||
}, | ||
{ | ||
path: '/tenant/administration/tenant-onboarding-wizard', | ||
name: 'Tenant Onboarding', | ||
component: TenantOnboardingWizard, | ||
}, | ||
] | ||
|
||
export default adminRoutes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,41 @@ | ||
import React from 'react' | ||
import { Navigate } from 'react-router-dom' | ||
import { useLoadClientPrincipalQuery } from 'src/store/api/auth' | ||
import { FullScreenLoading } from 'src/components/utilities' | ||
import { useDispatch } from 'react-redux' | ||
import { updateAccessToken } from 'src/store/features/auth' | ||
import PropTypes from 'prop-types' | ||
import { useAuthCheck } from './CippauthCheck' | ||
|
||
export const PrivateRoute = ({ children, allowedRoles }) => { | ||
const { isLoading, component: authComponent } = useAuthCheck(allowedRoles) | ||
if (isLoading) { | ||
export const PrivateRoute = ({ children, routeType }) => { | ||
const dispatch = useDispatch() | ||
const { data: profile, error, isFetching } = useLoadClientPrincipalQuery() | ||
//console.log() | ||
if (isFetching) { | ||
return <FullScreenLoading /> | ||
} | ||
if (authComponent) { | ||
return authComponent | ||
|
||
dispatch(updateAccessToken(profile)) | ||
let roles = null | ||
if (null !== profile?.clientPrincipal) { | ||
roles = profile?.clientPrincipal.userRoles | ||
} else if (null === profile?.clientPrincipal) { | ||
return <Navigate to={`/login?redirect_uri=${window.location.href}`} /> | ||
} | ||
if (null === roles) { | ||
return <Navigate to={`/login?redirect_uri=${window.location.href}`} /> | ||
} else { | ||
const isAuthenticated = | ||
roles.includes('admin') || roles.includes('editor') || (roles.includes('readonly') && !error) | ||
const isAdmin = roles.includes('admin') | ||
if (routeType === 'admin') { | ||
return !isAdmin ? <Navigate to="/403" /> : children | ||
} else { | ||
return !isAuthenticated ? <Navigate to="/403" /> : children | ||
} | ||
} | ||
return children | ||
} | ||
|
||
PrivateRoute.propTypes = { | ||
children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]).isRequired, | ||
allowedRoles: PropTypes.arrayOf(PropTypes.string), | ||
children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]), | ||
routeType: PropTypes.string, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.