Commit 9a2dabf7 authored by Axel Bocciarelli's avatar Axel Bocciarelli
Browse files

Don't show sample tracking features to anonymous users

parent dd1f182b
Pipeline #31961 passed with stage
in 3 minutes and 17 seconds
......@@ -93,6 +93,9 @@ function App() {
);
}
const isSampleTrackingEnabled =
UI.sampleTracking.enabled && !user.isAnonymous;
return (
<Switch>
<Route
......@@ -124,10 +127,10 @@ function App() {
<Route exact path="/closed" component={ClosedDataPage} />
<Route exact path="/beamline/:id" component={BeamlineDataPage} />
{UI.sampleTracking.enabled && (
{isSampleTrackingEnabled && (
<Route exact path="/parcels" component={MyParcelsPage} />
)}
{UI.sampleTracking.enabled && (
{isSampleTrackingEnabled && (
<Route exact path="/addresses" component={AddressesPage} />
)}
......@@ -155,7 +158,7 @@ function App() {
path="/investigation/:investigationId/events"
component={EventsPage}
/>
{UI.sampleTracking.enabled && (
{isSampleTrackingEnabled && (
<Route
exact
path="/investigation/:investigationId/shipping"
......
......@@ -131,7 +131,7 @@ function Menu() {
</LinkContainer>
)}
{UI.sampleTracking.enabled && (
{UI.sampleTracking.enabled && !user.isAnonymous && (
<NavDropdown
eventKey={3}
title="Shipping"
......
......@@ -7,6 +7,7 @@ import UI from '../../config/ui/config';
function TabContainerMenu(props) {
const { doi } = props;
const { isAnonymous } = useSelector((state) => state.user);
const datasetCount = useSelector((state) => state.datasets.data.length);
const { investigationId } = useParams();
......@@ -33,7 +34,7 @@ function TabContainerMenu(props) {
</NavItem>
</LinkContainer>
{UI.sampleTracking.enabled && (
{UI.sampleTracking.enabled && !isAnonymous && (
<>
<LinkContainer to={`${routePrefix}/shipping`}>
<NavItem eventKey="shipping" href="">
......
......@@ -13,6 +13,7 @@ const initialState = {
expirationTime: null,
fullName: null,
name: null,
isAnonymous: false,
isAdministrator: false,
isAuthenticating: false,
isSessionExpired: false,
......@@ -39,8 +40,9 @@ const user = (state = initialState, action) => {
expirationTime: moment()
.add(action.lifeTimeMinutes, 'minutes')
.format(),
fullName: action.fullName,
name: action.name,
fullName: action.fullName,
isAnonymous: action.fullName === 'Anonymous',
isAdministrator: action.isAdministrator,
};
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment