Add cancel-build role

[?]
Nov 5, 2019, 6:29 PM
GXRKOXQJWOBXNHUYT5D7NX2JHEOY2CWZFLSFOW2BLG6GGNM2SRZAC

Dependencies

  • [2] 6DMDTQ7M Add bump-to-front role
  • [3] UOINKJ2J Add an action to cancel all builds in a jobset eval
  • [4] ZILILXXK * Allow scheduled builds to be cancelled. They're not removed from
  • [5] 6S3ZLOZL Return JSON for /eval
  • [6] VHV6GI4L Add a jobset eval action to restart all aborted/cancelled builds
  • [*] LBNVQXUB * Build the /build stuff in a separate controller.
  • [*] U4TD3AIQ Add support for viewing jobset evaluations
  • [*] FPK5LF53 * Put the project-related actions in a separate controller. Put the
  • [*] LYVUXIGT Clean up the authorization code a bit
  • [*] SZYDW2DG hydra: added some user admin
  • [*] XJRJ4J7M Add user registration

Change contents

  • replacement in src/lib/Hydra/Controller/Build.pm at line 507
    [3.572][3.572:618]()
    requireProjectOwner($c, $build->project);
    [3.571]
    [3.248]
    requireCancelBuildPrivileges($c, $build->project);
  • replacement in src/lib/Hydra/Controller/JobsetEval.pm at line 182
    [3.751][3.751:808]()
    requireProjectOwner($c, $c->stash->{eval}->project);
    [3.751]
    [3.808]
    requireCancelBuildPrivileges($c, $c->stash->{eval}->project);
  • edit in src/lib/Hydra/Helper/CatalystUtils.pm at line 17
    [2.159]
    [10.9771]
    requireCancelBuildPrivileges
  • edit in src/lib/Hydra/Helper/CatalystUtils.pm at line 184
    [11.794]
    [2.160]
    }
    sub hasCancelBuildRole {
    my ($c) = @_;
    return $c->user_exists && $c->check_user_roles('cancel-build');
    }
    sub mayCancelBuild {
    my ($c, $project) = @_;
    return
    $c->user_exists &&
    (isAdmin($c) ||
    hasCancelBuildRole($c) ||
    isProjectOwner($c, $project));
  • edit in src/lib/Hydra/Helper/CatalystUtils.pm at line 200
    [2.163]
    [2.163]
    sub requireCancelBuildPrivileges {
    my ($c, $project) = @_;
    requireUser($c);
    accessDenied($c, "Only the project members, administrators, and accounts with cancel-build privileges can perform this operation.")
    unless mayCancelBuild($c, $project);
    }
  • edit in src/root/user.tt at line 85
    [2.774]
    [13.6750]
    [% INCLUDE roleoption role="cancel-build" %]