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:
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.
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" id="org.ametys.custom.CustomJdbcUsersManager" class="org.ametys.runtime.plugins.core.user.jdbc.JdbcUsersManager" logger="org.ametys.runtime.plugins.core.users.jdbc.simple"> <pool>runtime.datasource.jdbc.mypool</pool> <table>MyUsersTable</table> <param id="login" column="id"/> <param id="firstname" column="prenom"/> <param id="lastname" column="nom"/> <param id="email" column="mail"/> </extension>
In this example :
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" id="org.ametys.custom.CustomUsersManager" class="org.ametys.runtime.plugins.core.user.jdbc.ModifiableCredentialsAwareJdbcUsersManager" logger="org.ametys.custom.users"> <pool>runtime.datasource.core.jdbc.pool</pool> <table>Custom_Users</table> <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> <validation> <mandatory/> </validation> </param> <param id="age" column="age" type="long"> <label i18n="false">Age</label> <description i18n="false">Age</description> </param> </extension> |
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
<extensions> <org.ametys.runtime.user.UsersManager>org.ametys.custom.CustomUsersManager</org.ametys.runtime.user.UsersManager> ... </extensions>
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).