diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2024-02-24 22:14:48 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-24 14:14:48 +0000 |
commit | 98ab9445d1020c515c3c789f0b27d952903a2978 (patch) | |
tree | db1f3c8abe98139059a5b8f695c7dfc66a827a1e /models/perm/access/repo_permission.go | |
parent | 29a26d9d8c573c9fb7e79a66ac3d578e8b20dcae (diff) | |
download | gitea-98ab9445d1020c515c3c789f0b27d952903a2978.tar.gz gitea-98ab9445d1020c515c3c789f0b27d952903a2978.zip |
Users with `read` permission of pull requests can be assigned too (#27263)
This PR will also keep the consistent between list assigned users and
check assigned users.
Diffstat (limited to 'models/perm/access/repo_permission.go')
-rw-r--r-- | models/perm/access/repo_permission.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/models/perm/access/repo_permission.go b/models/perm/access/repo_permission.go index 395ecdf1a5..4175cb9b92 100644 --- a/models/perm/access/repo_permission.go +++ b/models/perm/access/repo_permission.go @@ -332,7 +332,6 @@ func HasAccessUnit(ctx context.Context, user *user_model.User, repo *repo_model. // CanBeAssigned return true if user can be assigned to issue or pull requests in repo // Currently any write access (code, issues or pr's) is assignable, to match assignee list in user interface. -// FIXME: user could send PullRequest also could be assigned??? func CanBeAssigned(ctx context.Context, user *user_model.User, repo *repo_model.Repository, _ bool) (bool, error) { if user.IsOrganization() { return false, fmt.Errorf("Organization can't be added as assignee [user_id: %d, repo_id: %d]", user.ID, repo.ID) @@ -341,7 +340,8 @@ func CanBeAssigned(ctx context.Context, user *user_model.User, repo *repo_model. if err != nil { return false, err } - return perm.CanAccessAny(perm_model.AccessModeWrite, unit.TypeCode, unit.TypeIssues, unit.TypePullRequests), nil + return perm.CanAccessAny(perm_model.AccessModeWrite, unit.AllRepoUnitTypes...) || + perm.CanAccessAny(perm_model.AccessModeRead, unit.TypePullRequests), nil } // HasAccess returns true if user has access to repo |