forked from lix-project/hydra
Merge pull request #927 from cole-h/nonexistent-user-400
Return HTTP 400 when creating Project with nonexistent user
This commit is contained in:
commit
453b8479be
|
@ -170,6 +170,16 @@ paths:
|
|||
description: when set to true the project is displayed in the web interface
|
||||
type: boolean
|
||||
responses:
|
||||
'400':
|
||||
description: bad request
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
error:
|
||||
description: error message
|
||||
type: string
|
||||
'403':
|
||||
description: request unauthorized
|
||||
content:
|
||||
|
|
|
@ -136,7 +136,7 @@ sub updateProject {
|
|||
my $owner = $project->owner;
|
||||
if ($c->check_user_roles('admin') and defined $c->stash->{params}->{owner}) {
|
||||
$owner = trim $c->stash->{params}->{owner};
|
||||
error($c, "The user name ‘$owner’ does not exist.")
|
||||
badRequest($c, "The user name ‘$owner’ does not exist.")
|
||||
unless defined $c->model('DB::Users')->find($owner);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ our @ISA = qw(Exporter);
|
|||
our @EXPORT = qw(
|
||||
getBuild getPreviousBuild getNextBuild getPreviousSuccessfulBuild
|
||||
searchBuildsAndEvalsForJobset
|
||||
error notFound gone accessDenied
|
||||
error notFound gone accessDenied badRequest
|
||||
forceLogin requireUser requireProjectOwner requireRestartPrivileges requireAdmin requirePost isAdmin isProjectOwner
|
||||
requireBumpPrivileges
|
||||
requireCancelBuildPrivileges
|
||||
|
@ -155,6 +155,10 @@ sub accessDenied {
|
|||
error($c, $msg, 403);
|
||||
}
|
||||
|
||||
sub badRequest {
|
||||
my ($c, $msg) = @_;
|
||||
error($c, $msg, 400);
|
||||
}
|
||||
|
||||
sub backToReferer {
|
||||
my ($c) = @_;
|
||||
|
|
Loading…
Reference in a new issue