require push permission for PR merge (#725)

This commit is contained in:
Marko Gacesa 2023-10-26 17:34:28 +00:00 committed by Harness
parent 8d8535aa77
commit 059e9760c8
3 changed files with 3 additions and 3 deletions

View File

@ -44,7 +44,7 @@ func (c *Controller) PostReceive(
principalID int64, principalID int64,
in githook.PostReceiveInput, in githook.PostReceiveInput,
) (*githook.Output, error) { ) (*githook.Output, error) {
repo, err := c.getRepoCheckAccess(ctx, session, repoID, enum.PermissionRepoEdit) repo, err := c.getRepoCheckAccess(ctx, session, repoID, enum.PermissionRepoPush)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -44,7 +44,7 @@ func (c *Controller) PreReceive(
) (*githook.Output, error) { ) (*githook.Output, error) {
output := &githook.Output{} output := &githook.Output{}
repo, err := c.getRepoCheckAccess(ctx, session, repoID, enum.PermissionRepoEdit) repo, err := c.getRepoCheckAccess(ctx, session, repoID, enum.PermissionRepoPush)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -57,7 +57,7 @@ func (c *Controller) Merge(
} }
in.Method = method in.Method = method
targetRepo, err := c.getRepoCheckAccess(ctx, session, repoRef, enum.PermissionRepoEdit) targetRepo, err := c.getRepoCheckAccess(ctx, session, repoRef, enum.PermissionRepoPush)
if err != nil { if err != nil {
return nil, nil, fmt.Errorf("failed to acquire access to target repo: %w", err) return nil, nil, fmt.Errorf("failed to acquire access to target repo: %w", err)
} }