Browse Source

Check Push permissions on IsUserAllowedToUpdate (#11448)

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

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