Data sources and queries


The functions described on this page are part of Plugin Data insertion (installed by default in the Ametys demo application).

  1. Presentation
  2. Data sources" tool
    1. Request LDAP
    2. Request SQL

 

Presentation

The Data Sources tool on CMS enables users with appropriate rights (usually a webmaster or administrator) to define queries associated with existing data sources to obtain specific information that contributors can insert into the rich text fields of content.

Warning
Queries must be written using the syntax SQL or LDAP syntax (depending on the associated data source); knowledge of these areas is required to be able to create queries.

Examples of feasible queries:

  • Get a list of teachers and their contacts
  • Obtain a list of personnel in service
  • Get the secretariat's telephone number

This page describes how to create and set up data sources. To find out how to use these queries in rich text content fields, go to the dedicated page.

Data sources" tool

plugin provides a Data Sources back-office tool to allow you to define queries to LDAP or SQL data sources.

Click on the Data sources button in the Administration tab to open the tool.

The tool is presented in the form of a tree with existing connections and queries. The data sources defined in the CMS admin area are included.

From this tool, you can create, modify or delete queries (LDAP or SQL).

Request LDAP

To add a query LDAP, select a data source LDAP then click on the'New query' button.

In the dialog box, select :

  • Query name (unique)
  • A description detailed enough for contributors to use it easily.
  • Visit type of result :
    • simple, if the query only returns a simple value to be inserted into a text (a person's name, for example)
    • multiple, if the query returns a list of results, which can be displayed in tabular form.
  • Search DN: Context name of the object to be searched (e.g. ou=people)
  • Visit search typeto define the type of search possible on LDAP :
    • Object
    • One level
    • Subtree
  • Returned attributes: The list of returned LDAP attributes and their labels, separated by commas (for example: sn[lastname], givenName[firstname], mail)
  • Visit constraints search criteria (which can be parameterized). Parameters are entered when the query is inserted into the content.
    • Non-configurable constraint: (mail=*.com)
    • Contrainte configurable, les paramètres commencent par le signe '$' suivi d'un jeu d'accolades : (uid = ${uid})

Request SQL

To add a query SQL, select a data source SQL then click on the'New query' button.

In the dialog box, select :

  • Query name (unique)
  • A description detailed enough for contributors to use it easily.
  • Visit type of result :
    • simple, if the query only returns a simple value to be inserted into a text (a person's name, for example)
    • multiple, if the query returns a list of results, which can be displayed in tabular form.
  • Visit request SQL (can be parameterized). Parameters are entered when the query is inserted into the content.
    • Non-configurable constraint: SELECT firstname AS 'Firstname', lastname AS 'LastName', mail AS 'E-Mail address', service FROM Staff
    • Contrainte configurable, les paramètres commencent par le signe '$' suivi d'un jeu d'accolades : SELECT firstname AS 'Firstname', lastname AS 'LastName', mail AS 'E-Mail address' FROM Staff WHERE service=${service}

 

Back to top