Documentation applicable for LemonLDAP::NG >= 0.9.3
Presentation
Menu is a new Portal module providing these functionalities:
- Display an application list to the connected user, with possibility to hide applications he did not have access to.
- Provide a simple "change password" form that respect Password Policy LDAP draft.
- Logout with confirmation.
With a 0.9.3 fresh installation, the default portal/index.pl enables the menu. For the others, add this to the perl code:
if ( $portal->process() ) { # HTML::Template object creation
my $template = HTML::Template->new(
filename => "$skin_dir/$skin/menu.tpl",
die_on_bad_params => 0,
cache => 0,
filter => sub { $portal->translate_template(@_) }
); # Menu creation
use Lemonldap::NG::Portal::Menu;
my $menu = Lemonldap::NG::Portal::Menu->new(
{
portalObject => $portal,
apps => {
xmlfile => "$appsxmlfile",
imgpath => "$appsimgpath",
},
modules => {
appslist => 1,
password => USER_CAN_CHANGE_PASSWORD,
logout => DISPLAY_LOGOUT,
},
# CUSTOM FUNCTION : if you want to create customFunctions in rules, declare them here
#customFunctions => 'function1 function2',
}
); $template->param( AUTH_USER => $portal->{sessionInfo}->{$user_attr} );
$template->param( AUTOCOMPLETE => AUTOCOMPLETE );
$template->param( SKIN => $skin )
$template->param( AUTH_ERROR => $menu->error );
$template->param( AUTH_ERROR_TYPE => $menu->error_type );
$template->param( DISPLAY_APPSLIST => $menu->displayModule("appslist") );
$template->param( DISPLAY_PASSWORD => $menu->displayModule("password") );
$template->param( DISPLAY_LOGOUT => $menu->displayModule("logout") );
$template->param( DISPLAY_TAB => $menu->displayTab );
$template->param( LOGOUT_URL => "$ENV{SCRIPT_NAME}?logout=1" );
$template->param( REQUIRE_OLDPASSWORD => REQUIRE_OLDPASSWORD );
if ( $menu->displayModule("appslist") ) {
$template->param( APPSLIST_MENU => $menu->appslistMenu );
$template->param( APPSLIST_DESC => $menu->appslistDescription );
} print $portal->header('text/html; charset=utf8');
print $template->output;
}
Set the visibility of each modules
In the source code of the portal, you have :
modules => {
appslist => 1,
password => USER_CAN_CHANGE_PASSWORD,
logout => DISPLAY_LOGOUT,
},"1" means the module is always displayed, and "0" means never. But you can adapt it to the user profile, for example display the password modification form only to user with employeeType equal to "internal" :
modules => {
appslist => 1,
password => '$employeeType =~ /binternalb/',
logout => DISPLAY_LOGOUT,
},
Configure applications list
DTD
The XML applications list must respect this DTD:
<!ELEMENT menu (category*) ><!ELEMENT category (application*, category*) >
<!ATTLIST category name CDATA #REQUIRED ><!ELEMENT application (name, uri?, description?, logo?, screenshot?, display?) >
<!ATTLIST application id ID #REQUIRED ><!ELEMENT name ( #PCDATA ) >
<!ELEMENT uri ( #PCDATA ) >
<!ELEMENT description ( #PCDATA ) >
<!ELEMENT logo ( #PCDATA ) >
<!ELEMENT screenshot ( #PCDATA ) >
<!ELEMENT display ( #PCDATA ) >
Parameters definition
- Category:
- Name of the category (required)
- Application:
- ID: unique id of the application inside XML file (required).
- Name: friendly name of the applications (required).
- URI: full URI of the application, with http(s)://, and path, page, etc.
- Description: description of the application.
- Logo: file name of the logo.
- Screenshot: file name of the screenshot.
- Display:
- "auto": display application only if the user has access to it.
- "on": always display.
- "off": never display.
The menu must contains at least one category. Each category can contain applications and categories. An application cannot contain a category. An application must be inside a category.
Sample XML file
Now you can configure your applications list, in /etc/lemonldap-ng/apps-list.xml. For example:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE menu SYSTEM "apps-list.dtd">
<menu>
<category name="Business">
<application id="aaa">
<name>AAA</name>
<uri>http://test.ow2.org/aaa</uri>
<description>AAA description</description>
<logo>aaa-logo.gif</logo>
<display>auto</display>
</application>
<application id="bbb">
<name>BBB</name>
<uri>http://test.ow2.org/bbb/login.do</uri>
<description>BBB description</description>
<logo>bbb-logo.gif</logo>
<display>on</display>
</application>
</category>
<category name="Technical">
<category name="Directories">
<application id="pla">
<name>phpLDAPAdmin</name>
<uri>http://phpldapadmin.ow2.org</uri>
<description>LDAP directory administration</description>
<logo>pla-logo.gif</logo>
<display>auto</display>
</application>
</category>
<category name="Application servers">
<application id="probe">
<name>Probe</name>
<uri>http://probe.ow2.org</uri>
<description>Tomcat stats</description>
<logo>probe-logo.gif</logo>
<display>auto</display>
</application>
</category>
</category>
</menu>