fix: 修复管理员权限逻辑问题 --story=130003551#746
Merged
Merged
Conversation
# Reviewed, transaction id: 80864
There was a problem hiding this comment.
Code Review Summary
✅ 变更逻辑清晰且正确。
变更分析:
-
bkflow/permission/models.py:新增FLOW_VIEW/FLOW_EDIT/FLOW_MOCK枚举值,将之前在_inject_user_task_auth中通过字符串拼接(f"FLOW_{permission_type}")动态生成的权限类型显式定义为枚举成员,并添加到TASK_PERMISSION_TYPE中,确保超级用户/空间管理员获取到完整权限列表(包含模板派生权限)。 -
tests/interface/task/test_task_views.py:测试断言从硬编码字符串改为使用枚举值,保持一致性。
确认无问题:
FLOW_*权限是运行时合成的(view.py:171),不存储在 DB 中,因此Token.PERMISSION_TYPEchoices 无需更新TASK_PERMISSION_TYPE仅在超级用户场景下使用(view.py:151),扩展不影响普通用户的权限查询逻辑- 无安全、性能或架构问题
LGTM,无需修改。
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reviewed, transaction id: 80864