Skip to content

Commit

Permalink
add permissions check description in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wuyue92tree committed Jun 9, 2023
1 parent e2877a5 commit b54eb47
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/en/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class MyAdminlteConfig(AdminlteConfig):
MenuItem(label='auth', name='认证和授权', icon='fa-users', child=[
MenuItem(label='auth.User', name='用户', menu_type='model'), # (1)
MenuItem(label='auth.Group', name='', menu_type='model'),
MenuItem(label='auth.link', name='/admin/auth/', menu_type='link', permissions=['auth.view_user']), # (2)
]),
]
top_menu = [
Expand All @@ -76,6 +77,7 @@ effect
![menu](../assets/images/menu.png)

1. when menu_type is model,if name not setup, will show the model verbose_name
2. when menu_type is link, you can control menu show or not show by bind model permission, `permissions` default None, will not check permission

#### main_menu
main menu(left menu),default is `[]`,will render as all registered model in admin
Expand Down
2 changes: 2 additions & 0 deletions docs/zh/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class MyAdminlteConfig(AdminlteConfig):
MenuItem(label='auth', name='认证和授权', icon='fa-users', child=[
MenuItem(label='auth.User', name='用户', menu_type='model'), # (1)
MenuItem(label='auth.Group', name='', menu_type='model'),
MenuItem(label='auth.link', name='/admin/auth/', menu_type='link', permissions=['auth.view_user']), # (2)
]),
]
top_menu = [
Expand All @@ -76,6 +77,7 @@ class MyAdminlteConfig(AdminlteConfig):
![menu](../assets/images/menu.png)

1. menu_type类型为model时,若不指定name,则默认显示为原model的verbose_name
2. menu_type类型为link时,可以通过绑定模型权限,控制menu的显示,`permissions`默认为空,不进行权限检测

#### main_menu
主菜单(左侧菜单),默认为`[]`,将渲染为所有已注册到admin中的model
Expand Down

0 comments on commit b54eb47

Please sign in to comment.