Commit c421f54e authored by Oleksii Savran's avatar Oleksii Savran

Merge branch '241-login-redirects' into 'master'

Login redirects

Closes #241

See merge request genesys-pgr/genesys-ui!247
parents 8c2204de bc3ae23e
...@@ -2,7 +2,7 @@ import Loadable from 'utilities/CustomReactLoadable'; ...@@ -2,7 +2,7 @@ import Loadable from 'utilities/CustomReactLoadable';
import steps from 'datasets/ui/dashboard/dataset-stepper/steps'; import steps from 'datasets/ui/dashboard/dataset-stepper/steps';
import { ROLE_ADMINISTRATOR, ROLE_USER } from 'constants/userRoles'; import {ROLE_ADMINISTRATOR, ROLE_VETTEDUSER} from 'constants/userRoles';
const publicRoutes = [ const publicRoutes = [
{ {
...@@ -48,7 +48,7 @@ const dashboardRoutes = [ ...@@ -48,7 +48,7 @@ const dashboardRoutes = [
loader: () => import(/* webpackMode:"lazy", webpackChunkName: "datasets" */'datasets/ui/dashboard/DashboardPage'), loader: () => import(/* webpackMode:"lazy", webpackChunkName: "datasets" */'datasets/ui/dashboard/DashboardPage'),
}), }),
exact: true, exact: true,
auth: [ROLE_USER, ROLE_ADMINISTRATOR], auth: [ROLE_VETTEDUSER, ROLE_ADMINISTRATOR],
extraProps: { extraProps: {
title: 'My Dashboard', title: 'My Dashboard',
}, },
...@@ -58,7 +58,7 @@ const dashboardRoutes = [ ...@@ -58,7 +58,7 @@ const dashboardRoutes = [
component: Loadable({ component: Loadable({
loader: () => import(/* webpackMode:"lazy", webpackChunkName: "datasets" */'datasets/ui/dashboard/StepperPage'), loader: () => import(/* webpackMode:"lazy", webpackChunkName: "datasets" */'datasets/ui/dashboard/StepperPage'),
}), }),
auth: [ROLE_USER, ROLE_ADMINISTRATOR], auth: [ROLE_VETTEDUSER, ROLE_ADMINISTRATOR],
extraProps: { extraProps: {
title: 'datasets.dashboard.p.stepper.publisher', title: 'datasets.dashboard.p.stepper.publisher',
}, },
...@@ -77,7 +77,7 @@ const dashboardRoutes = [ ...@@ -77,7 +77,7 @@ const dashboardRoutes = [
component: Loadable({ component: Loadable({
loader: () => import(/* webpackMode:"lazy", webpackChunkName: "datasets" */'datasets/ui/dashboard/StepperPage'), loader: () => import(/* webpackMode:"lazy", webpackChunkName: "datasets" */'datasets/ui/dashboard/StepperPage'),
}), }),
auth: [ROLE_USER, ROLE_ADMINISTRATOR], auth: [ROLE_VETTEDUSER, ROLE_ADMINISTRATOR],
extraProps: { extraProps: {
title: 'datasets.dashboard.p.stepper.publisher', title: 'datasets.dashboard.p.stepper.publisher',
}, },
......
...@@ -2,7 +2,7 @@ import Loadable from 'utilities/CustomReactLoadable'; ...@@ -2,7 +2,7 @@ import Loadable from 'utilities/CustomReactLoadable';
import steps from 'descriptorlists/ui/dashboard/descriptorlist-stepper/steps'; import steps from 'descriptorlists/ui/dashboard/descriptorlist-stepper/steps';
import { ROLE_ADMINISTRATOR, ROLE_USER } from 'constants/userRoles'; import {ROLE_ADMINISTRATOR, ROLE_VETTEDUSER} from 'constants/userRoles';
const publicRoutes = [ const publicRoutes = [
...@@ -37,7 +37,7 @@ const dashboardRoutes = [ ...@@ -37,7 +37,7 @@ const dashboardRoutes = [
component: Loadable({ component: Loadable({
loader: () => import(/* webpackMode:"lazy", webpackChunkName: "descriptorlists" */'descriptorlists/ui/dashboard/DashboardPage'), loader: () => import(/* webpackMode:"lazy", webpackChunkName: "descriptorlists" */'descriptorlists/ui/dashboard/DashboardPage'),
}), }),
auth: [ROLE_USER, ROLE_ADMINISTRATOR], auth: [ROLE_VETTEDUSER, ROLE_ADMINISTRATOR],
extraProps: { extraProps: {
title: 'My Dashboard', title: 'My Dashboard',
}, },
...@@ -48,7 +48,7 @@ const dashboardRoutes = [ ...@@ -48,7 +48,7 @@ const dashboardRoutes = [
loader: () => import(/* webpackMode:"lazy", webpackChunkName: "descriptorlists" */'descriptorlists/ui/dashboard/descriptorlist-stepper/StepperPage'), loader: () => import(/* webpackMode:"lazy", webpackChunkName: "descriptorlists" */'descriptorlists/ui/dashboard/descriptorlist-stepper/StepperPage'),
}), }),
exact: true, exact: true,
auth: [ROLE_USER, ROLE_ADMINISTRATOR], auth: [ROLE_VETTEDUSER, ROLE_ADMINISTRATOR],
extraProps: { extraProps: {
title: 'Descriptor list publisher', title: 'Descriptor list publisher',
}, },
...@@ -67,7 +67,7 @@ const dashboardRoutes = [ ...@@ -67,7 +67,7 @@ const dashboardRoutes = [
component: Loadable({ component: Loadable({
loader: () => import(/* webpackMode:"lazy", webpackChunkName: "descriptorlists" */'descriptorlists/ui/dashboard/descriptorlist-stepper/StepperPage'), loader: () => import(/* webpackMode:"lazy", webpackChunkName: "descriptorlists" */'descriptorlists/ui/dashboard/descriptorlist-stepper/StepperPage'),
}), }),
auth: [ROLE_USER, ROLE_ADMINISTRATOR], auth: [ROLE_VETTEDUSER, ROLE_ADMINISTRATOR],
extraProps: { extraProps: {
title: 'Descriptor list publisher', title: 'Descriptor list publisher',
}, },
......
import Loadable from 'utilities/CustomReactLoadable'; import Loadable from 'utilities/CustomReactLoadable';
import { ROLE_ADMINISTRATOR, ROLE_USER } from 'constants/userRoles'; import {ROLE_ADMINISTRATOR, ROLE_VETTEDUSER} from 'constants/userRoles';
const publicRoutes = [ const publicRoutes = [
...@@ -35,7 +35,7 @@ const dashboardRoutes = [ ...@@ -35,7 +35,7 @@ const dashboardRoutes = [
loader: () => import(/* webpackMode:"lazy", webpackChunkName: "descriptors" */'descriptors/ui/dashboard/DashboardPage'), loader: () => import(/* webpackMode:"lazy", webpackChunkName: "descriptors" */'descriptors/ui/dashboard/DashboardPage'),
}), }),
exact: true, exact: true,
auth: [ROLE_USER, ROLE_ADMINISTRATOR], auth: [ROLE_VETTEDUSER, ROLE_ADMINISTRATOR],
extraProps: { extraProps: {
title: 'My Dashboard', title: 'My Dashboard',
}, },
...@@ -45,7 +45,7 @@ const dashboardRoutes = [ ...@@ -45,7 +45,7 @@ const dashboardRoutes = [
component: Loadable({ component: Loadable({
loader: () => import(/* webpackMode:"lazy", webpackChunkName: "descriptors" */'descriptors/ui/dashboard/EditPage'), loader: () => import(/* webpackMode:"lazy", webpackChunkName: "descriptors" */'descriptors/ui/dashboard/EditPage'),
}), }),
auth: [ROLE_USER, ROLE_ADMINISTRATOR], auth: [ROLE_VETTEDUSER, ROLE_ADMINISTRATOR],
exact: true, exact: true,
}, },
{ {
...@@ -53,7 +53,7 @@ const dashboardRoutes = [ ...@@ -53,7 +53,7 @@ const dashboardRoutes = [
component: Loadable({ component: Loadable({
loader: () => import(/* webpackMode:"lazy", webpackChunkName: "descriptors" */'descriptors/ui/dashboard/EditPage'), loader: () => import(/* webpackMode:"lazy", webpackChunkName: "descriptors" */'descriptors/ui/dashboard/EditPage'),
}), }),
auth: [ROLE_USER, ROLE_ADMINISTRATOR], auth: [ROLE_VETTEDUSER, ROLE_ADMINISTRATOR],
exact: true, exact: true,
}, },
]; ];
......
...@@ -2,7 +2,7 @@ import Loadable from 'utilities/CustomReactLoadable'; ...@@ -2,7 +2,7 @@ import Loadable from 'utilities/CustomReactLoadable';
import steps from 'subsets/ui/dashboard/subset-stepper/steps'; import steps from 'subsets/ui/dashboard/subset-stepper/steps';
import { ROLE_ADMINISTRATOR, ROLE_USER } from 'constants/userRoles'; import {ROLE_ADMINISTRATOR, ROLE_VETTEDUSER} from 'constants/userRoles';
const publicRoutes = [ const publicRoutes = [
{ {
...@@ -35,7 +35,7 @@ const dashboardRoutes = [ ...@@ -35,7 +35,7 @@ const dashboardRoutes = [
component: Loadable({ component: Loadable({
loader: () => import(/* webpackMode:"lazy", webpackChunkName: "subsets" */'subsets/ui/dashboard/StepperPage'), loader: () => import(/* webpackMode:"lazy", webpackChunkName: "subsets" */'subsets/ui/dashboard/StepperPage'),
}), }),
auth: [ROLE_USER, ROLE_ADMINISTRATOR], auth: [ROLE_VETTEDUSER, ROLE_ADMINISTRATOR],
extraProps: { extraProps: {
title: 'Subset create', title: 'Subset create',
}, },
...@@ -54,7 +54,7 @@ const dashboardRoutes = [ ...@@ -54,7 +54,7 @@ const dashboardRoutes = [
component: Loadable({ component: Loadable({
loader: () => import(/* webpackMode:"lazy", webpackChunkName: "subsets" */'subsets/ui/dashboard/DashboardPage'), loader: () => import(/* webpackMode:"lazy", webpackChunkName: "subsets" */'subsets/ui/dashboard/DashboardPage'),
}), }),
auth: [ROLE_USER, ROLE_ADMINISTRATOR], auth: [ROLE_VETTEDUSER, ROLE_ADMINISTRATOR],
exact: true, exact: true,
extraProps: { extraProps: {
title: 'subsets.dashboard.p.stepper.publisher', title: 'subsets.dashboard.p.stepper.publisher',
...@@ -65,7 +65,7 @@ const dashboardRoutes = [ ...@@ -65,7 +65,7 @@ const dashboardRoutes = [
component: Loadable({ component: Loadable({
loader: () => import(/* webpackMode:"lazy", webpackChunkName: "subsets" */'subsets/ui/dashboard/StepperPage'), loader: () => import(/* webpackMode:"lazy", webpackChunkName: "subsets" */'subsets/ui/dashboard/StepperPage'),
}), }),
auth: [ROLE_USER, ROLE_ADMINISTRATOR], auth: [ROLE_VETTEDUSER, ROLE_ADMINISTRATOR],
extraProps: { extraProps: {
title: 'subsets.dashboard.p.stepper.publisher', title: 'subsets.dashboard.p.stepper.publisher',
}, },
......
...@@ -3,6 +3,7 @@ import { translate } from 'react-i18next'; ...@@ -3,6 +3,7 @@ import { translate } from 'react-i18next';
import renderRoutes from 'ui/renderRoutes'; import renderRoutes from 'ui/renderRoutes';
import TopNavigation from './headers/v1/NavigationBar'; import TopNavigation from './headers/v1/NavigationBar';
import {ROLE_ADMINISTRATOR, ROLE_VETTEDUSER} from 'constants/userRoles';
const DASHBOARD_MENUS = [ const DASHBOARD_MENUS = [
{ {
...@@ -32,6 +33,7 @@ const DASHBOARD_MENUS = [ ...@@ -32,6 +33,7 @@ const DASHBOARD_MENUS = [
{ {
to: '/dashboard/datasets/', to: '/dashboard/datasets/',
label: 'common.menu.catalog', label: 'common.menu.catalog',
auth: [ROLE_VETTEDUSER, ROLE_ADMINISTRATOR],
subMenus: [ subMenus: [
{ {
to: '/dashboard/datasets/', to: '/dashboard/datasets/',
...@@ -50,6 +52,7 @@ const DASHBOARD_MENUS = [ ...@@ -50,6 +52,7 @@ const DASHBOARD_MENUS = [
{ {
to: '/dashboard/subsets', to: '/dashboard/subsets',
label: 'subsets.dashboard.menu.subsets', label: 'subsets.dashboard.menu.subsets',
auth: [ROLE_VETTEDUSER, ROLE_ADMINISTRATOR],
}, },
]; ];
......
...@@ -38,7 +38,7 @@ class LoginContainer extends React.Component<ILoginContainerProps, void> { ...@@ -38,7 +38,7 @@ class LoginContainer extends React.Component<ILoginContainerProps, void> {
return checkTokenRequest(access_token); return checkTokenRequest(access_token);
}) })
.then((data) => { .then((data) => {
history.push('/dashboard'); history.push('/');
return false; return false;
}).catch((e) => { }).catch((e) => {
const data = _.get(e, 'response.data'); const data = _.get(e, 'response.data');
......
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