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

Cancel default permissions (#3693)

parent 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% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment