Commit 2a70fe0d authored by ι™ˆε°θͺ's avatar ι™ˆε°θͺ Committed by ι™ˆεΈ…

Cancel default permissions (#3693)

parent 8b871219
...@@ -24,7 +24,7 @@ export default [ ...@@ -24,7 +24,7 @@ export default [
Routes: ['src/pages/Authorized'], Routes: ['src/pages/Authorized'],
routes: [ routes: [
// dashboard // dashboard
{ path: '/', redirect: '/dashboard/analysis' }, { path: '/', redirect: '/dashboard/analysis', authority: ['admin', 'user'] },
{ {
path: '/dashboard', path: '/dashboard',
name: 'dashboard', name: 'dashboard',
......
...@@ -48,7 +48,7 @@ class BasicLayout extends React.Component { ...@@ -48,7 +48,7 @@ class BasicLayout extends React.Component {
componentDidMount() { componentDidMount() {
const { const {
dispatch, dispatch,
route: { routes, authority }, route: { routes, path, authority },
} = this.props; } = this.props;
dispatch({ dispatch({
type: 'user/fetchCurrent', type: 'user/fetchCurrent',
...@@ -58,7 +58,7 @@ class BasicLayout extends React.Component { ...@@ -58,7 +58,7 @@ class BasicLayout extends React.Component {
}); });
dispatch({ dispatch({
type: 'menu/getMenuData', type: 'menu/getMenuData',
payload: { routes, authority }, payload: { routes, path, authority },
}); });
} }
......
...@@ -109,8 +109,8 @@ export default { ...@@ -109,8 +109,8 @@ export default {
effects: { effects: {
*getMenuData({ payload }, { put }) { *getMenuData({ payload }, { put }) {
const { routes, authority } = payload; const { routes, authority, path } = payload;
const originalMenuData = memoizeOneFormatter(routes, authority); const originalMenuData = memoizeOneFormatter(routes, authority, path);
const menuData = filterMenuData(originalMenuData); const menuData = filterMenuData(originalMenuData);
const breadcrumbNameMap = memoizeOneGetBreadcrumbNameMap(originalMenuData); const breadcrumbNameMap = memoizeOneGetBreadcrumbNameMap(originalMenuData);
yield put({ yield put({
......
...@@ -21,6 +21,7 @@ function AuthComponent({ children, location, routerData, status }) { ...@@ -21,6 +21,7 @@ function AuthComponent({ children, location, routerData, status }) {
}); });
return authorities; return authorities;
}; };
return ( return (
<Authorized <Authorized
authority={getRouteAuthority(location.pathname, routerData)} authority={getRouteAuthority(location.pathname, routerData)}
......
...@@ -13,7 +13,7 @@ export function getAuthority(str) { ...@@ -13,7 +13,7 @@ export function getAuthority(str) {
if (typeof authority === 'string') { if (typeof authority === 'string') {
return [authority]; return [authority];
} }
return authority || ['admin']; return authority;
} }
export function setAuthority(authority) { export function setAuthority(authority) {
......
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