summaryrefslogtreecommitdiff
path: root/FS/FS
diff options
context:
space:
mode:
authorkhoff <khoff>2005-03-10 22:49:43 +0000
committerkhoff <khoff>2005-03-10 22:49:43 +0000
commit98526af3dcd590daecea6f202a61a4b21589fbab (patch)
treeca5fdd84bdb8cd4c546ddd3f817df0050f50e530 /FS/FS
parente3feb073075218a5a3a39e0858f1feeb15354f36 (diff)
Add the ability to do freeside configuration lookups through the XMLRPC interface.
Diffstat (limited to 'FS/FS')
-rw-r--r--FS/FS/XMLRPC.pm47
1 files changed, 31 insertions, 16 deletions
diff --git a/FS/FS/XMLRPC.pm b/FS/FS/XMLRPC.pm
index d7ba75a..84f3e41 100644
--- a/FS/FS/XMLRPC.pm
+++ b/FS/FS/XMLRPC.pm
@@ -7,6 +7,7 @@ use Frontier::RPC2;
# Instead of 'use'ing freeside modules on the fly below, just preload them now.
use FS;
use FS::CGI;
+use FS::Conf;
use FS::Record;
use FS::cust_main;
@@ -96,23 +97,37 @@ sub _serve { #Subroutine, not method
warn "fssub: ${fssub}" if $DEBUG;
warn "params: " . Dumper($params) if $DEBUG;
- unless (UNIVERSAL::can("FS::${class}", $sub)) {
- warn "FS::XMLRPC: Can't call undefined subroutine '${fssub}'";
- # Should we encode an error in the response,
- # or just break silently to the remote caller and complain locally?
- return [];
- }
-
my @result;
- eval {
- no strict 'refs';
- my $fssub = "FS::${class}::${sub}";
- @result = (&$fssub(@$params));
- };
-
- if ($@) {
- warn "FS::XMLRPC: Error while calling '${fssub}': $@";
- return [];
+
+ if ($class eq 'Conf') { #Special case for FS::Conf because we need an obj.
+
+ if ($sub eq 'config') {
+ my $conf = new FS::Conf;
+ @result = ($conf->config(@$params));
+ } else {
+ warn "FS::XMLRPC: Can't call undefined subroutine '${fssub}'";
+ }
+
+ } else {
+
+ unless (UNIVERSAL::can("FS::${class}", $sub)) {
+ warn "FS::XMLRPC: Can't call undefined subroutine '${fssub}'";
+ # Should we encode an error in the response,
+ # or just break silently to the remote caller and complain locally?
+ return [];
+ }
+
+ eval {
+ no strict 'refs';
+ my $fssub = "FS::${class}::${sub}";
+ @result = (&$fssub(@$params));
+ };
+
+ if ($@) {
+ warn "FS::XMLRPC: Error while calling '${fssub}': $@";
+ return [];
+ }
+
}
warn Dumper(@result);