Sophie

Sophie

distrib > Mandriva > cooker > x86_64 > by-pkgid > a100f0997407ff82957e996a98fb9db2 > files > 175

lemonldap-ng-1.0-0.3.rc1mdv2011.0.noarch.rpm

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr">
<head>
  <meta name="generator" content=
  "HTML Tidy for Linux/x86 (vers 7 December 2008), see www.w3.org" />

  <title>Lemonldap::NG documentation: 4.2-Configure-portal-menu.html</title>
  <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
  <style type="text/css">
/*<![CDATA[*/
    body{
      background: #ddd;
      font-family: sans-serif;
      font-size: 11pt;
      padding: 0 50px;
    }
    div.main-content{
      padding: 10px;
      background: #fff;
      border: 2px #ccc solid;
    }
    a{
      text-decoration: none;
    }
    p.footer{
      text-align: center;
      margin: 5px 0 0 0;
    }
    .heading-1{
      text-align: center;
      color: orange;
      font-variant: small-caps;
      font-size: 20pt;
    }
    .heading-1-1{
      color: orange;
      font-size: 14pt;
      border-bottom: 2px #ccc solid;
    }
    pre{
      background: #eee;
      border: 2px #ccc solid;
      padding: 5px;
      border-left: 10px #ccc solid;
    }
    ul.star li{
      list-style-type: square;
    }
  /*]]>*/
  </style>
</head>

<body>
  <div class="main-content">
    <h2 class="heading-1"><span id="HEnhancedmenu">Enhanced menu</span></h2>

    <p class="paragraph"></p>

    <ul>
      <li><a href="#HPresentation">Presentation</a></li>

      <li><a href="#HActivatethemenuintheportal">Activate the menu in the
      portal</a></li>

      <li><a href="#HSetthevisibilityofeachmodules">Set the visibility of each
      modules</a></li>

      <li>
        <a href="#HConfigureapplicationslist">Configure applications list</a>

        <ul>
          <li><a href="#HDTD">DTD</a></li>

          <li><a href="#HParametersdefinition">Parameters definition</a></li>

          <li><a href="#HSampleXMLfile">Sample XML file</a></li>
        </ul>
      </li>
    </ul><strong class="strong">Documentation applicable for LemonLDAP::NG
    &gt;= 0.9.3</strong>

    <h3 class="heading-1-1"><span id="HPresentation">Presentation</span></h3>

    <p class="paragraph"></p>Menu is a new Portal module providing these
    functionalities:

    <ul class="star">
      <li>Display an application list to the connected user, with possibility
      to hide applications he did not have access to.</li>

      <li>Provide a simple "change password" form that respect Password Policy
      LDAP draft.</li>

      <li>Logout with confirmation.</li>
    </ul>

    <h3 class="heading-1-1"><span id="HActivatethemenuintheportal">Activate
    the menu in the portal</span></h3>

    <p class="paragraph"></p>With a 0.9.3 fresh installation, the default
    portal/index.pl enables the menu. For the others, add this to the perl
    code:

    <p class="paragraph"></p>

    <div class="code">
      <pre>
