protected function LdapServer::initDerivedProperties in Lightweight Directory Access Protocol (LDAP) 7.2
Same name and namespace in other branches
- 8.2 ldap_servers/LdapServer.class.php \LdapServer::initDerivedProperties()
This method sets properties that don't directly map from db record.
It is split out so it can be shared with ldapServerTest.class.php.
Parameters
$bindpw:
2 calls to LdapServer::initDerivedProperties()
- LdapServer::__construct in ldap_servers/
LdapServer.class.php - Constructor Method.
- LdapServerTest::__construct in ldap_test/
LdapServerTest.class.php - Constructor Method.
File
- ldap_servers/
LdapServer.class.php, line 282 - Defines server classes and related functions.
Class
- LdapServer
- LDAP Server Class.
Code
protected function initDerivedProperties($bindpw) {
// Get this->basedn in array format.
if (!$this->basedn) {
$this->basedn = [];
}
elseif (is_array($this->basedn)) {
}
else {
$basedn_unserialized = @unserialize($this->basedn);
if (is_array($basedn_unserialized)) {
$this->basedn = $basedn_unserialized;
}
else {
$this->basedn = [];
$token = is_scalar($basedn_unserialized) ? $basedn_unserialized : print_r($basedn_unserialized, TRUE);
debug("basednb desearialization error" . $token);
watchdog('ldap_servers', 'Failed to deserialize LdapServer::basedn of !basedn', [
'!basedn' => $token,
], WATCHDOG_ERROR);
}
}
if ($this->followrefs && !function_exists('ldap_set_rebind_proc')) {
$this->followrefs = FALSE;
}
if ($bindpw) {
$this->bindpw = $bindpw == '' ? '' : ldap_servers_decrypt($bindpw);
}
$bind_overrides = variable_get('ldap_servers_overrides', []);
if (isset($bind_overrides[$this->sid])) {
if (isset($bind_overrides[$this->sid]['binddn'])) {
$this->binddn = $bind_overrides[$this->sid]['binddn'];
}
if (isset($bind_overrides[$this->sid]['bindpw'])) {
$this->bindpw = $bind_overrides[$this->sid]['bindpw'];
}
}
$this->paginationEnabled = (bool) (ldap_servers_php_supports_pagination() && $this->searchPagination);
$this->queriableWithoutUserCredentials = (bool) ($this->bind_method == LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT || $this->bind_method == LDAP_SERVERS_BIND_METHOD_ANON_USER);
$this->editPath = !$this->sid ? '' : 'admin/config/people/ldap/servers/edit/' . $this->sid;
$this->groupGroupEntryMembershipsConfigured = $this->groupMembershipsAttrMatchingUserAttr && $this->groupMembershipsAttr;
$this->groupUserMembershipsConfigured = $this->groupUserMembershipsAttrExists && $this->groupUserMembershipsAttr;
}