Skip to content

fix: 修复管理员权限逻辑问题 --story=130003551#746

Merged
guohelu merged 1 commit into
TencentBlueKing:developfrom
guohelu:develop_25
May 25, 2026
Merged

fix: 修复管理员权限逻辑问题 --story=130003551#746
guohelu merged 1 commit into
TencentBlueKing:developfrom
guohelu:develop_25

Conversation

@guohelu

@guohelu guohelu commented May 25, 2026

Copy link
Copy Markdown
Collaborator

Reviewed, transaction id: 80864

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

✅ 变更逻辑清晰且正确。

变更分析:

  1. bkflow/permission/models.py:新增 FLOW_VIEW/FLOW_EDIT/FLOW_MOCK 枚举值,将之前在 _inject_user_task_auth 中通过字符串拼接(f"FLOW_{permission_type}")动态生成的权限类型显式定义为枚举成员,并添加到 TASK_PERMISSION_TYPE 中,确保超级用户/空间管理员获取到完整权限列表(包含模板派生权限)。

  2. tests/interface/task/test_task_views.py:测试断言从硬编码字符串改为使用枚举值,保持一致性。

确认无问题:

  • FLOW_* 权限是运行时合成的(view.py:171),不存储在 DB 中,因此 Token.PERMISSION_TYPE choices 无需更新
  • TASK_PERMISSION_TYPE 仅在超级用户场景下使用(view.py:151),扩展不影响普通用户的权限查询逻辑
  • 无安全、性能或架构问题

LGTM,无需修改。

@guohelu guohelu merged commit 8e822f1 into TencentBlueKing:develop May 25, 2026
8 checks passed
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.87%. Comparing base (ea70462) to head (69a8b4a).
⚠️ Report is 30 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #746      +/-   ##
===========================================
+ Coverage    82.14%   82.87%   +0.72%     
===========================================
  Files          296      296              
  Lines        17925    17970      +45     
===========================================
+ Hits         14725    14893     +168     
+ Misses        3200     3077     -123     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants