You are here

public static function LdapQuery::fields in Lightweight Directory Access Protocol (LDAP) 7.2

Same name and namespace in other branches
  1. 8.2 ldap_query/LdapQuery.class.php \LdapQuery::fields()
  2. 7 ldap_query/LdapQuery.class.php \LdapQuery::fields()
7 calls to LdapQuery::fields()
LdapQuery::__construct in ldap_query/LdapQuery.class.php
Constructor Method.
LdapQueryAdmin::drupalForm in ldap_query/LdapQueryAdmin.class.php
LdapQueryAdmin::populateFromDrupalForm in ldap_query/LdapQueryAdmin.class.php
LdapQueryAdmin::save in ldap_query/LdapQueryAdmin.class.php
ldap_query_fields in ldap_query/ldap_query.module

... See full list

File

ldap_query/LdapQuery.class.php, line 235
Defines server classes and related functions.

Class

LdapQuery
LDAP Server Class.

Code

public static function fields() {
  $fields = [
    'query_numeric_id' => [
      'property_name' => 'query_numeric_id',
      'schema' => [
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Primary ID field for the table.  Only used internally.',
        'no export' => TRUE,
      ],
    ],
    'qid' => [
      'property_name' => 'qid',
      'schema' => [
        'type' => 'varchar',
        'length' => 20,
        'description' => 'Machine name for query.',
        'not null' => TRUE,
      ],
      'form' => [
        'field_group' => 'basic',
        '#type' => 'textfield',
        '#title' => t('Machine name for this query configuration.'),
        '#size' => 20,
        '#maxlength' => 20,
        '#description' => t('May only contain alphanumeric characters (a-z, A-Z, 0-9, and _)'),
        '#required' => TRUE,
      ],
      'form_to_prop_functions' => [
        'trim',
      ],
    ],
    'name' => [
      'property_name' => 'name',
      'schema' => [
        'type' => 'varchar',
        'length' => '60',
        'not null' => TRUE,
      ],
      'form' => [
        'field_group' => 'basic',
        '#type' => 'textfield',
        '#title' => t('Name'),
        '#description' => t('Choose a name for this query configuration.'),
        '#size' => 50,
        '#maxlength' => 255,
        '#required' => TRUE,
      ],
      'form_to_prop_functions' => [
        'trim',
      ],
    ],
    'sid' => [
      'property_name' => 'sid',
      'schema' => [
        'type' => 'varchar',
        'length' => 20,
        'not null' => TRUE,
      ],
      'form' => [
        'field_group' => 'basic',
        '#type' => 'radios',
        '#title' => t('LDAP Server used for query.'),
        '#required' => 1,
      ],
      'form_to_prop_functions' => [
        'trim',
      ],
    ],
    'status' => [
      'property_name' => 'status',
      'schema' => [
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ],
      'form' => [
        'field_group' => 'basic',
        '#type' => 'checkbox',
        '#title' => t('Enabled'),
        '#description' => t('Disable in order to keep configuration without having it active.'),
      ],
      'form_to_prop_functions' => [
        'trim',
      ],
    ],
    'base_dn_str' => [
      'property_name' => 'base_dn_str',
      'schema' => [
        'type' => 'text',
        'not null' => FALSE,
      ],
      'form' => [
        'field_group' => 'query',
        '#type' => 'textarea',
        '#title' => t('Base DNs to search in query.'),
        '#description' => t('Each Base DN will be queried and results merged. e.g. <code>ou=groups,dc=hogwarts,dc=edu</code>') . t('Enter one per line in case if you need more than one.'),
        '#cols' => 50,
        '#rows' => 6,
        '#required' => TRUE,
      ],
      'form_to_prop_functions' => [
        'trim',
      ],
    ],
    'baseDn' => [
      'property_name' => 'baseDn',
      'exportable' => FALSE,
    ],
    'filter' => [
      'property_name' => 'filter',
      'schema' => [
        'type' => 'text',
        'not null' => FALSE,
      ],
      'form' => [
        'field_group' => 'query',
        '#type' => 'textarea',
        '#title' => t('Filter'),
        '#description' => t('LDAP query filter such as <code>(objectClass=group)</code> or <code>(&(objectClass=user)(homePhone=*))
</code>'),
        '#cols' => 50,
        '#rows' => 1,
        '#required' => TRUE,
      ],
      'form_to_prop_functions' => [
        'trim',
      ],
    ],
    'attributes_str' => [
      'property_name' => 'attributes_str',
      'schema' => [
        'type' => 'text',
        'not null' => FALSE,
      ],
      'form' => [
        'field_group' => 'query',
        '#type' => 'textarea',
        '#title' => t('Attributes to return.'),
        '#description' => t('Enter as comma separated list. DN is automatically returned. Leave empty to return all attributes. e.g. <code>objectclass,name,cn,samaccountname</code>'),
        '#cols' => 50,
        '#rows' => 6,
      ],
      'form_to_prop_functions' => [
        'trim',
      ],
    ],
    'attributes' => [
      'property_name' => 'attributes',
      'exportable' => FALSE,
    ],
    'sizelimit' => [
      'property_name' => 'sizelimit',
      'schema' => [
        'type' => 'int',
        'size' => 'small',
        'not null' => TRUE,
        'default' => 0,
      ],
      'form' => [
        'field_group' => 'query_advanced',
        '#type' => 'textfield',
        '#title' => t('Size Limit of returned data'),
        '#description' => t('This limit may be already set by the ldap server.  0 signifies no limit'),
        '#size' => 7,
        '#maxlength' => 5,
        '#required' => TRUE,
      ],
      'form_to_prop_functions' => [
        'trim',
      ],
    ],
    'timelimit' => [
      'property_name' => 'timelimit',
      'schema' => [
        'type' => 'int',
        'size' => 'small',
        'not null' => TRUE,
        'default' => 0,
      ],
      'form' => [
        'field_group' => 'query_advanced',
        '#type' => 'textfield',
        '#title' => t('Time Limit in Seconds'),
        '#description' => t('The time limitset on this query.  This may be already set by the ldap server.  0 signifies no limit'),
        '#size' => 7,
        '#maxlength' => 5,
        '#required' => TRUE,
      ],
      'form_to_prop_functions' => [
        'trim',
      ],
    ],
    'deref' => [
      'property_name' => 'deref',
      'schema' => [
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => LDAP_DEREF_NEVER,
      ],
      'form' => [
        'field_group' => 'query_advanced',
        '#type' => 'radios',
        '#title' => t('How aliases should be handled during the search.'),
        '#required' => 1,
        '#options' => [
          LDAP_DEREF_NEVER => t('(default) aliases are never dereferenced.'),
          LDAP_DEREF_SEARCHING => t('aliases should be dereferenced during the search but not when locating the base object of the search.'),
          LDAP_DEREF_FINDING => t('aliases should be dereferenced when locating the base object but not during the search.'),
          LDAP_DEREF_ALWAYS => t('aliases should be dereferenced always.'),
        ],
      ],
      'form_to_prop_functions' => [
        'trim',
      ],
    ],
    'scope' => [
      'property_name' => 'scope',
      'schema' => [
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => LDAP_SCOPE_SUBTREE,
      ],
      'form' => [
        'field_group' => 'query_advanced',
        '#type' => 'radios',
        '#title' => t('Scope of search.'),
        '#required' => 1,
        '#options' => [
          LDAP_SCOPE_BASE => t('BASE. This value is used to indicate searching only the entry at the base DN, resulting in only that entry being returned (keeping in mind that it also has to meet the search filter criteria!).'),
          LDAP_SCOPE_ONELEVEL => t('ONELEVEL. This value is used to indicate searching all entries one level under the base DN - but not including the base DN and not including any entries under that one level under the base DN.'),
          LDAP_SCOPE_SUBTREE => t('SUBTREE. (default) This value is used to indicate searching of all entries at all levels under and including the specified base DN.'),
        ],
      ],
      'form_to_prop_functions' => [
        'trim',
      ],
    ],
  ];
  return $fields;
}