# Copyright (c) 2005 bivio Software, Inc. All Rights Reserved. # # Visit http://www.bivio.biz for more info. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; If not, you may get a copy from: # http://www.opensource.org/licenses/lgpl-license.html # # $Id: TestBackdoor.pm,v 1.7 2009/12/04 17:30:53 dobbs Exp $ package Bivio::Biz::Action::TestBackdoor; use strict; use Bivio::Base 'Biz.Action'; our($VERSION) = sprintf('%d.%02d', q$Revision: 1.7 $ =~ /\d+/g); sub execute { my($proto, $req) = @_; $req->assert_test; my($q) = $req->get('query'); if (my $m = delete($q->{form_model})) { $m = Bivio::Biz::Model->get_instance($m); $m->execute($req, { map(($_ => ($m->get_field_type($_)->from_literal($q->{$_}))[0]), keys(%$q)), }); } elsif (my $u = delete($q->{shell_util})) { Bivio::ShellUtil->new_other($u)->main(split(' ', $q->{command})); } else { Bivio::Die->die($q, ': invalid query'); } return; } 1;