Skip to content
Laurent Jouanneau edited this page Jun 24, 2022 · 4 revisions

Using jCommunity with master_admin

In an application like a back-office or intranet, usually users should authenticate themselves before accessing to the application. This is the role of the master_admin module. However some features are missing, like password recovery or registration. So you may want to use jCommunity.

To do it, you must replace modules jauth and jauthdb by jcommunity. Here are instructions.

Note: this feature works only with Jelix 1.6.21 or higher

Main configuration file

If you are using Jelix 1.7+, skip this section. The configuration file is modified by the configurator of Jelix (see the installation chapter)

Else, for Jelix 1.6, add these lines into the configuration file of your application, in the corresponding sections :

[modules]
...
jcommunity.installparam = masteradmin

[simple_urlengine_entrypoints]
...
admin="jacl2db~*@classic, jacl2db_admin~*@classic, jauthdb_admin~*@classic, master_admin~*@classic, jpref_admin~*@classic,jcommunity~*@classic"

Database setup

you want to use the jCommunity table

The installation script of jcommunity will create the table community_users.

If you use the standard table of jauthdb (jlx_user) and it didn't change, and if you want to migrate existing users, add the installation parameter migratejauthdbusers.

[modules]
jcommunity.installparam = "masteradmin;migratejauthdbusers"

If you want to use your own users table or stay with jlx_user

If you added some fields into jlx_user or if you use an other table:

  1. modify the dao file corresponding to your table (or overload it), by adding new fields and adding same methods as in the file jcommunity/daos/user.dao.xml. Fields status, keyactivate, request_date, create_date and login are required.
  2. Indicate this parameters for jCommunity, into the modules section of the mainconfig.ini.php:
    jcommunity.installparam = "masteradmin;manualconfig"
    
  3. modify the form file you use (or overload it) with the new fields. see an example in jcommunity/forms/account_admin.form.xml.

After the installation, in your table, modify all records by setting the status field value to 1, and create_date to the date of the day.

Configuring the mailer

If you didn't already setup it, do it. jCommunity needs to send emails when the user wants to reset its password or when he register a new account.

Replace templates

You must redefines the template master_admin~zone_admin_infobox.tpl. See an example in the directory install/theme of the jcommunity module. You should replace links to the jauth module by links to jcommunity (ex jauth~login:out by jcommunity~login:out ).

launch the installer

To finalize, you should launch the install script:

php cmd.php installapp