mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-08 18:04:14 +01:00
Check Push permissions on IsUserAllowedToUpdate (#11448)
This commit is contained in:
parent
dcb0cf7470
commit
84bcb3451a
1 changed files with 11 additions and 0 deletions
|
@ -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…
Reference in a new issue