diff --git a/src/MGRAST/lib/resources2/abundanceprofile.pm b/src/MGRAST/lib/resources2/abundanceprofile.pm index fcbc96be..0e287bdd 100644 --- a/src/MGRAST/lib/resources2/abundanceprofile.pm +++ b/src/MGRAST/lib/resources2/abundanceprofile.pm @@ -114,7 +114,7 @@ sub instance { $job = $job->[0]; # check rights - unless ($job->{public} || exists($self->rights->{$id})) { + unless ($job->{public} || exists($self->rights->{$id}) || ($self->user && $self->user->has_right(undef, 'view', 'metagenome', '*'))) { $self->return_data( {"ERROR" => "insufficient permissions to view this data"}, 401 ); } diff --git a/src/MGRAST/lib/resources2/m5nr.pm b/src/MGRAST/lib/resources2/m5nr.pm index 9d8e34fd..d82fce2a 100644 --- a/src/MGRAST/lib/resources2/m5nr.pm +++ b/src/MGRAST/lib/resources2/m5nr.pm @@ -142,7 +142,7 @@ sub static { $self->return_data({"ERROR" => "invalid min_level for m5nr/ontology: ".$min_lvl." - valid types are [".join(", ", @ont_hier)."]"}, 500); } if ($pname && ($min_lvl ne 'level1')) { - @$data = $mgdb->get_hierarchy_slice('ontology', $source, $pname, $min_lvl); + $data = $mgdb->get_hierarchy_slice('ontology', $source, $pname, $min_lvl); } else { @$data = values %{ $mgdb->get_hierarchy('ontology', $source, undef, undef, $min_lvl) }; } @@ -155,7 +155,7 @@ sub static { $self->return_data({"ERROR" => "invalid min_level for m5nr/taxonomy: ".$min_lvl." - valid types are [".join(", ", @tax_hier)."]"}, 500); } if ($pname && ($min_lvl ne 'tax_domain')) { - @$data = $mgdb->get_hierarchy_slice('organism', undef, $pname, $min_lvl); + $data = $mgdb->get_hierarchy_slice('organism', undef, $pname, $min_lvl); } else { @$data = values %{ $mgdb->get_hierarchy('organism', undef, undef, undef, $min_lvl) }; } diff --git a/src/MGRAST/lib/resources2/matrix.pm b/src/MGRAST/lib/resources2/matrix.pm index fbd54341..632d8f85 100644 --- a/src/MGRAST/lib/resources2/matrix.pm +++ b/src/MGRAST/lib/resources2/matrix.pm @@ -340,7 +340,7 @@ sub prepare_data { push @$brows, { id => $rid, metadata => $rmd }; } my $mddb = MGRAST::Metadata->new(); - my $meta = $mddb->get_jobs_metadata_fast([keys %$col_ids], 1); + my $meta = $mddb->get_jobs_metadata_fast($data, 1); my $name = $mgdb->_name_map(); foreach my $cid (sort {$col_ids->{$a} <=> $col_ids->{$b}} keys %$col_ids) { my $cmd = exists($meta->{$cid}) ? $meta->{$cid} : undef; diff --git a/src/MGRAST/lib/resources2/metagenome.pm b/src/MGRAST/lib/resources2/metagenome.pm index 6d15d6b9..48880a32 100644 --- a/src/MGRAST/lib/resources2/metagenome.pm +++ b/src/MGRAST/lib/resources2/metagenome.pm @@ -23,12 +23,12 @@ sub new { "library" => [ 'reference library', 'reference to the related library object' ], "sample" => [ 'reference sample', 'reference to the related sample object' ], "project" => [ 'reference project', 'reference to the project object' ], - "metadata" => [ 'hash', 'key value pairs describing metadata' ], - "created" => [ 'date', 'time the object was first created' ], + "metadata" => [ 'hash', 'key value pairs describing metadata' ], + "created" => [ 'date', 'time the object was first created' ], "version" => [ 'integer', 'version of the object' ], - "url" => [ 'uri', 'resource location of this object instance' ], - "status" => ['cv', [['public', 'object is public'], - ['private', 'object is private']]], + "url" => [ 'uri', 'resource location of this object instance' ], + "status" => [ 'cv', [ ['public', 'object is public'], + ['private', 'object is private'] ] ], "sequence_type" => [ 'string', 'sequencing type' ] }; return $self; @@ -119,7 +119,7 @@ sub instance { $job = $job->[0]; # check rights - unless ($job->{public} || exists($self->rights->{$id})) { + unless ($job->{public} || exists($self->rights->{$id}) || ($self->user && $self->user->has_right(undef, 'view', 'metagenome', '*'))) { $self->return_data( {"ERROR" => "insufficient permissions to view this data"}, 401 ); }