Commit d2c11ddd authored by Nigel Kukard's avatar Nigel Kukard
Browse files

* Preliminary implementation of high performance SOAP engine

* GPL license update, downloaded from official site
* Updated license snippet at top of all files
* SOAP Modules are now called Plugins
* Started work on SOAP engine data caching
* New SOAP server config file format
parent 6017d214
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
......@@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
......@@ -55,7 +55,7 @@ patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
......@@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
......@@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
......@@ -225,7 +225,7 @@ impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
......@@ -278,7 +278,7 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
......@@ -303,10 +303,9 @@ the "copyright" line and a pointer to where the full notice is found.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
......@@ -336,5 +335,5 @@ necessary. Here is a sample; alter the names:
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
# Author: Nigel Kukard <nkukard@lbsd.net>
# Date: 06/09/2005
# Desc: SOAP authentication functions
# License: GPL
# SOAP authentication functions
# Copyright (C) 2005-2007 Nigel Kukard <nkukard@lbsd.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Predefined groups:
# everybody
# admins
# Authentication package
package Auth;
use strict;
use wiaflos::version;
use Data::Dumper;
require Exporter;
......@@ -24,6 +44,7 @@ our (@ISA,@EXPORT);
);
# Globals
my $AUTH_TIMEOUT = 3600;
......@@ -33,6 +54,105 @@ my $authData;
# Access control list
my @acl;
# Initialize ACLs
my $server;
sub init {
my $tmp = shift;
$server = $tmp;
}
# Add ACL item
sub aclAdd {
my ($package,$function,$group) = @_;
my $itemInfo;
# Setup item info
$itemInfo->{'package'} = $package;
$itemInfo->{'function'} = $function;
$itemInfo->{'group'} = $group;
printf(STDERR 'Adding %s::%s to group "%s"'."\n",$package,$function,$group);
push(@acl,$itemInfo);
# Map function into dispatch
$server->map_dispatch($package,$function);
}
# Set session data
sub sessionSetData {
my %data = @_;
# Set and reset data
$authData = \%data;
}
# Unset session data
sub sessionUnsetData {
my $data = shift;
# Set and reset data
$authData = undef;
}
# Return session data
sub sessionGetData {
return $authData;
}
# Return 0 if we authorized, -1 if not
sub checkAccess {
my ($uri,$package,$function) = @_;
# Check we have session data
if (!defined($authData)) {
die "Access denied. No active session";
}
# Loop with access controls
foreach my $i (@acl) {
# Next if we don't match
next if ($i->{'package'} ne $package || $i->{'function'} ne $function);
# Special group "everybody"
if ($i->{'group'} eq 'everybody') {
$authData->{'_server'}->log(4,"[AUTH] Function access to ${package}::${function} from '".$authData->{'Username'}."' [".$authData->{'Peer'}."]");
return;
}
}
# If we got here, we didn't return, so we not authorized
$authData->{'_server'}->log(1,"[AUTH] Access denied to ${package}::${function} from '".$authData->{'Username'}."' [".$authData->{'Peer'}."]");
die "Access denied to ${package}::${function}";
}
# Authentication keys
my %keys = ();
......@@ -96,7 +216,7 @@ sub isAuthorized {
# See if we match an allowed item
foreach my $itemInfo (@acl) {
if ($itemInfo->{'module'} eq $module && ($itemInfo->{'item'} eq $item || $itemInfo->{'item'} eq '*')) {
return 0;
return 0;
}
}
......
# Wiaflos SOAP server caching
# Copyright (C) 2007 Nigel Kukard <nkukard@lbsd.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Caching package
package Cache;
use strict;
use wiaflos::version;
require Exporter;
our (@ISA,@EXPORT);
@ISA = qw(Exporter);
@EXPORT = qw(
registerCache
);
use Data::Dumper;
# IPC Stuff
#my $IPC_key = "Wiaflos-$VERSION";
#use IPC::Shareable;
#my $lastmsg_handle = tie my $lastmsg, 'IPC::Shareable', undef, { 'destroy' => 1 };
1;
# vim: ts=4
# Author: Nigel Kukard <nkukard@lbsd.net>
# Date: 14/02/2007
# Desc: SOAP interface to Clients module
# License: GPL
# SOAP interface to Clients module
# Copyright (C) 2007 Nigel Kukard <nkukard@lbsd.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
package Clients;
......@@ -18,7 +30,6 @@ use wiaflos::server::Clients qw();
our $pluginInfo = {
Name => "Clients",
Funcs => [ qw(
ping
getClient
getClients
createClient
......@@ -33,13 +44,6 @@ our $pluginInfo = {
};
# Ping to see if we still working
sub ping {
print(STDERR "Clients: Got PING!\n");
return 0;
}
# Return a single client
sub getClient {
my (undef,$data) = @_;
......
# SOAP interface to Engine module
# Copyright (C) 2007 Nigel Kukard <nkukard@lbsd.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
package Engine;
use strict;
# Set library directory
use lib qw(../);
use Auth;
use wiaflos::server::Engine qw();
# Plugin info
our $pluginInfo = {
Name => "Engine",
Funcs => [ qw(
) ],
};
1;
# vim: ts=4
# Author: Nigel Kukard <nkukard@lbsd.net>
# Date: 27/10/2006
# Desc: SOAP interface to GL module
# License: GPL
# SOAP interface to GL module
# Copyright (C) 2006-2007 Nigel Kukard <nkukard@lbsd.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
package GL;
......@@ -18,7 +30,6 @@ use wiaflos::server::GL qw();
our $pluginInfo = {
Name => "General Ledger",
Funcs => [ qw(
ping
getAccounts
getTransactions
createTransaction
......@@ -32,12 +43,6 @@ our $pluginInfo = {
};
# Ping to see if we still working
sub ping {
print(STDERR "GL: Got PING!\n");
return 0;
}
# Return list of GL accounts
......
# Author: Nigel Kukard <nkukard@lbsd.net>
# Date: 11/02/2007
# Desc: SOAP interface to Inventory module
# License: GPL
# SOAP interface to Inventory module
# Copyright (C) 2007 Nigel Kukard <nkukard@lbsd.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
package Inventory;
......@@ -18,7 +30,6 @@ use wiaflos::server::Inventory qw();
our $pluginInfo = {
Name => "Inventory",
Funcs => [ qw(
ping
getInventory
createItem
removeItem
......@@ -27,12 +38,6 @@ our $pluginInfo = {
};
# Ping to see if we still working
sub ping {
print(STDERR "Inventory: Got PING!\n");
return 0;
}
# Backend function to sanitize a raw inventory item from database
sub sanitizeRawItem {
......
# Author: Nigel Kukard <nkukard@lbsd.net>
# Date: 14/02/2007
# Desc: SOAP interface to Invoicing module
# License: GPL
# SOAP interface to Invoicing module
# Copyright (C) 2007 Nigel Kukard <nkukard@lbsd.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
package Invoicing;
......@@ -29,12 +41,6 @@ our $pluginInfo = {
};
# Ping to see if we still working
sub ping {
print(STDERR "Invoicing: Got PING!\n");
return 0;
}
# Return list of client invoices
sub getInvoices {
......
# Author: Nigel Kukard <nkukard@lbsd.net>
# Date: 11/03/2007
# Desc: SOAP interface to Payments module
# License: GPL
# SOAP interface to Payments module
# Copyright (C) 2007 Nigel Kukard <nkukard@lbsd.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
package Payments;
......@@ -17,7 +29,6 @@ use wiaflos::server::Payments qw();
our $pluginInfo = {
Name => "Payments",
Funcs => [ qw(
ping
createPayment
getPayments
getPayment
......@@ -30,12 +41,6 @@ our $pluginInfo = {
# Ping to see if we still working
sub ping {
print(STDERR "Payments: Got PING!\n");
return 0;
}
# Create payment
......
# Author: Nigel Kukard <nkukard@lbsd.net>
# Date: 14/02/2007
# Desc: SOAP interface to Purchasing module
# License: GPL
# SOAP interface to Purchasing module
# Copyright (C) 2007 Nigel Kukard <nkukard@lbsd.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
package Purchasing;
......@@ -30,12 +42,6 @@ our $pluginInfo = {
};
# Ping to see if we still working
sub ping {
print(STDERR "Purchasing: Got PING!\n");
return 0;
}
# Return list of supplier invoices
sub getInvoices {
......
# Author: Nigel Kukard <nkukard@lbsd.net>
# Date: 11/03/2007
# Desc: SOAP interface to Receipting module
# License: GPL
# SOAP interface to Receipting module
# Copyright (C) 2007 Nigel Kukard <nkukard@lbsd.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
package Receipting;
......@@ -17,7 +29,6 @@ use wiaflos::server::Receipting qw();
our $pluginInfo = {
Name => "Receipting",
Funcs => [ qw(
ping
createReceipt
getReceipts
getReceipt
......@@ -31,12 +42,6 @@ our $pluginInfo = {
# Ping to see if we still working
sub ping {
print(STDERR "Receipting: Got PING!\n");
return 0;
}
# Create receipt
......
# SOAP test functions
# Copyright (C) 2005-2007 Nigel Kukard <nkukard@lbsd.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Test functions for soap implementation
package SOAPTest;
use strict;
use Auth qw();
use Data::Dumper;