<span class=
"java-keyword">if</span> ( $portal-&gt;process() ) {<br /><br />    # HTML::Template object creation
    my $template = HTML::Template-&gt;<span class="java-keyword">new</span>(
        filename          =&gt; <span class=
"java-quote">"$skin_dir/$skin/menu.tpl"</span>,
        die_on_bad_params =&gt; 0,
        cache             =&gt; 0,
        filter            =&gt; sub { $portal-&gt;translate_template(@_) }
    );<br /><br />    # Menu creation
    use Lemonldap::NG::Portal::Menu;
    my $menu = Lemonldap::NG::Portal::Menu-&gt;<span class=
"java-keyword">new</span>(
        {
            portalObject =&gt; $portal,
            apps         =&gt; {
                xmlfile =&gt; <span class="java-quote">"$appsxmlfile"</span>,
                imgpath =&gt; <span class="java-quote">"$appsimgpath"</span>,
            },
            modules =&gt; {
                appslist =&gt; 1,
                password =&gt; USER_CAN_CHANGE_PASSWORD,
                logout   =&gt; DISPLAY_LOGOUT,
            },
            # CUSTOM FUNCTION : <span class=
"java-keyword">if</span> you want to create customFunctions in rules, declare them here
            #customFunctions    =&gt; 'function1 function2',
        }
    );<br /><br />    $template-&gt;param( AUTH_USER           =&gt; $portal-&gt;{sessionInfo}-&gt;{$user_attr} );
    $template-&gt;param( AUTOCOMPLETE        =&gt; AUTOCOMPLETE );
    $template-&gt;param( SKIN                =&gt; $skin )
    $template-&gt;param( AUTH_ERROR          =&gt; $menu-&gt;error );
    $template-&gt;param( AUTH_ERROR_TYPE     =&gt; $menu-&gt;error_type );
    $template-&gt;param( DISPLAY_APPSLIST    =&gt; $menu-&gt;displayModule(<span class="java-quote">"appslist"</span>) );
    $template-&gt;param( DISPLAY_PASSWORD    =&gt; $menu-&gt;displayModule(<span class="java-quote">"password"</span>) );
    $template-&gt;param( DISPLAY_LOGOUT      =&gt; $menu-&gt;displayModule(<span class="java-quote">"logout"</span>) );
    $template-&gt;param( DISPLAY_TAB         =&gt; $menu-&gt;displayTab );
    $template-&gt;param( LOGOUT_URL          =&gt; <span class=
"java-quote">"$ENV{SCRIPT_NAME}?logout=1"</span> );
    $template-&gt;param( REQUIRE_OLDPASSWORD =&gt; REQUIRE_OLDPASSWORD );
    <span class=
"java-keyword">if</span> ( $menu-&gt;displayModule(<span class="java-quote">"appslist"</span>) ) {
        $template-&gt;param( APPSLIST_MENU =&gt; $menu-&gt;appslistMenu );
        $template-&gt;param( APPSLIST_DESC =&gt; $menu-&gt;appslistDescription );
    }<br /><br />    print $portal-&gt;header('text/html; charset=utf8');
    print $template-&gt;output;
}
</pre>
    </div>

    <h3 class="heading-1-1"><span id="HSetthevisibilityofeachmodules">Set the
    visibility of each modules</span></h3>

    <p class="paragraph"></p>In the source code of the portal, you have :

    <p class="paragraph"></p>

    <div class="code">
      <pre>
modules =&gt; {
                appslist =&gt; 1,
                password =&gt; USER_CAN_CHANGE_PASSWORD,
                logout   =&gt; DISPLAY_LOGOUT,
            },
</pre>
    </div>

    <p class="paragraph"></p>"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" :

    <p class="paragraph"></p>

    <div class="code">
      <pre>
modules =&gt; {
                appslist =&gt; 1,
                password =&gt; '$employeeType =~ /binternalb/',
                logout   =&gt; DISPLAY_LOGOUT,
            },
</pre>
    </div>

    <h3 class="heading-1-1"><span id="HConfigureapplicationslist">Configure
    applications list</span></h3>

    <h4 class="heading-1-1-1"><span id="HDTD">DTD</span></h4>

    <p class="paragraph"></p>The XML applications list must respect this DTD:

    <p class="paragraph"></p>

    <div class="code">
      <pre>
