Fork me on GitHub

Create new admin functions

The administrative functions corresponds to a set o functions in the admin module independent on the access level : administrator, webmaster, etc ..

To every feature corresponds a right possibly given to the user. This right has many levels in order to distinguish between many different profiles. These levels are :

  • 0 - Technical Administrator
  • 1 - Content Producer
  • 2 - Webmaster
  • 3 - Local Participant

When a user has the right granted, the feature is displayed as title and a description in his home menu. By clicking on a link, the user accesses to a JSP which is the entry point of this JSP.

The JSP is usually named :Manage<MyFeature>.jsp.

The JSP code verifies whether the current user has the rights. If authoriztaion succeeds it calls to the JspBean method associated to this feature(typically MyFeatureJspBean) thus fetching its home page.

<%@ include file="../PluginAdminHeader.jsp" %>

<jsp:useBean id="myFeature" scope="session" class="fr.paris.lutece.plugins.myplugin.web.MyFeatureJspBean" />
<jsp:useBean id="user" scope="session" class="fr.paris.lutece.portal.web.user.UserJspBean" />

<%
    if( user.check( "MYFEATURE_MANAGEMENT" ) )
    {
%>

<%= myFeature.getManageMyFeature(request) %>
<%
     }
     else

         response.sendRedirect(
         user.getPluginAccessDeniedUrl() );
     }
%>
<%@ include file="../../AdminFooter.jsp" %> 

NB : The JSP of that feature receives an HTTP request parameter the plugin name to which it is associated (parameter plugin_name). This allows two plugins to share same features in different contexts.

Definition of an administrative feature in the plugin's configuration file

To install a new Lutece feature it must be packaged into a plugin [ HOWTO - Plugins ].

The definition of the feature in the configuration file must done by adding the following lines :

<admin-feature>
   <feature-id>MYFEATURE_MANAGEMENT</feature-id>
   <feature-title>My Feature</feature-title>
   <feature-description>Description of my feature</feature-description>
   <feature-level>3</feature-level>
   <feature-url>plugins/myplugin/ManageMyFeature.jsp</feature-url>
</admin-feature>