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