Skip to content

Commit

Permalink
fixed issue with correct permissions not resolving when using Job->init
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis Harrison committed Nov 27, 2012
1 parent 0830524 commit ced3d08
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/MGRAST/lib/resources2/metagenome.pm
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,12 @@ sub instance {
my $master = $self->connect_to_datasource();

# get data
my $job = $master->Job->init( {metagenome_id => $id} );
unless ($job && ref($job)) {
$self->return_data( {"ERROR" => "id $id does not exists"}, 404 );
my $job = $master->Job->get_objects( {metagenome_id => $id} );
unless ($job && @$job) {
$self->return_data( {"ERROR" => "id $id does not exist"}, 404 );
}

$job = $job->[0];

# check rights
unless ($job->{public} || exists($self->rights->{$id})) {
$self->return_data( {"ERROR" => "insufficient permissions to view this data"}, 401 );
Expand Down

0 comments on commit ced3d08

Please sign in to comment.