浏览代码

Fixing Inheritability of Permissions (#5347)

https://github.com/ant-design/ant-design-pro/issues/4883
拷钉 6 年之前
父节点
当前提交
21e1794335
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/pages/Authorized.tsx

+ 3 - 0
src/pages/Authorized.tsx

@@ -12,6 +12,9 @@ interface AuthComponentProps extends ConnectProps {
 const getRouteAuthority = (path: string, routeData: Route[]) => {
 const getRouteAuthority = (path: string, routeData: Route[]) => {
   let authorities: string[] | string | undefined;
   let authorities: string[] | string | undefined;
   routeData.forEach(route => {
   routeData.forEach(route => {
+    if (route.authority) {
+      authorities = route.authority;
+    }
     // match prefix
     // match prefix
     if (pathToRegexp(`${route.path}(.*)`).test(path)) {
     if (pathToRegexp(`${route.path}(.*)`).test(path)) {
       // exact match
       // exact match