用户角色菜单接口取消对权限标识的判断

This commit is contained in:
TsMask
2023-09-01 17:33:03 +08:00
parent 8c5500d5f3
commit 502c32f6d3
3 changed files with 80 additions and 120 deletions

View File

@@ -25,60 +25,46 @@ func Routers() []services.RouterItem {
rs := [...]services.RouterItem{
{
Method: "GET",
Pattern: "/menus",
Handler: apis.List,
Middleware: midware.Authorize(map[string][]string{
"hasPerms": {"system:menu:list"},
}),
Method: "GET",
Pattern: "/menus",
Handler: apis.List,
Middleware: midware.Authorize(nil),
},
{
Method: "GET",
Pattern: "/menu/{menuId}",
Handler: apis.Info,
Middleware: midware.Authorize(map[string][]string{
"hasPerms": {"system:menu:query"},
}),
Method: "GET",
Pattern: "/menu/{menuId}",
Handler: apis.Info,
Middleware: midware.Authorize(nil),
},
{
Method: "POST",
Pattern: "/menu",
Handler: apis.Add,
Middleware: midware.Authorize(map[string][]string{
"hasPerms": {"system:menu:add"},
}),
Method: "POST",
Pattern: "/menu",
Handler: apis.Add,
Middleware: midware.Authorize(nil),
},
{
Method: "PUT",
Pattern: "/menu",
Handler: apis.Edit,
Middleware: midware.Authorize(map[string][]string{
"hasPerms": {"system:menu:edit"},
}),
Method: "PUT",
Pattern: "/menu",
Handler: apis.Edit,
Middleware: midware.Authorize(nil),
},
{
Method: "DELETE",
Pattern: "/menu/{menuId}",
Handler: apis.Remove,
Middleware: midware.Authorize(map[string][]string{
"hasPerms": {"system:menu:edit"},
}),
Method: "DELETE",
Pattern: "/menu/{menuId}",
Handler: apis.Remove,
Middleware: midware.Authorize(nil),
},
{
Method: "GET",
Pattern: "/menus/treeSelect",
Handler: apis.TreeSelect,
Middleware: midware.Authorize(map[string][]string{
"hasPerms": {"system:menu:list"},
}),
Method: "GET",
Pattern: "/menus/treeSelect",
Handler: apis.TreeSelect,
Middleware: midware.Authorize(nil),
},
{
Method: "GET",
Pattern: "/menu/roleMenuTreeSelect/{roleId}",
Handler: apis.RoleMenuTreeSelect,
Middleware: midware.Authorize(map[string][]string{
"hasPerms": {"system:menu:list"},
}),
Method: "GET",
Pattern: "/menu/roleMenuTreeSelect/{roleId}",
Handler: apis.RoleMenuTreeSelect,
Middleware: midware.Authorize(nil),
},
// 添加更多的 Router 对象...
}