Subject: Developers of Sympa
List archive
[sympa-dev] Re: Re: Backporting createlist soap feature to sympa 5.2 branch ?
- From: Olivier Berger <address@concealed>
- To: address@concealed
- Cc: picolibre-developers <address@concealed>
- Subject: [sympa-dev] Re: Re: Backporting createlist soap feature to sympa 5.2 branch ?
- Date: Wed, 28 Feb 2007 14:47:51 +0100
Hmmm... I think you may be a bit pessimistic, as I seem to have managed
to add createList pretty easily in the 5.2.4 code with the attached
patch : basically, copy-pasting code from the sympa.wsdl and
sympasoap.pm files seems to work, at least for code such as :
$reponse =
$soap->authenticateAndRun($ARGV[1],$md5,'createList',['essai4','computers','discussion_list','Essai
numero 3','Un essai de creation via SOAP']);
(in sympa_soap_client.pl) ... which works also from phpgroupware's
nusoap-like soap client...
Soooo... I think it may be quite easy to backport at least simple
features like createList -> create_list_old ...
What d'you think ?
Best regards,
Le mardi 27 février 2007 à 13:30 +0100, address@concealed a écrit :
> Olivier Berger wrote:
> > Le mardi 27 février 2007 à 09:41 +0100, address@concealed a écrit :
> >
> > I may be wrong, but I would tend to think of the sympasoap as being only
> > a wrapper that needs not much work for adding new methods in the SOAP
> > interface, considering that such elements are already exiting and
> > callable from the web interface... but of course, there may be badly
> > designed interdependencies betw. Web UI and backend that render such
> > SOAP API enhancements difficult in 5.2.x ...
> >
> Yes there are some (too many), but we did also some code design changes
> in List.pm which is the main module shared by all others. In addition
> Conf.pm had also some changes. Of course the wsdl.tt2. That's the minimum.
> > Anyway, I'm gonna look at a diff -r and try to see by myself.
> >
> >
> You will have a lot of work in order to identify changes coming from
> the new SOAP service and thoses coming from others changes. Browse the
> CVS server can really help you . First of all check the change log, you
> will have the list of filed to patch.
>
> Serge Aumont
--
Olivier BERGER <address@concealed>
Ingénieur Recherche - Dept INF
INT Evry (http://www.int-evry.fr)
OpenPGP-Id: 1024D/6B829EEC
--- sympasoap.pm.orig 2007-02-28 11:41:52.000000000 +0100
+++ sympasoap.pm 2007-02-28 11:42:41.000000000 +0100
@@ -883,4 +883,124 @@
return $string
}
+sub createList {
+ my $class = shift;
+ my $listname = shift;
+ my $subject = shift;
+ my $template = shift;
+ my $description = shift;
+ my $topics = shift;
+
+ my $sender = $ENV{'USER_EMAIL'};
+ my $robot = $ENV{'SYMPA_ROBOT'};
+ my $remote_application_name = $ENV{'remote_application_name'};
+
+ &Log::do_log('info', 'SOAP createList(list = %s\@%s,subject = %s,template = %s,description = %s,topics = %s) from %s via proxy application %s', $listname,$robot,$subject,$template,$description,$topics,$sender,$remote_application_name);
+
+ unless ($sender) {
+ die SOAP::Fault->faultcode('Client')
+ ->faultstring('User not specified')
+ ->faultdetail('Use a trusted proxy or login first ');
+ }
+
+ my @resultSoap;
+
+ unless ($listname) {
+ die SOAP::Fault->faultcode('Client')
+ ->faultstring('Incorrect number of parameters')
+ ->faultdetail('Use : <list>');
+ }
+
+ &Log::do_log('debug', 'SOAP create_list(%s,%s)', $listname,$robot);
+
+ my $list = new List ($listname, $robot);
+ if ($list) {
+ &Log::do_log('info', 'create_list %s@%s from %s refused, list already exist', $listname,$robot,$sender);
+ die SOAP::Fault->faultcode('Client')
+ ->faultstring('List already exists')
+ ->faultdetail("List $listname already exists");
+ }
+
+ my $reject;
+ unless ($subject) {
+ $reject .= 'subject';
+ }
+ unless ($template) {
+ $reject .= ', template';
+ }
+ unless ($info) {
+ $reject .= ', info';
+ }
+ unless ($topics) {
+ $reject .= 'topics';
+ }
+ unless ($reject){
+ &Log::do_log('info', 'create_list %s@%s from %s refused, missing parameter(s) %s', $listname,$robot,$sender,$reject);
+ die SOAP::Fault->faultcode('Server')
+ ->faultstring('Missing parameter')
+ ->faultdetail("Missing required parameter(s) : $reject");
+ }
+ # check authorization
+ my $result = &List::request_action('create_list','md5',$robot,
+ {'sender' => $sender,
+ 'remote_host' => $ENV{'REMOTE_HOST'},
+ 'remote_addr' => $ENV{'REMOTE_ADDR'},
+ 'remote_application_name' => $ENV{'remote_application_name'} }
+ );
+ my $r_action;
+ my $reason;
+ if (ref($result) eq 'HASH') {
+ $r_action = $result->{'action'};
+ $reason = $result->{'reason'};
+ }
+ unless ($r_action =~ /do_it|listmaster/) {
+ &Log::do_log('info', 'create_list %s@%s from %s refused, reason %s', $listname,$robot,$sender,$reason);
+ die SOAP::Fault->faultcode('Server')
+ ->faultstring('Authorization reject')
+ ->faultdetail("Authorization reject : $reason");
+ }
+
+ # prepare parameters
+ my $param = {};
+ $param->{'user'}{'email'} = $sender;
+ if (&List::is_user_db($param->{'user'}{'email'})) {
+ $param->{'user'} = &List::get_user_db($sender);
+ }
+ my $parameters;
+ $parameters->{'creation_email'} =$sender;
+ my %owner;
+ $owner{'email'} = $param->{'user'}{'email'};
+ $owner{'gecos'} = $param->{'user'}{'gecos'};
+ push @{$parameters->{'owner'}},\%owner;
+
+ $parameters->{'listname'} = $listname;
+ $parameters->{'subject'} = $subject;
+ $parameters->{'description'} = $description;
+
+ if ($r_action =~ /listmaster/i) {
+ $param->{'status'} = 'pending' ;
+ }elsif ($r_action =~ /do_it/i) {
+ $param->{'status'} = 'open' ;
+ }
+
+ ## create liste
+ my $resul = &admin::create_list_old($parameters,$template,$robot);
+ unless(defined $resul) {
+ &Log::do_log('info', 'unable to create list %s@%s from %s ', $listname,$robot,$sender);
+ die SOAP::Fault->faultcode('Server')
+ ->faultstring('unable to create list')
+ ->faultdetail('unable to create list');
+ }
+
+ ## notify listmaster
+ if ($param->{'create_action'} =~ /notify/) {
+ if(&List::send_notify_to_listmaster('request_list_creation',$robot,{'listname' => $listname,'email' => $sender})) {
+ &Log::do_log('info','notify listmaster for list creation');
+ }else{
+ &Log::do_log('notice',"Unable to send notify 'request_list_creation' to listmaster");
+ }
+ }
+ return 1;
+}
+
1;
--- sympa.wsdl.orig 2007-02-28 11:37:16.000000000 +0100
+++ sympa.wsdl 2007-02-28 11:39:54.000000000 +0100
@@ -158,6 +158,18 @@
<part name="email" type="xsd:string"/>
</message>
+<message name="createListRequest">
+ <part name="list" type="xsd:string"/>
+ <part name="subject" type="xsd:string"/>
+ <part name="template" type="xsd:string"/>
+ <part name="description" type="xsd:string"/>
+ <part name="topics" type="xsd:string"/>
+</message>
+
+<message name="createListResponse">
+ <part name="return" type="xsd:boolean"/>
+</message>
+
<!-- portType part -->
@@ -214,6 +226,11 @@
<input message="tns:checkCookieRequest" />
<output message="tns:checkCookieResponse" />
</operation>
+ <operation name="createList">
+ <input message="tns:createListRequest" />
+ <output message="tns:createListResponse" />
+ </operation>
+
</portType>
@@ -390,6 +407,20 @@
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
+ <operation name="createList">
+ <soap:operation soapAction="urn:sympasoap#createList"/>
+ <input>
+ <soap:body use="encoded"
+ namespace="urn:sympasoap"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </input>
+ <output>
+ <soap:body use="encoded"
+ namespace="urn:sympasoap"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ </operation>
+
</binding>
<!-- service part -->
-
[sympa-dev] Backporting createlist soap feature to sympa 5.2 branch ?,
Olivier Berger, 02/26/2007
-
[sympa-dev] Re: Backporting createlist soap feature to sympa 5.2 branch ?,
serge . aumont, 02/27/2007
-
[sympa-dev] Re: Backporting createlist soap feature to sympa 5.2 branch ?,
Olivier Berger, 02/27/2007
-
[sympa-dev] Re: Re: Backporting createlist soap feature to sympa 5.2 branch ?,
serge . aumont, 02/27/2007
- [sympa-dev] Re: Re: Backporting createlist soap feature to sympa 5.2 branch ?, Olivier Berger, 02/28/2007
-
[sympa-dev] Re: Re: Backporting createlist soap feature to sympa 5.2 branch ?,
serge . aumont, 02/27/2007
-
[sympa-dev] Re: Backporting createlist soap feature to sympa 5.2 branch ?,
Olivier Berger, 02/27/2007
-
[sympa-dev] Re: Backporting createlist soap feature to sympa 5.2 branch ?,
serge . aumont, 02/27/2007
Archive powered by MHonArc 2.6.19+.