2009-12-17 20:20:17 +01:00
|
|
|
|
## @file
|
|
|
|
|
# Lemonldap::NG manager main file
|
|
|
|
|
|
|
|
|
|
## @class
|
|
|
|
|
# Lemonldap::NG manager main class
|
2006-12-18 12:32:33 +01:00
|
|
|
|
package Lemonldap::NG::Manager;
|
|
|
|
|
|
|
|
|
|
use strict;
|
2009-12-17 20:20:17 +01:00
|
|
|
|
use Lemonldap::NG::Handler::CGI qw(:globalStorage :locationRules); #inherits
|
2010-03-01 21:32:28 +01:00
|
|
|
|
use Lemonldap::NG::Common::Conf; #link protected conf Configuration
|
|
|
|
|
use Lemonldap::NG::Common::Conf::Constants; #inherits
|
2006-12-18 12:32:33 +01:00
|
|
|
|
|
2012-10-16 14:00:38 +02:00
|
|
|
|
our $VERSION = '1.3.0';
|
2009-12-11 19:17:00 +01:00
|
|
|
|
our @ISA = qw(
|
|
|
|
|
Lemonldap::NG::Handler::CGI
|
|
|
|
|
Lemonldap::NG::Manager::Downloader
|
|
|
|
|
Lemonldap::NG::Manager::Uploader
|
2010-06-07 17:26:16 +02:00
|
|
|
|
Lemonldap::NG::Manager::Request
|
2009-12-11 19:17:00 +01:00
|
|
|
|
Lemonldap::NG::Manager::_Struct
|
|
|
|
|
Lemonldap::NG::Manager::_i18n
|
|
|
|
|
);
|
2006-12-18 12:32:33 +01:00
|
|
|
|
|
2009-12-17 20:20:17 +01:00
|
|
|
|
## @cmethod Lemonldap::NG::Manager new(hashRef args)
|
|
|
|
|
# Class constructor.
|
|
|
|
|
#@param args hash reference
|
|
|
|
|
#@return Lemonldap::NG::Manager object
|
2006-12-18 12:32:33 +01:00
|
|
|
|
sub new {
|
2006-12-23 16:42:58 +01:00
|
|
|
|
my ( $class, $args ) = @_;
|
2010-01-09 15:48:35 +01:00
|
|
|
|
|
2010-09-01 12:30:07 +02:00
|
|
|
|
# Output UTF-8
|
|
|
|
|
binmode( STDOUT, ':utf8' );
|
|
|
|
|
|
2010-01-09 15:48:35 +01:00
|
|
|
|
# Try to load local configuration parameters
|
2010-03-09 22:42:31 +01:00
|
|
|
|
my $conf = Lemonldap::NG::Common::Conf->new( $args->{configStorage} )
|
|
|
|
|
or Lemonldap::NG::Handler::CGI->abort( 'Unable to get configuration',
|
|
|
|
|
$Lemonldap::NG::Common::Conf::msg );
|
|
|
|
|
if ( my $localconf = $conf->getLocalConf(MANAGERSECTION) ) {
|
|
|
|
|
$args->{$_} ||= $localconf->{$_} foreach ( keys %$localconf );
|
2010-01-09 15:48:35 +01:00
|
|
|
|
}
|
|
|
|
|
|
2010-03-09 22:42:31 +01:00
|
|
|
|
my $self = $class->SUPER::new($args)
|
|
|
|
|
or $class->abort( 'Unable to start ' . __PACKAGE__,
|
|
|
|
|
'See Apache logs for more' );
|
|
|
|
|
|
2010-01-09 15:48:35 +01:00
|
|
|
|
# Default values
|
2010-03-01 21:32:28 +01:00
|
|
|
|
$self->{managerSkin} = "default" unless defined $self->{managerSkin};
|
|
|
|
|
$self->{managerCss} = "accordion.css" unless defined $self->{managerCss};
|
2010-11-05 15:01:57 +01:00
|
|
|
|
$self->{managerCssTheme} = "ui-lightness"
|
|
|
|
|
unless defined $self->{managerCssTheme};
|
2010-01-28 11:09:02 +01:00
|
|
|
|
$self->{managerTreeAutoClose} = "true"
|
|
|
|
|
unless defined $self->{managerTreeAutoClose};
|
|
|
|
|
$self->{managerTreeJqueryCss} = "true"
|
|
|
|
|
unless defined $self->{managerTreeJqueryCss};
|
2010-01-09 15:48:35 +01:00
|
|
|
|
|
2010-01-28 11:09:02 +01:00
|
|
|
|
# Save conf if ?data=
|
2010-11-01 23:32:06 +01:00
|
|
|
|
if ( my $rdata = $self->rparam('data') ) {
|
2009-12-11 19:17:00 +01:00
|
|
|
|
|
2010-09-01 17:02:55 +02:00
|
|
|
|
$self->lmLog( "Manager request: Save data $rdata", 'debug' );
|
2009-12-11 19:17:00 +01:00
|
|
|
|
require Lemonldap::NG::Manager::Uploader; #inherits
|
|
|
|
|
$self->confUpload($rdata);
|
|
|
|
|
$self->quit();
|
|
|
|
|
}
|
2010-01-28 11:09:02 +01:00
|
|
|
|
|
2010-03-12 18:54:16 +01:00
|
|
|
|
# File upload/download
|
2010-03-11 17:43:21 +01:00
|
|
|
|
elsif ( my $rfile = $self->rparam('file') ) {
|
|
|
|
|
|
2010-09-01 17:02:55 +02:00
|
|
|
|
$self->lmLog( "Manager request: File $rfile", 'debug' );
|
2010-03-20 18:14:28 +01:00
|
|
|
|
my @params = ('file');
|
|
|
|
|
if ( my $rfilename = $self->rparam('filename') ) {
|
|
|
|
|
push @params, ${$rfilename};
|
2010-03-15 12:21:12 +01:00
|
|
|
|
}
|
2010-03-11 17:43:21 +01:00
|
|
|
|
require Lemonldap::NG::Manager::Uploader; #inherits
|
2010-03-15 12:21:12 +01:00
|
|
|
|
$self->fileUpload(@params);
|
|
|
|
|
$self->quit();
|
2010-03-20 18:14:28 +01:00
|
|
|
|
}
|
2010-03-15 12:21:12 +01:00
|
|
|
|
|
|
|
|
|
# URL upload/download
|
|
|
|
|
elsif ( my $rurl = $self->rparam('url') ) {
|
|
|
|
|
|
2010-09-01 17:02:55 +02:00
|
|
|
|
$self->lmLog( "Manager request: URL $rurl", 'debug' );
|
2010-03-15 12:21:12 +01:00
|
|
|
|
require Lemonldap::NG::Manager::Uploader; #inherits
|
|
|
|
|
$self->urlUpload('url');
|
2010-03-12 13:56:14 +01:00
|
|
|
|
$self->quit();
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-23 10:23:40 +02:00
|
|
|
|
# Reload menu
|
|
|
|
|
elsif ( my $menu = $self->param('menu') ) {
|
|
|
|
|
|
|
|
|
|
$self->lmLog( "Manager request: Menu reload for num $menu", 'debug' );
|
|
|
|
|
$self->{cfgNum} = $menu;
|
|
|
|
|
print $self->header( -type => 'text/html;charset=utf-8' );
|
|
|
|
|
print $self->menu();
|
|
|
|
|
$self->quit();
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-07 17:26:16 +02:00
|
|
|
|
# Ask requests
|
|
|
|
|
elsif ( my $rreq = $self->rparam('request') ) {
|
|
|
|
|
|
2010-09-01 17:02:55 +02:00
|
|
|
|
$self->lmLog( "Manager request: $rreq", 'debug' );
|
2011-06-23 10:23:40 +02:00
|
|
|
|
require Lemonldap::NG::Manager::Request; #inherits
|
2010-06-07 17:26:16 +02:00
|
|
|
|
$self->request($rreq);
|
|
|
|
|
$self->quit();
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-28 11:09:02 +01:00
|
|
|
|
# Else load conf
|
2011-06-23 10:23:40 +02:00
|
|
|
|
require Lemonldap::NG::Manager::Downloader; #inherits
|
2009-12-11 19:17:00 +01:00
|
|
|
|
$self->{cfgNum} =
|
|
|
|
|
$self->param('cfgNum')
|
|
|
|
|
|| $self->confObj->lastCfg()
|
|
|
|
|
|| 'UNAVAILABLE';
|
2010-09-01 17:02:55 +02:00
|
|
|
|
|
2009-12-11 19:17:00 +01:00
|
|
|
|
if ( my $p = $self->param('node') ) {
|
2010-09-01 17:02:55 +02:00
|
|
|
|
|
|
|
|
|
$self->lmLog( "Manager request: load node $p", 'debug' );
|
2009-12-11 19:17:00 +01:00
|
|
|
|
print $self->header( -type => 'text/html; charset=utf8', );
|
|
|
|
|
print $self->node($p);
|
|
|
|
|
$self->quit();
|
|
|
|
|
}
|
2009-12-30 18:02:23 +01:00
|
|
|
|
if ( $self->param('cfgAttr') ) {
|
2010-09-01 17:02:55 +02:00
|
|
|
|
|
|
|
|
|
$self->lmLog( "Manager request: load configuration attributes",
|
|
|
|
|
'debug' );
|
2009-12-30 21:00:54 +01:00
|
|
|
|
$self->sendCfgParams( $self->conf );
|
2009-12-30 18:02:23 +01:00
|
|
|
|
}
|
2010-09-01 17:02:55 +02:00
|
|
|
|
|
2009-12-11 19:17:00 +01:00
|
|
|
|
return $self;
|
|
|
|
|
}
|
|
|
|
|
|
2009-12-17 20:20:17 +01:00
|
|
|
|
## @method string menu()
|
|
|
|
|
# Build the tree menu.
|
|
|
|
|
# @return HTML string
|
2009-12-11 19:17:00 +01:00
|
|
|
|
sub menu {
|
2006-12-18 12:32:33 +01:00
|
|
|
|
my $self = shift;
|
2009-12-17 20:20:17 +01:00
|
|
|
|
require Lemonldap::NG::Manager::Downloader;
|
2009-12-11 19:17:00 +01:00
|
|
|
|
return
|
2013-07-17 08:32:29 +02:00
|
|
|
|
'<ul class="simpleTree">'
|
2009-12-11 19:17:00 +01:00
|
|
|
|
. $self->li( 'root', 'root' )
|
2010-01-04 14:28:10 +01:00
|
|
|
|
. $self->span(
|
|
|
|
|
id => 'root',
|
|
|
|
|
text => "Configuration $self->{cfgNum}",
|
|
|
|
|
data => $self->{cfgNum},
|
|
|
|
|
js => 'cfgDatas',
|
|
|
|
|
help => 'default'
|
|
|
|
|
)
|
2009-12-11 19:17:00 +01:00
|
|
|
|
. '<ul>'
|
|
|
|
|
. $self->node()
|
|
|
|
|
. '</ul></li></ul>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
1;
|
2009-12-13 16:40:33 +01:00
|
|
|
|
__END__
|
|
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
|
2010-01-03 09:09:59 +01:00
|
|
|
|
=encoding utf8
|
|
|
|
|
|
2009-12-13 16:40:33 +01:00
|
|
|
|
Lemonldap::NG::Manager - Perl extension for managing Lemonldap::NG Web-SSO
|
|
|
|
|
system.
|
|
|
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
|
|
2010-01-09 15:48:35 +01:00
|
|
|
|
See example/index.pl
|
2009-12-13 16:40:33 +01:00
|
|
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
|
|
|
|
|
|
Lemonldap::NG::Manager provides a web interface to manage Lemonldap::NG Web-SSO
|
|
|
|
|
system.
|
|
|
|
|
|
|
|
|
|
=head1 SEE ALSO
|
|
|
|
|
|
|
|
|
|
L<Lemonldap::NG::Handler>, L<Lemonldap::NG::Portal>, L<CGI>,
|
2010-10-26 08:08:16 +02:00
|
|
|
|
L<http://lemonldap-ng.org/>
|
2009-12-13 16:40:33 +01:00
|
|
|
|
|
|
|
|
|
=head1 AUTHOR
|
|
|
|
|
|
2013-01-31 06:33:10 +01:00
|
|
|
|
=over
|
|
|
|
|
|
|
|
|
|
=item Clement Oudot, E<lt>clem.oudot@gmail.comE<gt>
|
|
|
|
|
|
|
|
|
|
=item Fran<EFBFBD>ois-Xavier Deltombe, E<lt>fxdeltombe@gmail.com.E<gt>
|
|
|
|
|
|
|
|
|
|
=item Xavier Guimard, E<lt>x.guimard@free.frE<gt>
|
|
|
|
|
|
2013-02-01 06:37:38 +01:00
|
|
|
|
=item Thomas Chemineau, E<lt>thomas.chemineau@gmail.comE<gt>
|
2013-01-31 06:33:10 +01:00
|
|
|
|
|
|
|
|
|
=back
|
2009-12-13 16:40:33 +01:00
|
|
|
|
|
|
|
|
|
=head1 BUG REPORT
|
|
|
|
|
|
|
|
|
|
Use OW2 system to report bug or ask for features:
|
2010-10-26 08:08:16 +02:00
|
|
|
|
L<http://jira.ow2.org>
|
2009-12-13 16:40:33 +01:00
|
|
|
|
|
|
|
|
|
=head1 DOWNLOAD
|
|
|
|
|
|
|
|
|
|
Lemonldap::NG is available at
|
|
|
|
|
L<http://forge.objectweb.org/project/showfiles.php?group_id=274>
|
|
|
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE
|
|
|
|
|
|
2013-01-31 06:33:10 +01:00
|
|
|
|
=over
|
|
|
|
|
|
|
|
|
|
=item Copyright (C) 2006, 2007, 2008, 2009, 2010, 2012 by Xavier Guimard, E<lt>x.guimard@free.frE<gt>
|
|
|
|
|
|
|
|
|
|
=item Copyright (C) 2012 by Fran<EFBFBD>ois-Xavier Deltombe, E<lt>fxdeltombe@gmail.com.E<gt>
|
|
|
|
|
|
|
|
|
|
=item Copyright (C) 2006, 2008, 2009, 2010, 2011, 2012 by Clement Oudot, E<lt>clem.oudot@gmail.comE<gt>
|
|
|
|
|
|
2013-02-01 06:37:38 +01:00
|
|
|
|
=item Copyright (C) 2010, 2011 by Thomas Chemineau, E<lt>thomas.chemineau@gmail.comE<gt>
|
2013-01-31 06:33:10 +01:00
|
|
|
|
|
|
|
|
|
=back
|
2009-12-13 16:40:33 +01:00
|
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify
|
2013-01-31 06:33:10 +01:00
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2, 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, see L<http://www.gnu.org/licenses/>.
|
2009-12-13 16:40:33 +01:00
|
|
|
|
|
|
|
|
|
=cut
|