LEMONLDAP::NG : * uri in Menu.pm can now contains user datas

* protection documentation in Sessions.pm example file
This commit is contained in:
Xavier Guimard 2008-11-12 16:09:35 +00:00
parent 1aafc1049c
commit 7d6989a4a6
2 changed files with 26 additions and 3 deletions

View File

@ -17,6 +17,18 @@ our $cgi = Lemonldap::NG::Manager::Sessions->new({
https => 0,
jqueryUri => 'jquery.js',
imagePath => '/images/',
## PROTECTION, choose one of :
## * protection by manager
# protection => 'manager',
## * specify yourself the rule to apply (same as in the manager)
# protection => 'rule: $uid=admin',
## * all authenticate users are granted
# protection => 'authenticate
## * nothing : not protected
});
$cgi->process();

View File

@ -221,6 +221,12 @@ sub _displayCategory {
return $html;
}
sub _userParam {
my ( $self, $arg ) = @_;
$arg =~ s/\$([\w]+)/$self->{portalObject}->{sessionInfo}->{$1}/g;
return $arg;
}
# _displayApplication
# Create HTML code for an application
sub _displayApplication {
@ -231,7 +237,9 @@ sub _displayApplication {
# Get application items
my $appid = $app->getAttribute('id');
my $appname = $app->getElementsByTagName('name')->string_value() || $appid;
my $appuri = $app->getElementsByTagName('uri')->string_value() || "#";
my $appuri =
$self->_userParam( $app->getElementsByTagName('uri')->string_value()
|| "#" );
# Display application
$html .=
@ -253,7 +261,9 @@ sub _displayDescription {
# Get application items
my $appid = $_->getAttribute('id');
my $appname = $_->getElementsByTagName('name')->string_value();
my $appuri = $_->getElementsByTagName('uri')->string_value() || "#";
my $appuri =
$self->_userParam( $_->getElementsByTagName('uri')->string_value()
|| "#" );
my $appdesc = $_->getElementsByTagName('description')->string_value();
my $applogofile = $_->getElementsByTagName('logo')->string_value();
my $applogo = $self->{apps}->{imgpath} . $applogofile;
@ -280,7 +290,8 @@ sub _filterXML {
my @apps = $root->getElementsByTagName('application');
foreach (@apps) {
my $appdisplay = $_->getElementsByTagName('display')->string_value();
my $appuri = $_->getElementsByTagName('uri')->string_value();
my $appuri =
$self->_userParam( $_->getElementsByTagName('uri')->string_value() );
# Remove node if display is "no"
$_->unbindNode if ( $appdisplay eq "no" );