Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangpeng
dinky
Commits
622a5ceb
Unverified
Commit
622a5ceb
authored
Dec 12, 2022
by
zhu-mingye
Committed by
GitHub
Dec 12, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add access (#1422)
parent
f6b63765
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
routes.ts
dlink-web/config/routes.ts
+3
-0
access.ts
dlink-web/src/access.ts
+5
-1
No files found.
dlink-web/config/routes.ts
View file @
622a5ceb
...
@@ -27,6 +27,8 @@
...
@@ -27,6 +27,8 @@
* @param wrappers 配置路由组件的包装组件,通过包装组件可以为当前的路由组件组合进更多的功能。 比如,可以用于路由级别的权限校验
* @param wrappers 配置路由组件的包装组件,通过包装组件可以为当前的路由组件组合进更多的功能。 比如,可以用于路由级别的权限校验
* @param name 配置路由的标题,默认读取国际化文件 menu.ts 中 menu.xxxx 的值,如配置 name 为 login,则读取 menu.ts 中 menu.login 的取值作为标题
* @param name 配置路由的标题,默认读取国际化文件 menu.ts 中 menu.xxxx 的值,如配置 name 为 login,则读取 menu.ts 中 menu.login 的取值作为标题
* @param icon 配置路由的图标,取值参考 https://ant.design/components/icon-cn, 注意去除风格后缀和大小写,如想要配置图标为 <StepBackwardOutlined /> 则取值应为 stepBackward 或 StepBackward,如想要配置图标为 <UserOutlined /> 则取值应为 user 或者 User
* @param icon 配置路由的图标,取值参考 https://ant.design/components/icon-cn, 注意去除风格后缀和大小写,如想要配置图标为 <StepBackwardOutlined /> 则取值应为 stepBackward 或 StepBackward,如想要配置图标为 <UserOutlined /> 则取值应为 user 或者 User
* @param access 权限相关 需要在 src/access.ts内定义权限 使用名称 引用即可
* 组件内的权限则使用 Hooks + <Access /> 组件实现 详情见: https://umijs.org/docs/max/access
* @doc https://umijs.org/docs/guides/routes
* @doc https://umijs.org/docs/guides/routes
* demo : https://github.com/ant-design/ant-design-pro/blob/master/config/routes.ts
* demo : https://github.com/ant-design/ant-design-pro/blob/master/config/routes.ts
*/
*/
...
@@ -155,6 +157,7 @@ export default [
...
@@ -155,6 +157,7 @@ export default [
name
:
'authenticationCenter'
,
name
:
'authenticationCenter'
,
icon
:
'SafetyCertificateOutlined'
,
icon
:
'SafetyCertificateOutlined'
,
path
:
'/authenticationCenter'
,
path
:
'/authenticationCenter'
,
access
:
"canAdmin"
,
routes
:
[
routes
:
[
{
{
path
:
'/authenticationCenter'
,
path
:
'/authenticationCenter'
,
...
...
dlink-web/src/access.ts
View file @
622a5ceb
...
@@ -24,6 +24,10 @@
...
@@ -24,6 +24,10 @@
export
default
function
access
(
initialState
:
{
currentUser
?:
API
.
CurrentUser
|
undefined
})
{
export
default
function
access
(
initialState
:
{
currentUser
?:
API
.
CurrentUser
|
undefined
})
{
const
{
currentUser
}
=
initialState
||
{};
const
{
currentUser
}
=
initialState
||
{};
return
{
return
{
canAdmin
:
currentUser
&&
currentUser
.
isAdmin
?
'admin'
:
''
,
canAdmin
:
currentUser
&&
currentUser
.
isAdmin
,
// canAdd: true,
// canDelete: true,
// canUpdate: true,
// canManager: true,
};
};
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment