Download jars from plugin and add them (ametys-plugin-user-directory-1.0.0.jar and ametys-plugin-user-directory-resources-1.0.0. jar ) in theWEB-INF/lib directory of your application. Ametys
Add buttons to open the search tool and to open your own card in the file. WEB-INF/params/cms-ribbon-default.xml. The button identifier is org.ametys.plugins.user.directory.Search and org.ametys.plugins.user.directory.EditSelfCard.
It is advisable to add it to the "Tools" group of the Home.
Attention Please note! If the group contains a description <large>, <medium> and <small> button must be added to the 3
In the same file, add a button to position the root of a directory on a page: org.ametys.plugins.user.directory.SetRoot
Each user population defines the type(s) of content that will be created following synchronization.
You are free to define any type of content. The plugin directories don't provide any type of content, so it's up to you to define your own content for each population.
The following rules apply to your content types:
content type identifiers must begin with org.ametys.plugins.userdirectory.Content
the Java class associated with content types must be org.ametys.plugins.userdirectory.contenttype.UserContentType
content types must be declared as private
content types must be declared in your own plugin (consequence of rule no. 2)
Oops!
Copy to clipboard failed. Open the code and copy it manually.
Here's an example of plugin defining the content type "org.ametys.plugins.userdirectory.Content.employee" and the configuration parameters required to connect to the LDAP server: employee.zip We strongly recommend that you start from this plugin and modify it to suit your needs.
Definition of "populations
A population is a set of users/members from the same data source (LDAP, SQL, ...).
User "populations" are defined in the XML WEB-INF/param/user-populations file.xml
Each population must define :
its data source (a server LDAP , for example)
the Java class responsible for synchronizing content (e.g. org.ametys.plugins.userdirectory.population.LDAPPopulation)
the type(s) of content to which it is linked
search fields and possible results columns
mapping between content type fields and data source attributes
Population example
Oops!
Copy to clipboard failed. Open the code and copy it manually.
The section <content-types> contains the list of content types (UserContentType) that will be created/synchronized with the data source
Parameters
Parameters are those required to connect to the data source.
They refer to configuration parameter identifiers.
Search criteria
The section <search-criteria> defines the metadata to be used as search criteria in the directory.
The "metadata-ref" contains the path to the metadata.
The "analyzed" is optional. Set the attribute to false to avoid using a text analyzer during indexing.
Results columns
If directory search results are displayed in tabular form, you can define in the section <result-columns> which columns the table will contain.
As with search criteria, the "metadata-ref" attribute contains the path to the metadata to be displayed in the result column.
The column with the main="true"will be the column containing the link to the complete population member record.
If a column is to display a email, add the attribute type="email" so that it is treated differently when displayed, to combat spam.
Mapping
Mapping defines which fields (content metadata) will be synchronized with external source information.
The mapping necessarily contains a <id> identifying the metadata and attribute/column of the data source used to guarantee the uniqueness of the content.
For other fields (metadata), you can specify whether the remote value should be synchronized or overwrite the local metadata (synchro = "true|false"):
if synchro="true"then the associated metadata will have 2 values: the local value, which can be modified, and the remote value, extracted from the data source, which cannot be modified. For editing, the contributor can choose to use the local value (Ametys) or the remote value (BD) :
if synchro="false", the metadata has only one value, which will always be synchronized with the value of the data source.
boSource" attribute
If a population is linked to the same population of users who can connect to the back-office, add the attribute boSource=true.
This gives access to the "Open my personal file" button, for users of this population.
SourcePrevails" attribute
This attribute is important when synchronizing a population. It means "trust the data source". So, when synchronizing a population, if content created by a previous synchronization is linked to an identifier/login that no longer exists in the data source, it will be deleted fromAmetys if sourcePrevails = true.
Further information plugin Directories provides a single Java class for synchronizing a population from a LDAP directory: org.ametys.plugins.userdirectory.population.LDAPPopulation. This class is sufficient for a population from a LDAP server in the following general case: - the data source is a directory LDAP - synchronization with the directory results in the creation of a single type of content - a metadata is synchronized with a single directory attribute You'll need to define your own Population class whenever your use case doesn't fit into the general case. For example, if you wish to create several types of content from the same population, if a metadata must be synchronized with 2 or more LDAP attributes, etc... To do this, your class will need to extend the org.ametys.plugins.userdirectory.population.AbstractPopulation or org.ametys.plugins.userdirectory.population.LDAPPopulation and define its own #populate method. The purpose of the #populate method is to extract "members" from the data source and create/synchronize content Ametys.
Content lifecycle
Content Ametys from a population has its own workflow.
Download the workflow description file for these contents and copy it into your application's WEB-INF/param directory. Then modify the WEB-INF/param/workflows file .xml to add the reference to this file using the name "user-directory", as shown below:
Oops!
Copy to clipboard failed. Open the code and copy it manually.