Check Push permissions on IsUserAllowedToUpdate (#11448)

tokarchuk/v1.17
6543 5 years ago committed by GitHub
parent dcb0cf7470
commit 84bcb3451a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      services/pull/update.go

@ -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