LEMONLDAP::NG : * new feature in devel : notification system
* now, there is a shared key that can be use to crypt datas (used in notification to hide cookie value)
This commit is contained in:
parent
477aa41115
commit
2540bb36f0
|
@ -14,6 +14,7 @@ requires:
|
|||
Regexp::Assemble: 0
|
||||
Storable: 0
|
||||
SOAP::Lite: 0
|
||||
Crypt::Rijndael: 0
|
||||
meta-spec:
|
||||
url: http://module-build.sourceforge.net/META-spec-v1.3.html
|
||||
version: 1.3
|
||||
|
|
|
@ -28,6 +28,7 @@ WriteMakefile(
|
|||
'Regexp::Assemble' => 0,
|
||||
'Cache::Cache' => 0,
|
||||
'SOAP::Lite' => 0,
|
||||
'Crypt::Rijndael' => 0,
|
||||
}, # e.g., Module::Name => 1.1
|
||||
#EXE_FILES => [ 'scripts/lmConfig_File2MySQL', ],
|
||||
(
|
||||
|
|
|
@ -12,6 +12,7 @@ no strict 'refs';
|
|||
use Data::Dumper;
|
||||
use Lemonldap::NG::Common::Conf::Constants;
|
||||
use Regexp::Assemble;
|
||||
use Crypt::Rijndael;
|
||||
|
||||
use constant DEFAULTCONFFILE => "/etc/lemonldap-ng/storage.conf";
|
||||
|
||||
|
@ -164,16 +165,22 @@ sub getConf {
|
|||
}
|
||||
else {
|
||||
$args->{cfgNum} ||= $self->lastCfg;
|
||||
my $r;
|
||||
unless ( ref( $self->{refLocalStorage} ) ) {
|
||||
$msg = "get remote configuration (localStorage unavailable)";
|
||||
return $self->getDBConf($args);
|
||||
$r = $self->getDBConf($args);
|
||||
}
|
||||
my $r = $self->{refLocalStorage}->get('conf');
|
||||
else {
|
||||
$r = $self->{refLocalStorage}->get('conf');
|
||||
if ( $r->{cfgNum} == $args->{cfgNum} ) {
|
||||
$msg = "configuration unchanged, get configuration from cache";
|
||||
return $r;
|
||||
}
|
||||
return $self->getDBConf($args);
|
||||
else {
|
||||
$r = $self->getDBConf($args);
|
||||
}
|
||||
}
|
||||
$r->{cipher} = Crypt::Rijndael->new( $r->{key} || 'lemonldap-ng-key', Crypt::Rijndael::MODE_CBC() );
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,11 +8,13 @@ our $VERSION = 0.22;
|
|||
sub prereq {
|
||||
my $self = shift;
|
||||
unless ( $self->{dirName} ) {
|
||||
$Lemonldap::NG::Common::Conf::msg = '"dirName" is required in "File" configuration type !';
|
||||
$Lemonldap::NG::Common::Conf::msg =
|
||||
'"dirName" is required in "File" configuration type !';
|
||||
return 0;
|
||||
}
|
||||
unless ( -d $self->{dirName} ) {
|
||||
$Lemonldap::NG::Common::Conf::msg = "Directory \"$self->{dirName}\" does not exist !";
|
||||
$Lemonldap::NG::Common::Conf::msg =
|
||||
"Directory \"$self->{dirName}\" does not exist !";
|
||||
return 0;
|
||||
}
|
||||
1;
|
||||
|
@ -40,7 +42,8 @@ sub lock {
|
|||
return 0 if ( $self->isLocked );
|
||||
}
|
||||
unless ( open F, ">" . $self->{dirName} . "/lmConf.lock" ) {
|
||||
$Lemonldap::NG::Common::Conf::msg = "Unable to lock (".$self->{dirName}."/lmConf.lock)\n";
|
||||
$Lemonldap::NG::Common::Conf::msg =
|
||||
"Unable to lock (" . $self->{dirName} . "/lmConf.lock)\n";
|
||||
return 0;
|
||||
}
|
||||
print F $$;
|
||||
|
@ -62,7 +65,9 @@ sub store {
|
|||
my ( $self, $fields ) = @_;
|
||||
my $mask = umask;
|
||||
umask( oct('0027') );
|
||||
unless( open FILE, '>' . $self->{dirName} . "/lmConf-" . $fields->{cfgNum} ) {
|
||||
unless ( open FILE,
|
||||
'>' . $self->{dirName} . "/lmConf-" . $fields->{cfgNum} )
|
||||
{
|
||||
$Lemonldap::NG::Common::Conf::msg = "Open file failed: $!";
|
||||
$self->unlock;
|
||||
return UNKNOWN_ERROR;
|
||||
|
@ -101,4 +106,5 @@ sub delete {
|
|||
unlink( $self->{dirName} . "/lmConf-$cfgNum" );
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
|
|
@ -89,6 +89,7 @@ lib/Lemonldap/NG/Portal/AuthSSL.pm
|
|||
lib/Lemonldap/NG/Portal/CDA.pm
|
||||
lib/Lemonldap/NG/Portal/Error.pm
|
||||
lib/Lemonldap/NG/Portal/Menu.pm
|
||||
lib/Lemonldap/NG/Portal/Notification.pm
|
||||
lib/Lemonldap/NG/Portal/SharedConf.pm
|
||||
lib/Lemonldap/NG/Portal/Simple.pm
|
||||
lib/Lemonldap/NG/Portal/UserDBLDAP.pm
|
||||
|
|
|
@ -44,6 +44,10 @@ my $portal = Lemonldap::NG::Portal::SharedConf->new(
|
|||
#customFunctions => 'function1 function2',
|
||||
#customFunctions => 'Package::func1 Package::func2',
|
||||
|
||||
# NOTIFICATIONS SERVICE
|
||||
# Use it to be able to notify messages during authentication
|
||||
#notification => 1,
|
||||
|
||||
# OTHERS
|
||||
# You can also overload any parameter issued from manager
|
||||
# configuration. Example:
|
||||
|
@ -104,6 +108,21 @@ if ( $portal->process() ) {
|
|||
print $portal->header('text/html; charset=utf8');
|
||||
print $template->output;
|
||||
}
|
||||
elsif( my $notif = $portal->notification ) {
|
||||
my $template = HTML::Template->new(
|
||||
filename => "$skin_dir/$skin/notification.tpl",
|
||||
die_on_bad_params => 0,
|
||||
cache => 0,
|
||||
filter => sub { $portal->translate_template(@_) }
|
||||
);
|
||||
$template->param( AUTH_ERROR => $portal->error );
|
||||
$template->param( AUTH_ERROR_TYPE => $portal->error_type );
|
||||
$template->param( AUTH_URL => $portal->get_url );
|
||||
$template->param( NOTIFICATION => $notif );
|
||||
|
||||
print $portal->header('text/html; charset=utf8');
|
||||
print $template->output;
|
||||
}
|
||||
else {
|
||||
|
||||
# HTML::Template object creation
|
||||
|
|
|
@ -6,6 +6,19 @@
|
|||
|
||||
<div class="loginlogo"></div>
|
||||
|
||||
<form action="#" method="post" class="login">
|
||||
<h3><lang en="New message(s)" fr="Nouveaux messages"/> :</h3>
|
||||
<table>
|
||||
<tr><td>
|
||||
<TMPL_VAR NAME="NOTIFICATION">
|
||||
<div class="buttons">
|
||||
<button type="submit" class="positive">
|
||||
<img src="skins/pastel/accept.png" alt="" />
|
||||
<lang en="Accept" fr="Accepter" />
|
||||
</button>
|
||||
</div>
|
||||
</td></tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<TMPL_INCLUDE NAME="footer.tpl">
|
||||
|
|
|
@ -672,7 +672,8 @@ L<http://forge.objectweb.org/project/showfiles.php?group_id=274>
|
|||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
Copyright (C) 2005-2007 by Xavier Guimard E<lt>x.guimard@free.frE<gt>
|
||||
Copyright (C) 2005-2007 by Clement OUDOT E<lt>clement@oodo.netE<gt>
|
||||
E<lt>coudot@linagora.comE<gt>
|
||||
|
||||
This library is free software; you can redistribute it and/or modify
|
||||
it under the same terms as Perl itself, either Perl version 5.8.4 or,
|
||||
|
|
|
@ -128,7 +128,7 @@ sub new {
|
|||
%$self = ( %h, %$self );
|
||||
}
|
||||
if ( $self->{notification} ) {
|
||||
require Lemonldap::NG::Common::Notification;
|
||||
require Lemonldap::NG::Portal::Notification;
|
||||
}
|
||||
if ( $self->{Soap} ) {
|
||||
require SOAP::Lite;
|
||||
|
@ -572,17 +572,19 @@ sub controlExistingSession {
|
|||
$self->{id} = $id;
|
||||
|
||||
# A session has been find => calling &existingSession
|
||||
my ( $r, $datas );
|
||||
%$datas = %h;
|
||||
my ($r);
|
||||
%{ $self->{sessionInfo} } = %h;
|
||||
untie(%h);
|
||||
if ( $self->{existingSession} ) {
|
||||
$r = &{ $self->{existingSession} }( $self, $id, $datas );
|
||||
$r =
|
||||
&{ $self->{existingSession} }( $self, $id, $self->{sessionInfo} );
|
||||
}
|
||||
else {
|
||||
$r = $self->existingSession( $id, $datas );
|
||||
$r = $self->existingSession( $id, $self->{sessionInfo} );
|
||||
}
|
||||
if ( $r == PE_DONE ) {
|
||||
$self->{error} = $self->_subProcess(qw(log autoRedirect));
|
||||
$self->{error} =
|
||||
$self->_subProcess(qw(log checkNotification autoRedirect));
|
||||
return $self->{error} || PE_DONE;
|
||||
}
|
||||
else {
|
||||
|
@ -732,17 +734,19 @@ sub checkNotification {
|
|||
my $self = shift;
|
||||
if ( $self->{notification} ) {
|
||||
my $tmp;
|
||||
if ( ref( $self->{notification} ) ) {
|
||||
$tmp = $self->{notification};
|
||||
if ( $self->{notificationStorage} ) {
|
||||
$tmp = $self->{notificationStorage};
|
||||
}
|
||||
else {
|
||||
$tmp = $self->{configStorage};
|
||||
$tmp->{dbiTable} = 'notifications';
|
||||
$tmp = $self->{lmConf};
|
||||
$self->abort( "notificationStorage not defined",
|
||||
"This parameter is required to use notification system" )
|
||||
unless ( ref($tmp) );
|
||||
$tmp->{table} = 'notifications';
|
||||
}
|
||||
if ( $self->{_notification} =
|
||||
Lemonldap::NG::Common::Notification->new($tmp)
|
||||
->getNotification( $self->{user} ) )
|
||||
{
|
||||
my $obj = Lemonldap::NG::Portal::Notification->new($tmp);
|
||||
$self->abort($Lemonldap::NG::Portal::Notification::msg) unless ($obj);
|
||||
if ( $self->{_notification} = $obj->getNotification($self) ) {
|
||||
return PE_NOTIFICATION;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user