mirror of https://github.com/harness/drone.git
feat: [CODE-1132]: dryrun requires view permission (#819)
parent
e162112a29
commit
3d97474dcf
|
@ -86,7 +86,12 @@ func (c *Controller) Merge(
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
targetRepo, err := c.getRepoCheckAccess(ctx, session, repoRef, enum.PermissionRepoPush)
|
||||
requiredPermission := enum.PermissionRepoPush
|
||||
if in.DryRun {
|
||||
requiredPermission = enum.PermissionRepoView
|
||||
}
|
||||
|
||||
targetRepo, err := c.getRepoCheckAccess(ctx, session, repoRef, requiredPermission)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("failed to acquire access to target repo: %w", err)
|
||||
}
|
||||
|
|
|
@ -61,7 +61,12 @@ func (c *Controller) CommitFiles(ctx context.Context,
|
|||
repoRef string,
|
||||
in *CommitFilesOptions,
|
||||
) (types.CommitFilesResponse, []types.RuleViolations, error) {
|
||||
repo, err := c.getRepoCheckAccess(ctx, session, repoRef, enum.PermissionRepoPush, false)
|
||||
requiredPermission := enum.PermissionRepoPush
|
||||
if in.DryRunRules {
|
||||
requiredPermission = enum.PermissionRepoView
|
||||
}
|
||||
|
||||
repo, err := c.getRepoCheckAccess(ctx, session, repoRef, requiredPermission, false)
|
||||
if err != nil {
|
||||
return types.CommitFilesResponse{}, nil, err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue