Browse Source

Check Push permissions on IsUserAllowedToUpdate (#11448)

for-closed-social
6543 4 years ago
committed by GitHub
parent
commit
84bcb3451a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions
  1. +11
    -0
      services/pull/update.go

+ 11
- 0
services/pull/update.go View File

@ -59,6 +59,17 @@ func IsUserAllowedToUpdate(pull *models.PullRequest, user *models.User) (bool, e
HeadBranch: pull.BaseBranch,
BaseBranch: pull.HeadBranch,
}
err = pr.LoadProtectedBranch()
if err != nil {
return false, err
}
// Update function need push permission
if pr.ProtectedBranch != nil && !pr.ProtectedBranch.CanUserPush(user.ID) {
return false, nil
}
return IsUserAllowedToMerge(pr, headRepoPerm, user)
}

Loading…
Cancel
Save