Add bump-to-front role
This commit is contained in:
@ -13,6 +13,7 @@ our @EXPORT = qw(
|
||||
searchBuildsAndEvalsForJobset
|
||||
error notFound gone accessDenied
|
||||
forceLogin requireUser requireProjectOwner requireRestartPrivileges requireAdmin requirePost isAdmin isProjectOwner
|
||||
requireBumpPrivileges
|
||||
trim
|
||||
getLatestFinishedEval getFirstEval
|
||||
paramToList
|
||||
@ -181,6 +182,27 @@ sub isProjectOwner {
|
||||
defined $c->model('DB::ProjectMembers')->find({ project => $project, userName => $c->user->username }));
|
||||
}
|
||||
|
||||
sub hasBumpJobsRole {
|
||||
my ($c) = @_;
|
||||
return $c->user_exists && $c->check_user_roles('bump-to-front');
|
||||
}
|
||||
|
||||
sub mayBumpJobs {
|
||||
my ($c, $project) = @_;
|
||||
return
|
||||
$c->user_exists &&
|
||||
(isAdmin($c) ||
|
||||
hasBumpJobsRole($c) ||
|
||||
isProjectOwner($c, $project));
|
||||
}
|
||||
|
||||
sub requireBumpPrivileges {
|
||||
my ($c, $project) = @_;
|
||||
requireUser($c);
|
||||
accessDenied($c, "Only the project members, administrators, and accounts with bump-to-front privileges can perform this operation.")
|
||||
unless mayBumpJobs($c, $project);
|
||||
}
|
||||
|
||||
sub hasRestartJobsRole {
|
||||
my ($c) = @_;
|
||||
return $c->user_exists && $c->check_user_roles('restart-jobs');
|
||||
|
Reference in New Issue
Block a user