&lt;!ELEMENT menu (category*) &gt;<br /><br />&lt;!ELEMENT category (application*, category*) &gt;
&lt;!ATTLIST category name CDATA #REQUIRED &gt;<br /><br />&lt;!ELEMENT application (name, uri?, description?, logo?, screenshot?, display?) &gt;
&lt;!ATTLIST application id ID #REQUIRED &gt;<br /><br />&lt;!ELEMENT name ( #PCDATA ) &gt;
&lt;!ELEMENT uri ( #PCDATA ) &gt;
&lt;!ELEMENT description ( #PCDATA ) &gt;
&lt;!ELEMENT logo ( #PCDATA ) &gt;
&lt;!ELEMENT screenshot ( #PCDATA ) &gt;
&lt;!ELEMENT display ( #PCDATA ) &gt;
</pre>
    </div>

    <h4 class="heading-1-1-1"><span id="HParametersdefinition">Parameters
    definition</span></h4>

    <ul class="star">
      <li>Category:

        <ul class="star">
          <li>Name of the category (required)</li>
        </ul>
      </li>

      <li>Application:

        <ul class="star">
          <li>ID: unique id of the application inside XML file
          (required).</li>

          <li>Name: friendly name of the applications (required).</li>

          <li>URI: full URI of the application, with http(s)://, and path,
          page, etc.</li>

          <li>Description: description of the application.</li>

          <li>Logo: file name of the logo.</li>

          <li>Screenshot: file name of the screenshot.</li>

          <li>Display:

            <ul class="star">
              <li>"auto": display application only if the user has access to
              it.</li>

              <li>"on": always display.</li>

              <li>"off": never display.</li>
            </ul>
          </li>
        </ul>
      </li>
    </ul>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.

    <h4 class="heading-1-1-1"><span id="HSampleXMLfile">Sample XML
    file</span></h4>

    <p class="paragraph"></p>Now you can configure your applications list, in
    /etc/lemonldap-ng/apps-list.xml. For example:

    <p class="paragraph"></p>

    <div class="code">
      <pre>
&lt;?xml version=<span class="java-quote">"1.0"</span> encoding=<span class=
"java-quote">"utf-8"</span> standalone=<span class=
"java-quote">"no"</span>?&gt;
&lt;!DOCTYPE menu SYSTEM <span class="java-quote">"apps-list.dtd"</span>&gt;
&lt;menu&gt;
    &lt;category name=<span class="java-quote">"Business"</span>&gt;
        &lt;application id=<span class="java-quote">"aaa"</span>&gt;
                &lt;name&gt;AAA&lt;/name&gt;
                &lt;uri&gt;<span class="nobr"><a href=
"http://test.ow2.org/aaa&amp;#60;/uri&amp;#62;">http://test.ow2.org/aaa&lt;/uri&gt;</a></span>
                &lt;description&gt;AAA description&lt;/description&gt;
                &lt;logo&gt;aaa-logo.gif&lt;/logo&gt;
                &lt;display&gt;auto&lt;/display&gt;
        &lt;/application&gt;
        &lt;application id=<span class="java-quote">"bbb"</span>&gt;
                &lt;name&gt;BBB&lt;/name&gt;
                &lt;uri&gt;<span class="nobr"><a href=
"http://test.ow2.org/bbb/login.">http://test.ow2.org/bbb/login.</a></span><span class="java-keyword">do</span>&lt;/uri&gt;
                &lt;description&gt;BBB description&lt;/description&gt;
                &lt;logo&gt;bbb-logo.gif&lt;/logo&gt;
                &lt;display&gt;on&lt;/display&gt;
        &lt;/application&gt;
   &lt;/category&gt;
   &lt;category name=<span class="java-quote">"Technical"</span>&gt;
     &lt;category name=<span class="java-quote">"Directories"</span>&gt;
        &lt;application id=<span class="java-quote">"pla"</span>&gt;
                &lt;name&gt;phpLDAPAdmin&lt;/name&gt;
                &lt;uri&gt;<span class="nobr"><a href=
"http://phpldapadmin.ow2.org&amp;#60;/uri&amp;#62;">http://phpldapadmin.ow2.org&lt;/uri&gt;</a></span>
                &lt;description&gt;LDAP directory administration&lt;/description&gt;
                &lt;logo&gt;pla-logo.gif&lt;/logo&gt;
                &lt;display&gt;auto&lt;/display&gt;
        &lt;/application&gt;
     &lt;/category&gt;
     &lt;category name=<span class=
"java-quote">"Application servers"</span>&gt;
        &lt;application id=<span class="java-quote">"probe"</span>&gt;
                &lt;name&gt;Probe&lt;/name&gt;
                &lt;uri&gt;<span class="nobr"><a href=
"http://probe.ow2.org&amp;#60;/uri&amp;#62;">http://probe.ow2.org&lt;/uri&gt;</a></span>
                &lt;description&gt;Tomcat stats&lt;/description&gt;
                &lt;logo&gt;probe-logo.gif&lt;/logo&gt;
                &lt;display&gt;auto&lt;/display&gt;
        &lt;/application&gt;
     &lt;/category&gt;
   &lt;/category&gt;
&lt;/menu&gt;
</pre>
    </div>
  </div>

  <p class="footer"><a href="index.html">Index</a></p>
</body>
</html>