GdaDataModelLdap

GdaDataModelLdap — GdaDataModel to extract LDAP information

Stability Level

Unstable, unless otherwise indicated

Synopsis

struct              GdaDataModelLdap;
struct              GdaDataModelLdapClass;
                    GdaDataModelLdapPrivate;
enum                GdaLdapSearchScope;
GdaDataModel *      gda_data_model_ldap_new             (GdaConnection *cnc,
                                                         const gchar *base_dn,
                                                         const gchar *filter,
                                                         const gchar *attributes,
                                                         GdaLdapSearchScope scope);
GList *             gda_data_model_ldap_compute_columns (GdaConnection *cnc,
                                                         const gchar *attributes);

Object Hierarchy

  GObject
   +----GdaDataModelLdap

Implemented Interfaces

GdaDataModelLdap implements GdaDataModel.

Properties

  "attributes"               gchar*                : Write / Construct Only
  "base"                     gchar*                : Read / Write / Construct Only
  "cnc"                      GdaLdapConnection*    : Read / Write / Construct Only
  "filter"                   gchar*                : Read / Write / Construct Only
  "scope"                    gint                  : Read / Write / Construct Only

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.

Details

struct GdaDataModelLdap

struct GdaDataModelLdap;

struct GdaDataModelLdapClass

struct GdaDataModelLdapClass {
	GObjectClass             parent_class;
};

GdaDataModelLdapPrivate

typedef struct _GdaDataModelLdapPrivate GdaDataModelLdapPrivate;

enum GdaLdapSearchScope

typedef enum {
	GDA_LDAP_SEARCH_BASE     = 1,
	GDA_LDAP_SEARCH_ONELEVEL = 2,
	GDA_LDAP_SEARCH_SUBTREE  = 3
} GdaLdapSearchScope;

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

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

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);

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.

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 of attributes to fetch, each in the format <attname>[::<GType>] (CSV). [allow-none]

scope :

the search scope

Returns :

a new GdaDataModel. [transfer full]

Since 4.2.8


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().

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

Property Details

The "attributes" property

  "attributes"               gchar*                : Write / Construct Only

LDAP attributes.

Default value: NULL


The "base" property

  "base"                     gchar*                : Read / Write / Construct Only

Base DN.

Default value: NULL


The "cnc" property

  "cnc"                      GdaLdapConnection*    : Read / Write / Construct Only

LDAP connection.


The "filter" property

  "filter"                   gchar*                : Read / Write / Construct Only

LDAP filter.

Default value: NULL


The "scope" property

  "scope"                    gint                  : Read / Write / Construct Only

LDAP search scope.

Allowed values: [1,3]

Default value: 1

See Also

GdaDataModel