From 5ca4003b1d517f0039bb4b71cdd317cd91417956 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 28 Nov 2008 11:01:20 +0000 Subject: [PATCH] * The owner parameter is only set for admin roles. --- src/Hydra/lib/Hydra/Controller/Root.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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;