-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(seeder): 修正菜单表按钮标识 #537
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,7 +72,7 @@ public function pageList(RequestInterface $request): Result | |
content: new JsonContent(ref: MenuRequest::class, title: '创建菜单') | ||
)] | ||
#[PageResponse(instance: new Result())] | ||
#[Permission(code: 'permission:menu:create')] | ||
#[Permission(code: 'permission:menu:save')] | ||
public function create(MenuRequest $request): Result | ||
{ | ||
$this->service->create(array_merge($request->validated(), [ | ||
|
@@ -92,7 +92,7 @@ public function create(MenuRequest $request): Result | |
content: new JsonContent(ref: MenuRequest::class, title: '编辑菜单') | ||
)] | ||
#[PageResponse(instance: new Result())] | ||
#[Permission(code: 'permission:menu:save')] | ||
#[Permission(code: 'permission:menu:update')] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification 🛠️ Refactor suggestion 权限变更需要提供迁移方案 在将权限标识从
建议:
🔗 Analysis chain权限命名需符合语义化原则 将保存方法的权限从
🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# 检查是否存在相关的数据库迁移文件
fd -e php -e sql seeder menu
Length of output: 122 Script: #!/bin/bash
# Search for migration files and seeders
fd -e php migration
fd -e php seeder
# Search for old and new permission codes
rg -l "permission:menu:save"
rg -l "permission:menu:update"
# Search for permission-related files
fd -e php permission
Length of output: 918 Script: #!/bin/bash
# Check content of the seeder file
cat databases/seeders/menu_seeder_20240926.php
# Check the test file content
cat tests/Feature/Admin/Permission/MenuControllerTest.php
# Check the frontend view file
cat web/src/modules/base/views/permission/menu/menu-tree.vue
Length of output: 28152 |
||
public function save(int $id, MenuRequest $request): Result | ||
{ | ||
$this->service->updateById($id, array_merge($request->validated(), [ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -167,15 +167,15 @@ public function data(): array | |
]), | ||
], | ||
[ | ||
'name' => 'permission:menu:create', | ||
'name' => 'permission:menu:save', | ||
'meta' => new Meta([ | ||
'title' => '菜单保存', | ||
'type' => 'B', | ||
'i18n' => 'baseMenu.permission.menuSave', | ||
]), | ||
], | ||
Comment on lines
+170
to
176
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification 需要同步更新后端代码中的权限标识 发现前后端代码存在权限标识不一致的情况:
需要更新以下文件:
🔗 Analysis chain菜单标识修改符合系统规范 将菜单管理模块的按钮标识修改为与用户管理、角色管理模块保持一致的命名方式,提高了系统的一致性。 请确认以下相关变更是否已同步更新:
运行以下脚本以验证相关文件是否需要更新: Also applies to: 178-184 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# 描述:检查是否有使用旧的菜单标识的代码
# 搜索可能使用旧标识的文件
echo "检查前端路由配置..."
rg -l "permission:menu:create"
echo "检查权限相关代码..."
rg -l "permission\.menu\.create"
echo "检查API路由..."
rg -l "menu/create"
Length of output: 515 Script: #!/bin/bash
# 检查文件内容和其他可能的标识符使用
echo "===== MenuController.php 内容 ====="
rg -A 5 -B 5 "permission:menu:create" app/Http/Admin/Controller/Permission/MenuController.php
echo "===== MenuControllerTest.php 内容 ====="
rg -A 5 -B 5 "permission:menu:create" tests/Feature/Admin/Permission/MenuControllerTest.php
echo "===== 检查其他相关权限标识 ====="
rg -l "menu.*?(create|save)"
echo "===== 检查权限检查代码 ====="
ast-grep --pattern 'can($_, "permission:menu:create")'
Length of output: 1644 Script: #!/bin/bash
# 检查前端代码和数据库迁移文件
echo "===== 检查前端语言文件 ====="
rg -A 2 -B 2 "menu.*?(create|save)" web/src/modules/base/locales/en\[English\].yaml
echo "===== 检查菜单树组件 ====="
rg -A 5 -B 5 "menu.*?(create|save)" web/src/modules/base/views/permission/menu/menu-tree.vue
echo "===== 检查数据库迁移文件 ====="
rg -A 2 -B 2 "permission:menu:(create|save)" databases/seeders/menu_update_20241029.php
Length of output: 984 |
||
[ | ||
'name' => 'permission:menu:save', | ||
'name' => 'permission:menu:update', | ||
'meta' => new Meta([ | ||
'title' => '菜单更新', | ||
'type' => 'B', | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议重新考虑权限标识的变更策略
控制器中将创建菜单的权限从
permission:menu:create
改为permission:menu:save
存在以下问题:建议: