diff options
Diffstat (limited to 'internal/db/repo_branch.go')
-rw-r--r-- | internal/db/repo_branch.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/internal/db/repo_branch.go b/internal/db/repo_branch.go index ceb99231..3b7f9137 100644 --- a/internal/db/repo_branch.go +++ b/internal/db/repo_branch.go @@ -175,10 +175,12 @@ func UpdateOrgProtectBranch(repo *Repository, protectBranch *ProtectBranch, whit userIDs := tool.StringsToInt64s(strings.Split(whitelistUserIDs, ",")) validUserIDs = make([]int64, 0, len(userIDs)) for _, userID := range userIDs { - has, err := HasAccess(userID, repo, AccessModeWrite) - if err != nil { - return fmt.Errorf("HasAccess [user_id: %d, repo_id: %d]: %v", userID, protectBranch.RepoID, err) - } else if !has { + if !Perms.Authorize(userID, repo.ID, AccessModeWrite, + AccessModeOptions{ + OwnerID: repo.OwnerID, + Private: repo.IsPrivate, + }, + ) { continue // Drop invalid user ID } |