diff --git a/src/Hydra/lib/Hydra/Controller/Root.pm b/src/Hydra/lib/Hydra/Controller/Root.pm index a474a3ec..99ca01c1 100644 --- a/src/Hydra/lib/Hydra/Controller/Root.pm +++ b/src/Hydra/lib/Hydra/Controller/Root.pm @@ -407,15 +407,17 @@ sub updateProject { my $displayName = trim $c->request->params->{displayname}; die "Invalid display name: $displayName" if $displayName eq ""; - my $owner = trim $c->request->params->{owner}; - die "Invalid owner: $owner" - unless defined $c->model('DB::Users')->find({username => $owner}); - $project->name($projectName); $project->displayname($displayName); $project->description(trim $c->request->params->{description}); $project->enabled(trim($c->request->params->{enabled}) eq "1" ? 1 : 0); - $project->owner($owner) if $c->check_user_roles('admin'); + + if ($c->check_user_roles('admin')) { + my $owner = trim $c->request->params->{owner}; + die "Invalid owner: $owner" + unless defined $c->model('DB::Users')->find({username => $owner}); + $project->owner($owner); + } $project->update;