Custom database contributors

This page concerns Ametys 3.x and is obsolete, since in Ametys 4.x user management is carried out directly via population management in the administrator area.

As part of the CMS Ametys integration process, it is necessary to define how contributors will be managed.

CMS Ametys offers a number of predefined user managers. However, you can define your own user manager to use an existing user base in your information system, or customize user fields.

The handlers that can be used in this case are all database-related handlers:

  • org.ametys.runtime.plugins.core.user.jdbc.JdbcUsersManager (user base not modifiablewithout storage login details)
  • org.ametys.runtime.plugins.core.user.jdbc.ModifiableJdbcUsersManager (user base modifiable without storage login details)
  • org.ametys.runtime.plugins.core.user.jdbc.CredentialsAwareJdbcUsersManager (user base not modifiable with stockage of login credentials)
  • org.ametys.runtime.plugins.core.user.jdbc.ModifiableCredentialsAwareJdbcUsersManager (user base editable with storage login details)

Database connection

If the database is not the default database on CMS, you must first define a new connection pool to this database or"data source".

Go to SQL (data source) and follow the procedure to create a new connection pool.

Declaration of a new user base

The new user manager is declared in the plugin.xml file of a plugin.

You may need to create a new plugin; to do this, follow the instructions on the Architecture page. plugin Ametys

Example of a user base declaration

<extension point="org.ametys.runtime.user.UsersManager" 
<param id="login" column="id"/>
<param id="firstname" column="prenom"/>
<param id="lastname" column="nom"/>
<param id="email" column="mail"/>

In this example :

  • <pool> identifier of the connection pool used
  • <table> name of the SQL table containing users

The parameters"login","firstname","lastname" and "email"are mandatory. If the handler used is to define and store the password, the"password" parameter is also mandatory.

The column is used to define the table column corresponding to the parameter.

You can add as many parameters as you like, following the instructions given on the Parameters general page.

Please note that, to date, there are a few limitations:

- no widget is available here
- the "binary", "date" and "boolean" types are not supported
- enumerated values cannot be used

Here's another example of a declaration with a few custom parameters. This time, the handler is used to define a password.

<extension point="org.ametys.runtime.user.UsersManager"
<param id="login"/>
<param id="firstname"/>
<param id="lastname"/>
<param id="email" column="courriel"/>
<param id="password"/>
<param id="role" column="role" type="string">
<label i18n="false">Role</label>
<description i18n="false">Role</description>
<param id="age" column="age" type="long">
<label i18n="false">Age</label>
<description i18n="false">Age</description>

You are responsible for modifying and maintaining script SQL for your user table.

You can then select this new extension point using either the "Plugins and Workspaces"This can be done via the administration interface, or by directly modifying the WEB-INF/param/runtime.xml (see Runtime file.xml) .

Extract from the runtime file.xml


Please note that passwords must be stored in MD5 and encoded in base 64. It is therefore simpler to enter them via the administrator interface (for more information, please consult the Administration Manual, User management section).

Back to top