diff options
author | 6543 <6543@obermui.de> | 2020-05-17 02:48:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-16 20:48:30 -0400 |
commit | 84bcb3451a5b1a9032dcf5351292191572dddcf2 (patch) | |
tree | 9585194e9d364ce97e52f4b18309b61b3e7c6bf5 /services/pull | |
parent | dcb0cf74705ef77699ee4c78e9598abdcadb202f (diff) | |
download | gitea-84bcb3451a5b1a9032dcf5351292191572dddcf2.tar.gz gitea-84bcb3451a5b1a9032dcf5351292191572dddcf2.zip |
Check Push permissions on IsUserAllowedToUpdate (#11448)
Diffstat (limited to 'services/pull')
-rw-r--r-- | services/pull/update.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/services/pull/update.go b/services/pull/update.go index 2ccbcf00a3..0829b1c5d6 100644 --- a/services/pull/update.go +++ b/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) } |