## GdaDataModelLdap

GdaDataModelLdap — GdaDataModel to extract LDAP information

## Stability Level

Unstable, unless otherwise indicated

## Functions

GdaDataModel * | gda_data_model_ldap_new ()
GdaDataModelLdap * | gda_data_model_ldap_new_with_config ()
GList * | gda_data_model_ldap_compute_columns ()

## Types and Values

struct | GdaDataModelLdap
struct | GdaDataModelLdapClass
| GdaDataModelLdapPrivate
enum | GdaLdapSearchScope

## Description

The GdaDataModelLdap object allows to perform LDAP searches.

Note: this type of data model is available only if the LDAP library was found at compilation time and if the LDAP provider is correctly installed.

## Functions

### gda_data_model_ldap_new ()

    GdaDataModel *
    gda_data_model_ldap_new (GdaConnection *cnc,
                             const gchar *base_dn,
                             const gchar *filter,
                             const gchar *attributes,
                             GdaLdapSearchScope scope);

`gda_data_model_ldap_new` has been deprecated since version 5.2 and should not be used in newly-written code.

use gda_data_model_ldap_new_with_config

Creates a new GdaDataModel object to extract some LDAP contents. The returned data model will contain one row for each LDAP entry returned by the search, and will always return the DN (Distinguished Name) of the LDAP entry as first column. Other atttibutes may be mapped to other columns, see the `attributes` argument.

Note that the actual LDAP search command is not executed until necessary (when using the returned data model).

The `base_dn` is the point in the LDAP's DIT (Directory Information Tree) from where the search will occur, for example "dc=gda,dc=org". A `NULL` value indicates that the starting point for the search will be the one specified when opening the LDAP connection.

The `filter` argument is a valid LDAP filter string, for example "(uidNumber=1001)". If `NULL`, then a default search filter of "(objectClass=*)" will be used.

`attributes` specifies which LDAP attributes the search must return. It is a comma separated list of attribute names, for example "uidNumber, mail, uid, jpegPhoto" (spaces between attribute names are ignored). If `NULL`, then no attribute will be fetched. See `gda_ldap_connection_declare_table()` for more information about this argument.

`scope` is the scope of search specified when the LDAP search is actually executed.

In case of multi valued attributes, an error will be returned when trying to read the attribute: `gda_data_model_iter_get_value_at()` will return `NULL` when using an iterator.

#### Parameters

cnc | an LDAP opened connection (must be a balid GdaLdapConnection) |
base_dn | the base DN to search on, or `NULL`. | [allow-none]
filter | an LDAP filter, for example "(objectClass=*)". | [allow-none]
attributes | the list (CSV format) of attributes to fetch, each in the format <attname>[::<GType>]. | [allow-none]
scope | the search scope |

#### Returns

a new GdaDataModel.

[transfer full]

Since: 4.2.8

### gda_data_model_ldap_new_with_config ()

    GdaDataModelLdap *
    gda_data_model_ldap_new_with_config (GdaConnection *cnc,
                                         const gchar *base_dn,
                                         const gchar *filter,
                                         const gchar *attributes,
                                         GdaLdapSearchScope scope);

Creates a new GdaDataModel object to extract some LDAP contents. The returned data model will contain one row for each LDAP entry returned by the search, and will always return the DN (Distinguished Name) of the LDAP entry as first column. Other atttibutes may be mapped to other columns, see the `attributes` argument.

Note that the actual LDAP search command is not executed until necessary (when using the returned data model).

The `base_dn` is the point in the LDAP's DIT (Directory Information Tree) from where the search will occur, for example "dc=gda,dc=org". A `NULL` value indicates that the starting point for the search will be the one specified when opening the LDAP connection.

The `filter` argument is a valid LDAP filter string, for example "(uidNumber=1001)". If `NULL`, then a default search filter of "(objectClass=*)" will be used.

`attributes` specifies which LDAP attributes the search must return. It is a comma separated list of attribute names, for example "uidNumber, mail, uid, jpegPhoto" (spaces between attribute names are ignored). If `NULL`, then no attribute will be fetched. See `gda_ldap_connection_declare_table()` for more information about this argument.

`scope` is the scope of search specified when the LDAP search is actually executed.

In case of multi valued attributes, an error will be returned when trying to read the attribute: `gda_data_model_iter_get_value_at()` will return `NULL` when using an iterator.

This is a convenience function intended to be used by bindings.

#### Parameters

cnc | an LDAP opened connection (must be a balid GdaLdapConnection) |
base_dn | the base DN to search on, or `NULL`. | [allow-none]
filter | an LDAP filter, for example "(objectClass=*)". | [allow-none]
attributes | the list (CSV format) of attributes to fetch, each in the format <attname>[::<GType>]. | [allow-none]
scope | the search scope |

#### Returns

a new GdaDataModelLdap object.

[transfer full]

Since: 5.2

### gda_data_model_ldap_compute_columns ()

    GList *
    gda_data_model_ldap_compute_columns (GdaConnection *cnc,
                                         const gchar *attributes);

Computes the GdaColumn of the data model which would be created using `attributes` when calling `gda_data_model_ldap_new()`.

#### Parameters

cnc | a GdaConnection |
attributes | a string describing which LDAP attributes to retreive, or `NULL`. | [allow-none]

#### Returns

a list of GdaColumn objects.

[transfer full][element-type GdaColumn]

Since: 4.2.8

## Types and Values

### struct GdaDataModelLdap

    struct GdaDataModelLdap {
    	GObject                  object;
    	GdaDataModelLdapPrivate *priv;
    };

### struct GdaDataModelLdapClass

    struct GdaDataModelLdapClass {
    	GObjectClass             parent_class;
    };

### GdaDataModelLdapPrivate

    typedef struct _GdaDataModelLdapPrivate GdaDataModelLdapPrivate;

### enum GdaLdapSearchScope

Defines the search scope of an LDAP search command, relative to the base object.

#### Members

GDA_LDAP_SEARCH_BASE | search of the base object only |
GDA_LDAP_SEARCH_ONELEVEL | search of immediate children of the base object, but does not include the base object itself |
GDA_LDAP_SEARCH_SUBTREE | search of the base object and the entire subtree below the base object |

## See Also

GdaDataModel