Commit a25e10b0 authored by Xavier Guimard's avatar Xavier Guimard

LEMONLDAP::NG : * documentation modification

                * SOAP service to update notification database
parent 3f9e46d3
......@@ -316,14 +316,14 @@ EXTRACT_ANON_NSPACES = NO
# various overviews, but no documentation section is generated.
# This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_MEMBERS = YES
# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
# undocumented classes that are normally visible in the class hierarchy.
# If set to NO (the default) these classes will be included in the various
# overviews. This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_CLASSES = NO
HIDE_UNDOC_CLASSES = YES
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
# friend (class|struct|union) declarations.
......@@ -1322,7 +1322,7 @@ INCLUDED_BY_GRAPH = YES
# the time of a run. So in most cases it will be better to enable call graphs
# for selected functions only using the \callgraph command.
CALL_GRAPH = NO
CALL_GRAPH = YES
# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
# doxygen will generate a caller dependency graph for every global function
......
......@@ -448,7 +448,13 @@ documentation:
@cd doc/ && ../scripts/doc.pl
doxygen: clean
doxygen Doxyfile
COLLABORATIVE_GRAPH=1 doxygen Doxyfile
mkdir doc/devel/tmp
mv doc/devel/html/inherit* doc/devel/tmp/
COLLABORATIVE_GRAPH=0 doxygen Doxyfile
mv -f doc/devel/tmp/* doc/devel/html/
rm -rf doc/devel/tmp
perl -i -pe 's/Graphical Class Hierarchy/Class Collaboration Graph/' doc/devel/html/inherits.html doc/devel/html/tree.html
distclean: clean
......
......@@ -188,7 +188,7 @@ sub filter {
redo if defined $_;
} elsif (/^use\s+([\w:]+)/) {
my $inc = $1;
$inc =~ s/::/\//g;
#$inc =~ s/::/\//g;
$self->print("#include \"$inc.pm\"\n");
} elsif (/^package\s+([\w:]+)/) {
if ($current_class) {
......@@ -299,20 +299,27 @@ sub analyze_sub {
sub emit_class {
my( $self, $class, $line, $doc ) = @_;
my(@current_isa, @current_include, @links);
my(@current_isa, @current_priv_isa, @current_include, %links);
my $file = $self->file_contents();
while ($_ = $file->[$line++] ) {
if (/^\s*(?:use base|\@ISA\s*=|\@${class}::ISA\s*=)\s+(.+);/) {
push @current_isa, eval $1;
$file->[$line-1] = "\n";
} elsif (/^use\s+([\w:]+)/) {
} elsif (/^\s*(?:use|require)\s+([\w:]+)/) {
my $inc = $1;
$links{$1||'public'}{$inc} = $2 . ($3 ? "\n* $3" : '') if (/#\s*link\s+(?:(private|protected|public)\s+)?(\S+)(?:\s+(.*))?\s*$/);
push @current_priv_isa, $inc if (/#\s*inherits/);
$inc =~ s/::/\//g;
$inc =~ s#Lemonldap/NG/(\w+)#"lemonldap-ng-".lc($1)."/lib/Lemonldap/NG/$1"#e;
print STDERR $inc;
push @current_include, $inc;
push @links, $inc if (/#link$/);
$file->[$line-1] = "\n";
} elsif (/^package/) {
last;
} elsif (/#\s*inherits\s+([\w:]+)/) {
push @current_priv_isa, $1;
} elsif (/#\s*link\s+([\w:]+)\s+(?:(private|protected|public)\s+)?(\S+)(?:\s+(.*))?\s*$/) {
$links{$2||'public'}{$1} = $3 . ($4 ? "\n* $4" : '');
}
}
......@@ -326,16 +333,29 @@ sub emit_class {
}
$self->print("class $class");
if (@current_isa) {
$self->print(":",
join(", ", map {"public $_"} @current_isa) );
if (@current_isa or @current_priv_isa) {
my @tmp;
@tmp = map {"public $_"} @current_isa;
if($ENV{COLLABORATIVE_GRAPH}) {
foreach my $type(qw(public protected private)) {
push @tmp, map {"$type $_"} keys %{$links{$type}};
}
}
push @tmp, map {"private $_"} @current_priv_isa;
$self->print(":", join(", ", @tmp));
}
$self->print(" {\n");
if (@links) {
$self->print("public:\n");
$self->print("$_ depends;\n") foreach(@links);
foreach my $target(qw(private protected public)) {
if($links{$target}) {
$self->print("$target:\n");
foreach(keys %{$links{$target}}) {
$self->print("/** \@var $_ $links{$target}{$_}\n");
$links{$target}{$_} =~ s/\n.*$//s;
$self->print("*/\n$_ $links{$target}{$_};\n");
}
}
}
$self->print("public:\n");
$self->print("public:\n") unless($links{public});
}
......
......@@ -10,6 +10,7 @@ use strict;
use MIME::Base64;
use Time::Local;
use CGI;
#inherits Lemonldap::NG::Common::CGI::SOAPServer
our $VERSION = '0.31';
......
......@@ -10,10 +10,14 @@ package Lemonldap::NG::Common::Conf;
use strict;
no strict 'refs';
use Data::Dumper;
use Lemonldap::NG::Common::Conf::Constants;
use Lemonldap::NG::Common::Crypto;
use Lemonldap::NG::Common::Conf::Constants; #inherits
use Lemonldap::NG::Common::Crypto; #link protected cipher Object "cypher" in configuration hash
use Regexp::Assemble;
#inherits Lemonldap::NG::Common::Conf::File
#inherits Lemonldap::NG::Common::Conf::DBI
#inherits Lemonldap::NG::Common::Conf::SOAP
use constant DEFAULTCONFFILE => "/etc/lemonldap-ng/storage.conf";
our $VERSION = 0.51;
......
package Lemonldap::NG::Common::Conf::File;
use strict;
use Lemonldap::NG::Common::Conf::Constants;
use Lemonldap::NG::Common::Conf::Constants; #inherits
our $VERSION = 0.22;
......
......@@ -8,7 +8,7 @@ package Lemonldap::NG::Handler::AuthBasic;
use strict;
use Lemonldap::NG::Handler::SharedConf qw(:all);
use Lemonldap::NG::Portal::SharedConf;
use Lemonldap::NG::Portal::SharedConf; #inherits
use Digest::MD5 qw(md5_base64);
use MIME::Base64;
......
......@@ -14,6 +14,7 @@ use MIME::Base64;
use base qw(Lemonldap::NG::Common::CGI);
use Lemonldap::NG::Handler::SharedConf qw(:all);
#inherits Lemonldap::NG::Handler::_CGI
our $VERSION = '0.2';
......
......@@ -19,7 +19,7 @@ use strict;
use Lemonldap::NG::Handler::Simple qw(:all);
use Lemonldap::NG::Handler::Vhost;
use Lemonldap::NG::Common::Conf;
use Lemonldap::NG::Common::Conf; #link protected lmConf
use Cache::Cache qw($EXPIRES_NEVER);
use base qw(Lemonldap::NG::Handler::Vhost Lemonldap::NG::Handler::Simple);
......
......@@ -20,6 +20,9 @@ use Exporter 'import';
use Safe;
require Data::Dumper;
require POSIX;
#inherits Cache::Cache
#inherits Apache::Session
#inherits Lemonldap::NG::Common::Apache::Session::SOAP
our $VERSION = '0.9';
......
......@@ -6,6 +6,7 @@ package Lemonldap::NG::Handler::Status;
use strict;
use POSIX;
use Data::Dumper;
#inherits Cache::Cache
our $VERSION = "0.2";
......
......@@ -5,7 +5,7 @@
# This class adds virtual host support for Lemonldap::NG handlers.
package Lemonldap::NG::Handler::Vhost;
use Lemonldap::NG::Handler::Simple qw(:locationRules :headers);
use Lemonldap::NG::Handler::Simple qw(:locationRules :headers); #inherits
use strict;
use MIME::Base64;
......
......@@ -10,15 +10,16 @@ use strict;
use XML::Simple;
use Lemonldap::NG::Common::CGI;
use Lemonldap::NG::Common::Conf;
use Lemonldap::NG::Manager::_HTML;
require Lemonldap::NG::Manager::_Response;
require Lemonldap::NG::Manager::_i18n;
require Lemonldap::NG::Manager::Help;
use Lemonldap::NG::Common::Conf::Constants;
use Lemonldap::NG::Common::Conf; #link protected conf Configuration
use Lemonldap::NG::Manager::_HTML; #inherits
require Lemonldap::NG::Manager::_Response; #inherits
require Lemonldap::NG::Manager::_i18n; #inherits
require Lemonldap::NG::Manager::Help; #inherits
use Lemonldap::NG::Common::Conf::Constants; #inherits
use LWP::UserAgent;
use Safe;
use MIME::Base64;
#inherits Lemonldap::NG::Handler::CGI
use base qw(Lemonldap::NG::Common::CGI);
our @ISA;
......@@ -54,6 +55,7 @@ sub new {
my ( $class, $args ) = @_;
my $self;
if ( $args->{protection} ) {
require Lemonldap::NG::Handler::CGI;
unshift @ISA, "Lemonldap::NG::Handler::CGI";
$self = $class->SUPER::new($args);
}
......
......@@ -8,7 +8,7 @@ package Lemonldap::NG::Manager::Restricted;
use strict;
use Lemonldap::NG::Manager;
use Lemonldap::NG::Common::Conf::Constants;
use Lemonldap::NG::Common::Conf::Constants; #inherits
use base qw(Lemonldap::NG::Manager);
our $VERSION = "0.1";
......
......@@ -2,7 +2,7 @@ package Lemonldap::NG::Manager::SOAPServer;
use strict;
use SOAP::Transport::HTTP;
use Lemonldap::NG::Common::Conf;
use Lemonldap::NG::Common::Conf; #link protected config Configuration hash reference
use UNIVERSAL qw(isa);
our $VERSION = "0.3";
......
......@@ -7,7 +7,8 @@ package Lemonldap::NG::Manager::Sessions;
use strict;
use Lemonldap::NG::Handler::CGI qw(:globalStorage :locationRules);
use Lemonldap::NG::Common::Apache::Session;
use Lemonldap::NG::Common::Apache::Session; #inherits
#inherits Apache::Session
our $VERSION = '0.1';
......
......@@ -10,8 +10,8 @@ package Lemonldap::NG::Manager::_HTML;
# comes for the first time.
use AutoLoader qw(AUTOLOAD);
require Lemonldap::NG::Manager::_i18n;
use Lemonldap::NG::Common::Conf::Constants;
require Lemonldap::NG::Manager::_i18n; #inherits
use Lemonldap::NG::Common::Conf::Constants; #inherits
our $VERSION = '0.31';
......
......@@ -6,9 +6,9 @@
package Lemonldap::NG::Portal::AuthLDAP;
use Lemonldap::NG::Portal::Simple;
use Lemonldap::NG::Portal::_LDAP;
use Lemonldap::NG::Portal::_LDAP; #link protected ldap
use Lemonldap::NG::Portal::_WebForm;
use Lemonldap::NG::Portal::UserDBLDAP;
use Lemonldap::NG::Portal::UserDBLDAP; #inherits
our $VERSION = '0.2';
use base qw(Lemonldap::NG::Portal::_WebForm);
......
......@@ -9,9 +9,10 @@ use strict;
use warnings;
require Lemonldap::NG::Common::CGI;
use Lemonldap::NG::Portal::SharedConf;
use Lemonldap::NG::Portal::_LDAP;
use Lemonldap::NG::Portal::_LDAP; #link protected ldap Object used to change passwords only
use XML::LibXML;
use Safe;
#inherits Net::LDAP::Control::PasswordPolicy
our $VERSION = '0.01';
......
......@@ -14,10 +14,10 @@ use CGI::Cookie;
use MIME::Base64;
our $VERSION = '0.01';
our ( $msg, $stylesheet, $parser );
our ( $msg, $stylesheet, $parser, $self );
BEGIN {
my $xslt = XML::LibXSLT->new();
my $xslt = XML::LibXSLT->new();
$parser = XML::LibXML->new();
my $style_doc = $parser->parse_string(
q#<?xml version="1.0" encoding="UTF-8"?>
......@@ -60,7 +60,7 @@ BEGIN {
# @return Lemonldap::NG::Portal::Notification object
sub new {
my ( $class, $storage ) = @_;
my $self = bless {}, $class;
$self = bless {}, $class;
(%$self) = (%$storage);
$self->{type} = "Lemonldap::NG::Common::Conf::$self->{type}"
unless $self->{type} =~ /^Lemonldap::/;
......@@ -110,16 +110,16 @@ sub getNotification {
foreach my $notif (@notifs) {
$i++;
eval {
eval {
my $xml = $parser->parse_string($notif);
my $results = $stylesheet->transform( $xml, start => $i );
$form .= $stylesheet->output_string($results);
};
if ($@) {
$form .= $stylesheet->output_string($results);
};
if ($@) {
print STDERR
"Bad XML file: a notification for $uid was not done ($@)\n";
return 0;
}
return 0;
}
}
# Now a notification has to be done. Replace cookies by hidden fields
......@@ -184,7 +184,9 @@ sub checkNotification {
push @{ $checks->{$1} }, $2;
}
}
$portal->controlExistingSession() unless ( $portal->{sessionInfo} );
unless ( $portal->{sessionInfo} ) {
print STDERR "Invalid session\n";
return 0;
}
my $result = 1;
......@@ -243,6 +245,55 @@ sub checkNotification {
return $result;
}
## @method int newNotification(string xml)
# Check XML datas and insert new notifications.
# @param $xml XML string containing notification
# @return number of notifications done
sub newNotification {
my ( $class, $xml ) = @_;
eval { $xml = $parser->parse_string($xml); };
if ($@) {
print STDERR "Unable to read XML file : $@\n";
return 0;
}
my @notifs;
my ( $version, $encoding ) = ( $xml->version(), $xml->encoding() );
foreach
my $notif ( $xml->documentElement->getElementsByTagName('notification') )
{
my @datas = ();
foreach (qw(date uid reference)) {
my $tmp;
unless ( $tmp = $notif->getAttribute($_) ) {
print STDERR "Attribute $_ is missing\n";
return 0;
}
push @datas, $tmp;
}
my $result = XML::LibXML::Document->new( $version, $encoding );
my $root = XML::LibXML::Element->new('root');
$root->appendChild($notif);
$result->setDocumentElement($root);
push @notifs, [ @datas, $result->serialize ];
}
my $tmp = $self->{type};
$tmp =~ s/.*:://;
$tmp = "newNotif" . $tmp;
my $count;
foreach (@notifs) {
$count++;
my ( $r, $err ) = $self->$tmp(@$_);
die "$err" unless ($r);
}
return $count;
}
## @method protected array getFile(string uid,string ref)
# In file context, returns notifications corresponding to the user $uid.
# If $ref is set, returns only notification corresponding to this reference.
# @param $uid UID
# @param $ref Notification reference
# @return Array of XML strings
sub getFile {
my ( $self, $uid, $ref ) = @_;
return () unless ($uid);
......@@ -270,7 +321,21 @@ sub getFile {
sub deleteFile {
my ( $self, $file ) = @_;
return unlink( $self->{dirName} . "/$file" );
my $new = ($file =~ /(.*?)(?:\.xml)$/)[0] . '.done';
return rename( $self->{dirName} . "/$file", $self->{dirName} . "/$new" );
}
sub newNotifFile {
my ( $class, $date, $uid, $ref, $xml ) = @_;
$date =~ s/-//g;
return ( 0, "Bad date" ) unless ( $date =~ /^\d{8}/ );
my $filename =
$self->{dirName}
. "/${date}_${uid}_"
. encode_base64( $ref, '' ) . ".xml";
open F, ">$filename" or return ( 0, "Unable to create $filename ($!)" );
print F $xml;
return close F;
}
sub prereq {
......
......@@ -7,7 +7,7 @@ package Lemonldap::NG::Portal::SharedConf;
use strict;
use Lemonldap::NG::Portal::Simple qw(:all);
use Lemonldap::NG::Common::Conf;
use Lemonldap::NG::Common::Conf; #link protected lmConf Configuration
*EXPORT_OK = *Lemonldap::NG::Portal::Simple::EXPORT_OK;
*EXPORT_TAGS = *Lemonldap::NG::Portal::Simple::EXPORT_TAGS;
......
......@@ -15,9 +15,20 @@ use MIME::Base64;
use Lemonldap::NG::Common::CGI;
use CGI::Cookie;
require POSIX;
use Lemonldap::NG::Portal::_i18n;
use Lemonldap::NG::Portal::_i18n; #inherits
use Safe;
# Special comments for doxygen
#inherits Lemonldap::NG::Portal::AuthApache
#inherits Lemonldap::NG::Portal::AuthCAS
#inherits Lemonldap::NG::Portal::AuthLDAP
#inherits Lemonldap::NG::Portal::AuthSSL
#inherits Lemonldap::NG::Portal::Menu
#inherits Lemonldap::NG::Portal::Notification
#inherits Lemonldap::NG::Portal::UserDBLDAP
#inherits Apache::Session
#inherits Lemonldap::NG::Common::Apache::Session::SOAP
our $VERSION = '0.86';
use base qw(Lemonldap::NG::Common::CGI Exporter);
......@@ -144,6 +155,12 @@ sub new {
$self->abort($Lemonldap::NG::Portal::Notification::msg)
unless ( $self->{notifObject} );
}
if ( $self->{notification} and $ENV{PATH_INFO} and $ENV{PATH_INFO} =~ "/notification" ) {
require SOAP::Lite;
$Lemonldap::NG::Portal::Notification::self = $self->{notifObject};
$self->soapTest('Lemonldap::NG::Portal::Notification::newNotification');
$self->abort('Bad request', 'Only SOAP requests are accepted with "/notification"');
}
if ( $self->{Soap} ) {
require SOAP::Lite;
$self->soapTest("${class}::getCookies ${class}::error");
......
......@@ -6,7 +6,7 @@
package Lemonldap::NG::Portal::UserDBLDAP;
use Lemonldap::NG::Portal::Simple;
use Lemonldap::NG::Portal::_LDAP;
use Lemonldap::NG::Portal::_LDAP; #link protected ldap
our $VERSION = '0.1';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment