Quick links: Content - sections - sub sections
EN FR
Table of content

the initadmin command adds an administration web interface to your application. It enables master_admin jelix module, and can automatically configure authentification (jAuth) and rights accesses (jAcl2).

To create this administration interface, run:


   php jelix.php --myapp initadmin admin
  • "myapp" is the name of your application
  • "admin" is the name of the entry point (without the extension .php) dedicated to the admin interface

Of course, you can choose another name for the entry point. The command will create it if it doesn't already exist. The configuration of the entry point will be modified in order to have a fully functional web interface. For example, you have two new response object in your myapp/responses/ directory. So you can customize later the general interface of the administration.

Note that before running this command, you have to configure the database access in dbprofils.ini.php, because it will create all needed tables for jAuth and jAcl2. If you prefer to configure jAuth and/or jAcl2 by yourself, you can indicate options to the command, respectively -noauthdb and -noacl2db.

After having created the admin interface (and configuring jAuth and jAcl2 correctly if you used -noauthdb and/or -noacl2db), you can run the application (example.com/admin.php for example).

You will see a login form, displayed by the module jauth. By default, a user named "admin" with the password "admin" is created. After entering login and password, you will be redirected to the master_admin module.

Using the significant url engine

Because of some constraints or because of some needs, you may want to use modules activated by init_admin, with the same configuration of the rest of the application, and perhaps with the significant urls engine. By default it is not activated, and so you don't have to do any more to run the administration interface.

But perhaps you activated it. In this case, you have to do modifications into the urls.xml file, if you want to access to the admin modules through the web.

First, you have to declare the new entry point


 <classicentrypoint name="admin">
     <url pathinfo="" module="master_admin" action="default:index" />
 </classicentrypoint>

The administration use the auth system of jelix, jAuth. You have then to define urls for the jauth module.


 <classicentrypoint name="admin">
     <url pathinfo="" module="master_admin" action="default:index" />

     <url pathinfo="/login/form" module="jauth" action="login:form" />
     <url pathinfo="/login/in" module="jauth" action="login:in" />
     <url pathinfo="/login/out" module="jauth" action="login:out" />
 </classicentrypoint>

If, when you called initadmin, you didn't deactivated authentification with jAuthDb and/or rights management with jAcl2Db, you have then to defines urls for the jauthdb_admin module and/or jacl2db_admin.

To help, you have an urls_example.xml file in

  • lib/jelix-admin-modules/jauthdb_admin/install/
  • lib/jelix-admin-modules/jacl2db_admin/install/

You can copy some contents of this file into the <classicentrypoint name="admin"> element. For example, for jacl2db_admin, you will write:


 <classicentrypoint name="admin">
     <url pathinfo="" module="master_admin" action="default:index" />

     <url pathinfo="/login/form" module="jauth" action="login:form" />
     <url pathinfo="/login/in" module="jauth" action="login:in" />
     <url pathinfo="/login/out" module="jauth" action="login:out" />

     <url pathinfo="/acl/groups" module="jacl2db_admin" action="groups:index"/>
     <url pathinfo="/acl/groups/rights" module="jacl2db_admin" action="groups:rights"/>
     <url pathinfo="/acl/groups/saverights" module="jacl2db_admin" action="groups:saverights"/>
     <url pathinfo="/acl/groups/new" module="jacl2db_admin" action="groups:newgroup"/>
     <url pathinfo="/acl/groups/rename" module="jacl2db_admin" action="groups:changename"/>
     <url pathinfo="/acl/groups/delete" module="jacl2db_admin" action="groups:delgroup"/>
     <url pathinfo="/acl/users" module="jacl2db_admin" action="users:index"/>
     <url pathinfo="/acl/users/:user" module="jacl2db_admin" action="users:rights" actionoverride="users:removegroup,users:addgroup,users:saverights"/>
 </classicentrypoint>

you can do the same thing for the jauthdb_admin.