protected function LdapAuthorizationConsumerConf::loadFromDb in Lightweight Directory Access Protocol (LDAP) 7
Same name and namespace in other branches
- 8.2 ldap_authorization/LdapAuthorizationConsumerConf.class.php \LdapAuthorizationConsumerConf::loadFromDb()
- 7.2 ldap_authorization/LdapAuthorizationConsumerConf.class.php \LdapAuthorizationConsumerConf::loadFromDb()
1 call to LdapAuthorizationConsumerConf::loadFromDb()
- LdapAuthorizationConsumerConf::__construct in ldap_authorization/
LdapAuthorizationConsumerConf.class.php - Constructor Method
File
- ldap_authorization/
LdapAuthorizationConsumerConf.class.php, line 97 - class to encapsulate an ldap entry to authorization consumer ids mapping configuration
Class
- LdapAuthorizationConsumerConf
- LDAP Authorization Consumer Configuration
Code
protected function loadFromDb() {
if (module_exists('ctools')) {
ctools_include('export');
$result = ctools_export_load_object('ldap_authorization', 'names', array(
$this->consumerType,
));
// @todo, this is technically wrong, but I don't quite grok what we're doing in the non-ctools case - justintime
$consumer_conf = array_pop($result);
// There's no ctools api call to get the reserved properties, so instead of hardcoding a list of them
// here, we just grab everything. Basically, we sacrifice a few bytes of RAM for forward-compatibility.
}
else {
$select = db_select('ldap_authorization', 'ldap_authorization');
$select
->fields('ldap_authorization');
$select
->condition('ldap_authorization.consumer_type', $this->consumerType);
$consumer_conf = $select
->execute()
->fetchObject();
}
if (!$consumer_conf) {
$this->inDatabase = FALSE;
return;
}
$this->sid = $consumer_conf->sid;
$this->consumerType = $consumer_conf->consumer_type;
$this->numericConsumerConfId = isset($consumer_conf->numeric_consumer_conf_id) ? $consumer_conf->numeric_consumer_conf_id : NULL;
$this->status = $consumer_conf->status ? 1 : 0;
$this->onlyApplyToLdapAuthenticated = (bool) @$consumer_conf->only_ldap_authenticated;
$this->deriveFromDn = (bool) @$consumer_conf->derive_from_dn;
$this->deriveFromDnAttr = isset($consumer_conf->derive_from_dn_attr) ? $consumer_conf->derive_from_dn_attr : NULL;
$this->deriveFromAttr = (bool) @$consumer_conf->derive_from_attr;
$this->deriveFromAttrAttr = $this
->linesToArray($consumer_conf->derive_from_attr_attr);
$this->deriveFromAttrUseFirstAttr = (bool) @$consumer_conf->derive_from_attr_use_first_attr;
$this->deriveFromAttrNested = (bool) @$consumer_conf->derive_from_attr_nested;
$this->deriveFromEntry = (bool) @$consumer_conf->derive_from_entry;
$this->deriveFromEntryEntries = $this
->linesToArray($consumer_conf->derive_from_entry_entries);
$this->deriveFromEntryEntriesAttr = isset($consumer_conf->derive_from_entry_entries_attr) ? $consumer_conf->derive_from_entry_entries_attr : NULL;
$this->deriveFromEntryMembershipAttr = $consumer_conf->derive_from_entry_attr;
$this->deriveFromEntryAttrMatchingUserAttr = isset($consumer_conf->derive_from_entry_user_ldap_attr) ? $consumer_conf->derive_from_entry_user_ldap_attr : NULL;
$this->deriveFromEntrySearchAll = (bool) @$consumer_conf->derive_from_entry_search_all;
$this->deriveFromEntryUseFirstAttr = (bool) @$consumer_conf->derive_from_entry_use_first_attr;
$this->deriveFromEntryNested = isset($consumer_conf->derive_from_entry_nested) ? $consumer_conf->derive_from_entry_nested : NULL;
$this->mappings = $this
->pipeListToArray($consumer_conf->mappings, FALSE);
$this->useMappingsAsFilter = (bool) @$consumer_conf->use_filter;
$this->synchToLdap = (bool) @$consumer_conf->synch_to_ldap;
$this->synchOnLogon = (bool) @$consumer_conf->synch_on_logon;
$this->regrantLdapProvisioned = (bool) @$consumer_conf->regrant_ldap_provisioned;
$this->revokeLdapProvisioned = (bool) @$consumer_conf->revoke_ldap_provisioned;
$this->createConsumers = (bool) @$consumer_conf->create_consumers;
}