zn-cloud-wcs/admin-web/src/pages/Authorized.js
sin 8a804d654e - 添加菜单权限控制
- url 权限控制
2019-03-04 11:32:26 +08:00

20 lines
751 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React from 'react';
import RenderAuthorized from '@/components/Authorized';
import { getAuthority } from '@/utils/authority';
import Redirect from 'umi/redirect';
const Authority = getAuthority();
// TODO RenderAuthorized 暂时写死为 admin次组件集成于 antd-pro 后期有时间处理,(可能有用,可能没用)
// TODO 可大致分为两种角色admin 管理员角色user 代表其他非授权页面,可以公开的
// const Authorized = RenderAuthorized(['admin', 'user']);
const Authorized = RenderAuthorized(Authority);
export default ({ children }) => {
return (
<Authorized authority={children.props.route.authority} noMatch={<Redirect to="/user/login" />}>
{children}
</Authorized>
);
};