* The owner parameter is only set for admin roles.

This commit is contained in:
Eelco Dolstra 2008-11-28 11:01:20 +00:00
parent 2156e406b4
commit 5ca4003b1d

View file

@ -407,15 +407,17 @@ sub updateProject {
my $displayName = trim $c->request->params->{displayname}; my $displayName = trim $c->request->params->{displayname};
die "Invalid display name: $displayName" if $displayName eq ""; 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->name($projectName);
$project->displayname($displayName); $project->displayname($displayName);
$project->description(trim $c->request->params->{description}); $project->description(trim $c->request->params->{description});
$project->enabled(trim($c->request->params->{enabled}) eq "1" ? 1 : 0); $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; $project->update;