fix: 修复权限组视野变更后用户视图未刷新的问题#188
Open
whjstc wants to merge 1 commit intoeasysoft:mainfrom
Open
Conversation
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.
问题描述
在权限组中维护“视野权限”或调整组成员后,系统会更新:
zt_group.aclzt_usergroup但不会同步刷新受影响用户的最终
user view(zt_userview)。这会导致一种常见的不一致:
user view仍然是旧值在实际使用中,这会表现为:
app->user->view的产品、需求、文档等读取接口,会继续报无权限或查不到数据根因分析
module/group/model.php中:updateView()只更新了zt_group.acl,没有刷新该组成员的最终user viewupdateUser()只更新了成员关系,没有刷新新增/移除成员的最终user view而系统中多个模块会直接依赖
app->user->view或zt_userview做访问过滤,因此组视野与用户实际可见范围会出现滞后。修复方案
在以下两个入口补充用户视图刷新:
updateView()user viewupdateUser()user view刷新逻辑使用:
authorize($account)获取组视野 ACLgrantUserView($account, $rights['acls'], $rights['projects'])生成最终视图zt_userview同时更新:
system.common.userview.relatedTablesUpdateTime用于保证相关缓存失效时间与视图变更保持一致。
影响范围
风险评估
风险较低。
本次修改不改变权限判定规则,只是在组视野和组成员发生变更后,主动刷新受影响用户的最终视图,避免页面配置与实际访问结果不一致。