function ldapauth_schema in LDAP integration 6
Implementation of hook_schema().
File
- ./
ldapauth.install, line 61 - ldapauth module installation and upgrade code.
Code
function ldapauth_schema() {
$schema['ldapauth'] = array(
'fields' => array(
'sid' => array(
'type' => 'serial',
'size' => 'tiny',
'not null' => TRUE,
'no export' => TRUE,
),
'name' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'machine_name' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'status' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
'server' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'port' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 389,
),
'tls' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
'enc_type' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
'basedn' => array(
'type' => 'text',
),
'user_attr' => array(
'type' => 'varchar',
'length' => 255,
),
'mail_attr' => array(
'type' => 'varchar',
'length' => 255,
),
'puid_attr' => array(
'type' => 'varchar',
'length' => 255,
),
'binary_puid' => array(
'type' => 'int',
'size' => 'tiny',
'default' => '0',
),
'binddn' => array(
'type' => 'varchar',
'length' => 255,
),
'bindpw' => array(
'type' => 'varchar',
'length' => 255,
),
'login_php' => array(
'type' => 'text',
'not null' => FALSE,
),
'filter_php' => array(
'type' => 'text',
'not null' => FALSE,
),
'weight' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'sid',
),
'unique keys' => array(
'name' => array(
'name',
),
'machine_name' => array(
'machine_name',
),
),
// CTools export definitions
'export' => array(
'key' => 'name',
'key name' => 'Server Name',
'primary key' => 'sid',
'identifier' => 'ldapserver',
// Exports will be as $ldapserver
'default hook' => 'default_ldapauth_ldapserver',
// Function hook name.
'can disable' => FALSE,
'api' => array(
'owner' => 'ldapauth',
'api' => 'default_ldapauth_ldapservers',
// Base name for api include files.
'minimum_version' => 1,
'current_version' => 1,
),
),
);
if ($GLOBALS['db_type'] == 'pgsql') {
$puid_unique_fields = array(
'puid',
);
}
else {
$puid_unique_fields = array(
array(
'puid',
255,
),
);
// MySQL limit
}
$schema['ldapauth_users'] = array(
'description' => 'Stores information about ldap authenticated users.',
'fields' => array(
'luid' => array(
'description' => 'Primary key: ldapauth users id',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'uid' => array(
'description' => '{users}.uid',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'sid' => array(
'description' => '{ldapauth}.sid used for authentication',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
),
'machine_name' => array(
'description' => '{ldapauth}.machine_name for cross server id',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'dn' => array(
'description' => 'LDAP dn user was authenticated with',
'type' => 'text',
'not null' => TRUE,
),
'puid' => array(
'description' => 'Persistent and Unique User ID value for this user',
'type' => 'text',
// Text because dn's can be long
'not null' => TRUE,
),
),
'primary key' => array(
'luid',
),
'unique keys' => array(
'uid' => array(
'uid',
),
'puid_uniq' => $puid_unique_fields,
),
'indexes' => array(
'puid_idx' => array(
array(
'puid',
255,
),
),
),
);
return $schema;
}