aboutsummaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
Diffstat (limited to 'services')
-rw-r--r--services/pull/update.go11
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)
}