提交 2a70fe0d 编写于 作者: 陈小聪 提交者: 陈帅

Cancel default permissions (#3693)

上级 8b871219
......@@ -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',
......
......@@ -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 },
});
}
......
......@@ -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({
......
......@@ -21,6 +21,7 @@ function AuthComponent({ children, location, routerData, status }) {
});
return authorities;
};
return (
<Authorized
authority={getRouteAuthority(location.pathname, routerData)}
......
......@@ -13,7 +13,7 @@ export function getAuthority(str) {
if (typeof authority === 'string') {
return [authority];
}
return authority || ['admin'];
return authority;
}
export function setAuthority(authority) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册