From 2a70fe0d2a208cc54e6dd658e0558b568c58c7c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B0=8F=E8=81=AA?= Date: Fri, 22 Mar 2019 12:19:26 +0800 Subject: [PATCH] Cancel default permissions (#3693) --- config/router.config.js | 2 +- src/layouts/BasicLayout.js | 4 ++-- src/models/menu.js | 4 ++-- src/pages/Authorized.js | 1 + src/utils/authority.js | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/config/router.config.js b/config/router.config.js index c961c7b6..2698abc9 100644 --- a/config/router.config.js +++ b/config/router.config.js @@ -24,7 +24,7 @@ export default [ Routes: ['src/pages/Authorized'], routes: [ // dashboard - { path: '/', redirect: '/dashboard/analysis' }, + { path: '/', redirect: '/dashboard/analysis', authority: ['admin', 'user'] }, { path: '/dashboard', name: 'dashboard', diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index 06cc41fc..1aa231d4 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -48,7 +48,7 @@ class BasicLayout extends React.Component { componentDidMount() { const { dispatch, - route: { routes, authority }, + route: { routes, path, authority }, } = this.props; dispatch({ type: 'user/fetchCurrent', @@ -58,7 +58,7 @@ class BasicLayout extends React.Component { }); dispatch({ type: 'menu/getMenuData', - payload: { routes, authority }, + payload: { routes, path, authority }, }); } diff --git a/src/models/menu.js b/src/models/menu.js index 2e803f06..d9a9d2b1 100644 --- a/src/models/menu.js +++ b/src/models/menu.js @@ -109,8 +109,8 @@ export default { effects: { *getMenuData({ payload }, { put }) { - const { routes, authority } = payload; - const originalMenuData = memoizeOneFormatter(routes, authority); + const { routes, authority, path } = payload; + const originalMenuData = memoizeOneFormatter(routes, authority, path); const menuData = filterMenuData(originalMenuData); const breadcrumbNameMap = memoizeOneGetBreadcrumbNameMap(originalMenuData); yield put({ diff --git a/src/pages/Authorized.js b/src/pages/Authorized.js index 960f2c6b..e2c92e89 100644 --- a/src/pages/Authorized.js +++ b/src/pages/Authorized.js @@ -21,6 +21,7 @@ function AuthComponent({ children, location, routerData, status }) { }); return authorities; }; + return (