You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-// User is not system administrator: always reset BWP to flase+// User is not system administrator: always reset BWP to false
user.BusinessWritePermission = false
Suggestion importance[1-10]: 3
__
Why: The suggestion only fixes a minor typo in the comment ("flase" to "false") without impacting functionality, so it has a low impact.
businessWritePermission := req.User.BusinessWritePermission
if businessWritePermission == nil {
for _, uid := range req.User.OpPermissionUids {
if uid == pkgConst.UIDOfOpPermissionGlobalManagement {
t := true
businessWritePermission = &t
break
}
}
+ if businessWritePermission == nil {+ f := false+ businessWritePermission = &f+ }
}
Suggestion importance[1-10]: 8
__
Why: The suggestion enhances safety by explicitly assigning a default false value to businessWritePermission if it remains nil, which can prevent potential nil pointer issues downstream. This error handling improvement is relevant and appropriately addresses a critical edge case.
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
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.
User description
… AddUser function.
关联的 issue
https://github.com/actiontech/dms-ee/issues/813
描述你的变更
添加用户时,如果为系统管理员权限且未设置业务写参数,默认为开启
确认项(pr提交后操作)
Tip
请在指定复审人之前,确认并完成以下事项,完成后✅
not_compatibleneed_update_docDescription
更新用户结构体注释描述
修改新增用户参数中默认业务写权限处理逻辑
修正更新用户时非管理员的业务写权限默认值
在服务层根据权限列表设置系统管理员默认业务写权限
Diagram Walkthrough
File Walkthrough
user.go
调整用户结构体及更新逻辑internal/dms/biz/user.go
user.go
增加服务层默认权限判断internal/dms/service/user.go