Merge pull request #5205 from solgenomics/topic/generic_trial_upload
[sgn.git] / lib / SGN / Controller / AJAX / BreedersToolbox / Boxplotter.pm
blob3864f12b7a4c89f5ecda26f2e9be870f1f75c7cf
1 package SGN::Controller::AJAX::BreedersToolbox::Boxplotter;
3 use Moose;
4 use Data::Dumper;
5 use CXGN::Dataset;
7 BEGIN { extends 'Catalyst::Controller::REST' }
9 __PACKAGE__->config(
10 default => 'application/json',
11 stash_key => 'rest',
12 map => { 'application/json' => 'JSON' },
15 sub get_constraints :Path('/ajax/tools/boxplotter/get_constraints') {
16 my $self = shift;
17 my $c = shift;
18 my $sp_dataset_id = $c->req->param('dataset');
19 my $unit = $c->req->param('unit');
20 my $sp_person_id = $c->user() ? $c->user->get_object()->get_sp_person_id() : undef;
21 my $ds = CXGN::Dataset->new(
22 people_schema => $c->dbic_schema("CXGN::People::Schema", undef, $sp_person_id),
23 schema => $c->dbic_schema("Bio::Chado::Schema", undef, $sp_person_id),
24 sp_dataset_id => $sp_dataset_id
26 if (!$c->user || $c->user->get_sp_person_id()!=$ds->sp_person_id()){
27 $c->stash->{rest} = [];
28 $c->response->status(403);
29 print STDERR Dumper ["NOKAY"];
30 return;
32 else {
33 $c->stash->{rest} = $ds->get_dataset_data();