Merge pull request #3050 from owncloud/===_and_!==_in_user_ldap-app
Use === and !== in user_ldap app
This commit is contained in:
commit
175633d380
|
@ -24,7 +24,7 @@
|
||||||
OCP\App::registerAdmin('user_ldap', 'settings');
|
OCP\App::registerAdmin('user_ldap', 'settings');
|
||||||
|
|
||||||
$configPrefixes = OCA\user_ldap\lib\Helper::getServerConfigurationPrefixes(true);
|
$configPrefixes = OCA\user_ldap\lib\Helper::getServerConfigurationPrefixes(true);
|
||||||
if(count($configPrefixes) == 1) {
|
if(count($configPrefixes) === 1) {
|
||||||
$connector = new OCA\user_ldap\lib\Connection($configPrefixes[0]);
|
$connector = new OCA\user_ldap\lib\Connection($configPrefixes[0]);
|
||||||
$userBackend = new OCA\user_ldap\USER_LDAP();
|
$userBackend = new OCA\user_ldap\USER_LDAP();
|
||||||
$userBackend->setConnector($connector);
|
$userBackend->setConnector($connector);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$state = OCP\Config::getSystemValue('ldapIgnoreNamingRules', 'doSet');
|
$state = OCP\Config::getSystemValue('ldapIgnoreNamingRules', 'doSet');
|
||||||
if($state == 'doSet') {
|
if($state === 'doSet') {
|
||||||
OCP\Config::setSystemValue('ldapIgnoreNamingRules', false);
|
OCP\Config::setSystemValue('ldapIgnoreNamingRules', false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ if(!is_null($pw)) {
|
||||||
//detect if we can switch on naming guidelines. We won't do it on conflicts.
|
//detect if we can switch on naming guidelines. We won't do it on conflicts.
|
||||||
//it's a bit spaghetti, but hey.
|
//it's a bit spaghetti, but hey.
|
||||||
$state = OCP\Config::getSystemValue('ldapIgnoreNamingRules', 'unset');
|
$state = OCP\Config::getSystemValue('ldapIgnoreNamingRules', 'unset');
|
||||||
if($state == 'unset') {
|
if($state === 'unset') {
|
||||||
OCP\Config::setSystemValue('ldapIgnoreNamingRules', false);
|
OCP\Config::setSystemValue('ldapIgnoreNamingRules', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ foreach($objects as $object) {
|
||||||
$newDN = escapeDN(mb_strtolower($dn['ldap_dn'], 'UTF-8'));
|
$newDN = escapeDN(mb_strtolower($dn['ldap_dn'], 'UTF-8'));
|
||||||
if(!empty($dn['directory_uuid'])) {
|
if(!empty($dn['directory_uuid'])) {
|
||||||
$uuid = $dn['directory_uuid'];
|
$uuid = $dn['directory_uuid'];
|
||||||
} elseif($object == 'user') {
|
} elseif($object === 'user') {
|
||||||
$uuid = $userBE->getUUID($newDN);
|
$uuid = $userBE->getUUID($newDN);
|
||||||
//fix home folder to avoid new ones depending on the configuration
|
//fix home folder to avoid new ones depending on the configuration
|
||||||
$userBE->getHome($dn['owncloud_name']);
|
$userBE->getHome($dn['owncloud_name']);
|
||||||
|
|
|
@ -66,7 +66,7 @@ class GROUP_LDAP extends lib\Access implements \OCP\GroupInterface {
|
||||||
|
|
||||||
//extra work if we don't get back user DNs
|
//extra work if we don't get back user DNs
|
||||||
//TODO: this can be done with one LDAP query
|
//TODO: this can be done with one LDAP query
|
||||||
if(strtolower($this->connection->ldapGroupMemberAssocAttr) == 'memberuid') {
|
if(strtolower($this->connection->ldapGroupMemberAssocAttr) === 'memberuid') {
|
||||||
$dns = array();
|
$dns = array();
|
||||||
foreach($members as $mid) {
|
foreach($members as $mid) {
|
||||||
$filter = str_replace('%uid', $mid, $this->connection->ldapLoginFilter);
|
$filter = str_replace('%uid', $mid, $this->connection->ldapLoginFilter);
|
||||||
|
@ -108,11 +108,11 @@ class GROUP_LDAP extends lib\Access implements \OCP\GroupInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
//uniqueMember takes DN, memberuid the uid, so we need to distinguish
|
//uniqueMember takes DN, memberuid the uid, so we need to distinguish
|
||||||
if((strtolower($this->connection->ldapGroupMemberAssocAttr) == 'uniquemember')
|
if((strtolower($this->connection->ldapGroupMemberAssocAttr) === 'uniquemember')
|
||||||
|| (strtolower($this->connection->ldapGroupMemberAssocAttr) == 'member')
|
|| (strtolower($this->connection->ldapGroupMemberAssocAttr) === 'member')
|
||||||
) {
|
) {
|
||||||
$uid = $userDN;
|
$uid = $userDN;
|
||||||
} else if(strtolower($this->connection->ldapGroupMemberAssocAttr) == 'memberuid') {
|
} else if(strtolower($this->connection->ldapGroupMemberAssocAttr) === 'memberuid') {
|
||||||
$result = $this->readAttribute($userDN, 'uid');
|
$result = $this->readAttribute($userDN, 'uid');
|
||||||
$uid = $result[0];
|
$uid = $result[0];
|
||||||
} else {
|
} else {
|
||||||
|
@ -157,7 +157,7 @@ class GROUP_LDAP extends lib\Access implements \OCP\GroupInterface {
|
||||||
return $groupUsers;
|
return $groupUsers;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($limit == -1) {
|
if($limit === -1) {
|
||||||
$limit = null;
|
$limit = null;
|
||||||
}
|
}
|
||||||
$groupDN = $this->groupname2dn($gid);
|
$groupDN = $this->groupname2dn($gid);
|
||||||
|
@ -175,7 +175,7 @@ class GROUP_LDAP extends lib\Access implements \OCP\GroupInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
$groupUsers = array();
|
$groupUsers = array();
|
||||||
$isMemberUid = (strtolower($this->connection->ldapGroupMemberAssocAttr) == 'memberuid');
|
$isMemberUid = (strtolower($this->connection->ldapGroupMemberAssocAttr) === 'memberuid');
|
||||||
foreach($members as $member) {
|
foreach($members as $member) {
|
||||||
if($isMemberUid) {
|
if($isMemberUid) {
|
||||||
//we got uids, need to get their DNs to 'tranlsate' them to usernames
|
//we got uids, need to get their DNs to 'tranlsate' them to usernames
|
||||||
|
|
|
@ -8,13 +8,13 @@ var LdapConfiguration = {
|
||||||
OC.filePath('user_ldap','ajax','getConfiguration.php'),
|
OC.filePath('user_ldap','ajax','getConfiguration.php'),
|
||||||
$('#ldap_serverconfig_chooser').serialize(),
|
$('#ldap_serverconfig_chooser').serialize(),
|
||||||
function (result) {
|
function (result) {
|
||||||
if(result.status == 'success') {
|
if(result.status === 'success') {
|
||||||
$.each(result.configuration, function(configkey, configvalue) {
|
$.each(result.configuration, function(configkey, configvalue) {
|
||||||
elementID = '#'+configkey;
|
elementID = '#'+configkey;
|
||||||
|
|
||||||
//deal with Checkboxes
|
//deal with Checkboxes
|
||||||
if($(elementID).is('input[type=checkbox]')) {
|
if($(elementID).is('input[type=checkbox]')) {
|
||||||
if(configvalue == 1) {
|
if(configvalue === 1) {
|
||||||
$(elementID).attr('checked', 'checked');
|
$(elementID).attr('checked', 'checked');
|
||||||
} else {
|
} else {
|
||||||
$(elementID).removeAttr('checked');
|
$(elementID).removeAttr('checked');
|
||||||
|
@ -37,13 +37,13 @@ var LdapConfiguration = {
|
||||||
|
|
||||||
resetDefaults: function() {
|
resetDefaults: function() {
|
||||||
$('#ldap').find('input[type=text], input[type=number], input[type=password], textarea, select').each(function() {
|
$('#ldap').find('input[type=text], input[type=number], input[type=password], textarea, select').each(function() {
|
||||||
if($(this).attr('id') == 'ldap_serverconfig_chooser') {
|
if($(this).attr('id') === 'ldap_serverconfig_chooser') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$(this).val($(this).attr('data-default'));
|
$(this).val($(this).attr('data-default'));
|
||||||
});
|
});
|
||||||
$('#ldap').find('input[type=checkbox]').each(function() {
|
$('#ldap').find('input[type=checkbox]').each(function() {
|
||||||
if($(this).attr('data-default') == 1) {
|
if($(this).attr('data-default') === 1) {
|
||||||
$(this).attr('checked', 'checked');
|
$(this).attr('checked', 'checked');
|
||||||
} else {
|
} else {
|
||||||
$(this).removeAttr('checked');
|
$(this).removeAttr('checked');
|
||||||
|
@ -56,7 +56,7 @@ var LdapConfiguration = {
|
||||||
OC.filePath('user_ldap','ajax','deleteConfiguration.php'),
|
OC.filePath('user_ldap','ajax','deleteConfiguration.php'),
|
||||||
$('#ldap_serverconfig_chooser').serialize(),
|
$('#ldap_serverconfig_chooser').serialize(),
|
||||||
function (result) {
|
function (result) {
|
||||||
if(result.status == 'success') {
|
if(result.status === 'success') {
|
||||||
$('#ldap_serverconfig_chooser option:selected').remove();
|
$('#ldap_serverconfig_chooser option:selected').remove();
|
||||||
$('#ldap_serverconfig_chooser option:first').select();
|
$('#ldap_serverconfig_chooser option:first').select();
|
||||||
LdapConfiguration.refreshConfig();
|
LdapConfiguration.refreshConfig();
|
||||||
|
@ -74,7 +74,7 @@ var LdapConfiguration = {
|
||||||
$.post(
|
$.post(
|
||||||
OC.filePath('user_ldap','ajax','getNewServerConfigPrefix.php'),
|
OC.filePath('user_ldap','ajax','getNewServerConfigPrefix.php'),
|
||||||
function (result) {
|
function (result) {
|
||||||
if(result.status == 'success') {
|
if(result.status === 'success') {
|
||||||
if(doNotAsk) {
|
if(doNotAsk) {
|
||||||
LdapConfiguration.resetDefaults();
|
LdapConfiguration.resetDefaults();
|
||||||
} else {
|
} else {
|
||||||
|
@ -115,7 +115,7 @@ $(document).ready(function() {
|
||||||
OC.filePath('user_ldap','ajax','testConfiguration.php'),
|
OC.filePath('user_ldap','ajax','testConfiguration.php'),
|
||||||
$('#ldap').serialize(),
|
$('#ldap').serialize(),
|
||||||
function (result) {
|
function (result) {
|
||||||
if (result.status == 'success') {
|
if (result.status === 'success') {
|
||||||
OC.dialogs.alert(
|
OC.dialogs.alert(
|
||||||
result.message,
|
result.message,
|
||||||
t('user_ldap', 'Connection test succeeded')
|
t('user_ldap', 'Connection test succeeded')
|
||||||
|
@ -150,7 +150,7 @@ $(document).ready(function() {
|
||||||
$('#ldap').serialize(),
|
$('#ldap').serialize(),
|
||||||
function (result) {
|
function (result) {
|
||||||
bgcolor = $('#ldap_submit').css('background');
|
bgcolor = $('#ldap_submit').css('background');
|
||||||
if (result.status == 'success') {
|
if (result.status === 'success') {
|
||||||
//the dealing with colors is a but ugly, but the jQuery version in use has issues with rgba colors
|
//the dealing with colors is a but ugly, but the jQuery version in use has issues with rgba colors
|
||||||
$('#ldap_submit').css('background', '#fff');
|
$('#ldap_submit').css('background', '#fff');
|
||||||
$('#ldap_submit').effect('highlight', {'color':'#A8FA87'}, 5000, function() {
|
$('#ldap_submit').effect('highlight', {'color':'#A8FA87'}, 5000, function() {
|
||||||
|
@ -168,7 +168,7 @@ $(document).ready(function() {
|
||||||
|
|
||||||
$('#ldap_serverconfig_chooser').change(function(event) {
|
$('#ldap_serverconfig_chooser').change(function(event) {
|
||||||
value = $('#ldap_serverconfig_chooser option:selected:first').attr('value');
|
value = $('#ldap_serverconfig_chooser option:selected:first').attr('value');
|
||||||
if(value == 'NEW') {
|
if(value === 'NEW') {
|
||||||
LdapConfiguration.addConfiguration(false);
|
LdapConfiguration.addConfiguration(false);
|
||||||
} else {
|
} else {
|
||||||
LdapConfiguration.refreshConfig();
|
LdapConfiguration.refreshConfig();
|
||||||
|
|
|
@ -87,7 +87,7 @@ abstract class Access {
|
||||||
for($i=0;$i<$result[$attr]['count'];$i++) {
|
for($i=0;$i<$result[$attr]['count'];$i++) {
|
||||||
if($this->resemblesDN($attr)) {
|
if($this->resemblesDN($attr)) {
|
||||||
$values[] = $this->sanitizeDN($result[$attr][$i]);
|
$values[] = $this->sanitizeDN($result[$attr][$i]);
|
||||||
} elseif(strtolower($attr) == 'objectguid' || strtolower($attr) == 'guid') {
|
} elseif(strtolower($attr) === 'objectguid' || strtolower($attr) === 'guid') {
|
||||||
$values[] = $this->convertObjectGUID2Str($result[$attr][$i]);
|
$values[] = $this->convertObjectGUID2Str($result[$attr][$i]);
|
||||||
} else {
|
} else {
|
||||||
$values[] = $result[$attr][$i];
|
$values[] = $result[$attr][$i];
|
||||||
|
@ -462,7 +462,7 @@ abstract class Access {
|
||||||
while($row = $res->fetchRow()) {
|
while($row = $res->fetchRow()) {
|
||||||
$usedNames[] = $row['owncloud_name'];
|
$usedNames[] = $row['owncloud_name'];
|
||||||
}
|
}
|
||||||
if(!($usedNames) || count($usedNames) == 0) {
|
if(!($usedNames) || count($usedNames) === 0) {
|
||||||
$lastNo = 1; //will become name_2
|
$lastNo = 1; //will become name_2
|
||||||
} else {
|
} else {
|
||||||
natsort($usedNames);
|
natsort($usedNames);
|
||||||
|
@ -550,7 +550,7 @@ abstract class Access {
|
||||||
|
|
||||||
$sqlAdjustment = '';
|
$sqlAdjustment = '';
|
||||||
$dbtype = \OCP\Config::getSystemValue('dbtype');
|
$dbtype = \OCP\Config::getSystemValue('dbtype');
|
||||||
if($dbtype == 'mysql') {
|
if($dbtype === 'mysql') {
|
||||||
$sqlAdjustment = 'FROM DUAL';
|
$sqlAdjustment = 'FROM DUAL';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -574,7 +574,7 @@ abstract class Access {
|
||||||
|
|
||||||
$insRows = $res->numRows();
|
$insRows = $res->numRows();
|
||||||
|
|
||||||
if($insRows == 0) {
|
if($insRows === 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -656,7 +656,7 @@ abstract class Access {
|
||||||
$linkResources = array_pad(array(), count($base), $link_resource);
|
$linkResources = array_pad(array(), count($base), $link_resource);
|
||||||
$sr = ldap_search($linkResources, $base, $filter, $attr);
|
$sr = ldap_search($linkResources, $base, $filter, $attr);
|
||||||
$error = ldap_errno($link_resource);
|
$error = ldap_errno($link_resource);
|
||||||
if(!is_array($sr) || $error != 0) {
|
if(!is_array($sr) || $error !== 0) {
|
||||||
\OCP\Util::writeLog('user_ldap',
|
\OCP\Util::writeLog('user_ldap',
|
||||||
'Error when searching: '.ldap_error($link_resource).' code '.ldap_errno($link_resource),
|
'Error when searching: '.ldap_error($link_resource).' code '.ldap_errno($link_resource),
|
||||||
\OCP\Util::ERROR);
|
\OCP\Util::ERROR);
|
||||||
|
@ -724,7 +724,7 @@ abstract class Access {
|
||||||
foreach($attr as $key) {
|
foreach($attr as $key) {
|
||||||
$key = mb_strtolower($key, 'UTF-8');
|
$key = mb_strtolower($key, 'UTF-8');
|
||||||
if(isset($item[$key])) {
|
if(isset($item[$key])) {
|
||||||
if($key != 'dn') {
|
if($key !== 'dn') {
|
||||||
$selection[$i][$key] = $this->resemblesDN($key) ?
|
$selection[$i][$key] = $this->resemblesDN($key) ?
|
||||||
$this->sanitizeDN($item[$key][0])
|
$this->sanitizeDN($item[$key][0])
|
||||||
: $item[$key][0];
|
: $item[$key][0];
|
||||||
|
@ -816,7 +816,7 @@ abstract class Access {
|
||||||
private function combineFilter($filters, $operator) {
|
private function combineFilter($filters, $operator) {
|
||||||
$combinedFilter = '('.$operator;
|
$combinedFilter = '('.$operator;
|
||||||
foreach($filters as $filter) {
|
foreach($filters as $filter) {
|
||||||
if($filter[0] != '(') {
|
if($filter[0] !== '(') {
|
||||||
$filter = '('.$filter.')';
|
$filter = '('.$filter.')';
|
||||||
}
|
}
|
||||||
$combinedFilter.=$filter;
|
$combinedFilter.=$filter;
|
||||||
|
@ -857,7 +857,7 @@ abstract class Access {
|
||||||
private function getFilterPartForSearch($search, $searchAttributes, $fallbackAttribute) {
|
private function getFilterPartForSearch($search, $searchAttributes, $fallbackAttribute) {
|
||||||
$filter = array();
|
$filter = array();
|
||||||
$search = empty($search) ? '*' : '*'.$search.'*';
|
$search = empty($search) ? '*' : '*'.$search.'*';
|
||||||
if(!is_array($searchAttributes) || count($searchAttributes) == 0) {
|
if(!is_array($searchAttributes) || count($searchAttributes) === 0) {
|
||||||
if(empty($fallbackAttribute)) {
|
if(empty($fallbackAttribute)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
@ -867,7 +867,7 @@ abstract class Access {
|
||||||
$filter[] = $attribute . '=' . $search;
|
$filter[] = $attribute . '=' . $search;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(count($filter) == 1) {
|
if(count($filter) === 1) {
|
||||||
return '('.$filter[0].')';
|
return '('.$filter[0].')';
|
||||||
}
|
}
|
||||||
return $this->combineFilterWithOr($filter);
|
return $this->combineFilterWithOr($filter);
|
||||||
|
@ -893,7 +893,7 @@ abstract class Access {
|
||||||
* @returns true on success, false otherwise
|
* @returns true on success, false otherwise
|
||||||
*/
|
*/
|
||||||
private function detectUuidAttribute($dn, $force = false) {
|
private function detectUuidAttribute($dn, $force = false) {
|
||||||
if(($this->connection->ldapUuidAttribute != 'auto') && !$force) {
|
if(($this->connection->ldapUuidAttribute !== 'auto') && !$force) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1007,7 +1007,7 @@ abstract class Access {
|
||||||
* @returns string containing the key or empty if none is cached
|
* @returns string containing the key or empty if none is cached
|
||||||
*/
|
*/
|
||||||
private function getPagedResultCookie($base, $filter, $limit, $offset) {
|
private function getPagedResultCookie($base, $filter, $limit, $offset) {
|
||||||
if($offset == 0) {
|
if($offset === 0) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
$offset -= $limit;
|
$offset -= $limit;
|
||||||
|
|
|
@ -99,7 +99,7 @@ class Connection {
|
||||||
public function __set($name, $value) {
|
public function __set($name, $value) {
|
||||||
$changed = false;
|
$changed = false;
|
||||||
//only few options are writable
|
//only few options are writable
|
||||||
if($name == 'ldapUuidAttribute') {
|
if($name === 'ldapUuidAttribute') {
|
||||||
\OCP\Util::writeLog('user_ldap', 'Set config ldapUuidAttribute to '.$value, \OCP\Util::DEBUG);
|
\OCP\Util::writeLog('user_ldap', 'Set config ldapUuidAttribute to '.$value, \OCP\Util::DEBUG);
|
||||||
$this->config[$name] = $value;
|
$this->config[$name] = $value;
|
||||||
if(!empty($this->configID)) {
|
if(!empty($this->configID)) {
|
||||||
|
@ -321,9 +321,9 @@ class Connection {
|
||||||
$params = $this->getConfigTranslationArray();
|
$params = $this->getConfigTranslationArray();
|
||||||
|
|
||||||
foreach($config as $parameter => $value) {
|
foreach($config as $parameter => $value) {
|
||||||
if(($parameter == 'homeFolderNamingRule'
|
if(($parameter === 'homeFolderNamingRule'
|
||||||
|| (isset($params[$parameter])
|
|| (isset($params[$parameter])
|
||||||
&& $params[$parameter] == 'homeFolderNamingRule'))
|
&& $params[$parameter] === 'homeFolderNamingRule'))
|
||||||
&& !empty($value)) {
|
&& !empty($value)) {
|
||||||
$value = 'attr:'.$value;
|
$value = 'attr:'.$value;
|
||||||
}
|
}
|
||||||
|
@ -389,7 +389,7 @@ class Connection {
|
||||||
$trans = $this->getConfigTranslationArray();
|
$trans = $this->getConfigTranslationArray();
|
||||||
$config = array();
|
$config = array();
|
||||||
foreach($trans as $dbKey => $classKey) {
|
foreach($trans as $dbKey => $classKey) {
|
||||||
if($classKey == 'homeFolderNamingRule') {
|
if($classKey === 'homeFolderNamingRule') {
|
||||||
if(strpos($this->config[$classKey], 'attr:') === 0) {
|
if(strpos($this->config[$classKey], 'attr:') === 0) {
|
||||||
$config[$dbKey] = substr($this->config[$classKey], 5);
|
$config[$dbKey] = substr($this->config[$classKey], 5);
|
||||||
} else {
|
} else {
|
||||||
|
@ -442,7 +442,7 @@ class Connection {
|
||||||
}
|
}
|
||||||
foreach(array('ldapAttributesForUserSearch', 'ldapAttributesForGroupSearch') as $key) {
|
foreach(array('ldapAttributesForUserSearch', 'ldapAttributesForGroupSearch') as $key) {
|
||||||
if(is_array($this->config[$key])
|
if(is_array($this->config[$key])
|
||||||
&& count($this->config[$key]) == 1
|
&& count($this->config[$key]) === 1
|
||||||
&& empty($this->config[$key][0])) {
|
&& empty($this->config[$key][0])) {
|
||||||
$this->config[$key] = array();
|
$this->config[$key] = array();
|
||||||
}
|
}
|
||||||
|
@ -590,12 +590,12 @@ class Connection {
|
||||||
|
|
||||||
$error = null;
|
$error = null;
|
||||||
//if LDAP server is not reachable, try the Backup (Replica!) Server
|
//if LDAP server is not reachable, try the Backup (Replica!) Server
|
||||||
if((!$bindStatus && ($error == -1))
|
if((!$bindStatus && ($error === -1))
|
||||||
|| $this->config['ldapOverrideMainServer']
|
|| $this->config['ldapOverrideMainServer']
|
||||||
|| $this->getFromCache('overrideMainServer')) {
|
|| $this->getFromCache('overrideMainServer')) {
|
||||||
$this->doConnect($this->config['ldapBackupHost'], $this->config['ldapBackupPort']);
|
$this->doConnect($this->config['ldapBackupHost'], $this->config['ldapBackupPort']);
|
||||||
$bindStatus = $this->bind();
|
$bindStatus = $this->bind();
|
||||||
if($bindStatus && $error == -1) {
|
if($bindStatus && $error === -1) {
|
||||||
//when bind to backup server succeeded and failed to main server,
|
//when bind to backup server succeeded and failed to main server,
|
||||||
//skip contacting him until next cache refresh
|
//skip contacting him until next cache refresh
|
||||||
$this->writeToCache('overrideMainServer', true);
|
$this->writeToCache('overrideMainServer', true);
|
||||||
|
|
|
@ -96,7 +96,7 @@ class Helper {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($res->numRows() == 0) {
|
if($res->numRows() === 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<fieldset id="ldapSettings-1">
|
<fieldset id="ldapSettings-1">
|
||||||
<p><label for="ldap_serverconfig_chooser"><?php p($l->t('Server configuration'));?></label>
|
<p><label for="ldap_serverconfig_chooser"><?php p($l->t('Server configuration'));?></label>
|
||||||
<select id="ldap_serverconfig_chooser" name="ldap_serverconfig_chooser">
|
<select id="ldap_serverconfig_chooser" name="ldap_serverconfig_chooser">
|
||||||
<?php if(count($_['serverConfigurationPrefixes']) == 0 ) {
|
<?php if(count($_['serverConfigurationPrefixes']) === 0 ) {
|
||||||
?>
|
?>
|
||||||
<option value="" selected>1. Server</option>');
|
<option value="" selected>1. Server</option>');
|
||||||
<?php
|
<?php
|
||||||
|
@ -85,7 +85,7 @@
|
||||||
<p><label for="ldap_group_display_name"><?php p($l->t('Group Display Name Field'));?></label><input type="text" id="ldap_group_display_name" name="ldap_group_display_name" data-default="<?php p($_['ldap_group_display_name_default']); ?>" title="<?php p($l->t('The LDAP attribute to use to generate the groups`s ownCloud name.'));?>" /></p>
|
<p><label for="ldap_group_display_name"><?php p($l->t('Group Display Name Field'));?></label><input type="text" id="ldap_group_display_name" name="ldap_group_display_name" data-default="<?php p($_['ldap_group_display_name_default']); ?>" title="<?php p($l->t('The LDAP attribute to use to generate the groups`s ownCloud name.'));?>" /></p>
|
||||||
<p><label for="ldap_base_groups"><?php p($l->t('Base Group Tree'));?></label><textarea id="ldap_base_groups" name="ldap_base_groups" placeholder="<?php p($l->t('One Group Base DN per line'));?>" data-default="<?php p($_['ldap_base_groups_default']); ?>" title="<?php p($l->t('Base Group Tree'));?>"></textarea></p>
|
<p><label for="ldap_base_groups"><?php p($l->t('Base Group Tree'));?></label><textarea id="ldap_base_groups" name="ldap_base_groups" placeholder="<?php p($l->t('One Group Base DN per line'));?>" data-default="<?php p($_['ldap_base_groups_default']); ?>" title="<?php p($l->t('Base Group Tree'));?>"></textarea></p>
|
||||||
<p><label for="ldap_attributes_for_group_search"><?php p($l->t('Group Search Attributes'));?></label><textarea id="ldap_attributes_for_group_search" name="ldap_attributes_for_group_search" placeholder="<?php p($l->t('Optional; one attribute per line'));?>" data-default="<?php p($_['ldap_attributes_for_group_search_default']); ?>" title="<?php p($l->t('Group Search Attributes'));?>"></textarea></p>
|
<p><label for="ldap_attributes_for_group_search"><?php p($l->t('Group Search Attributes'));?></label><textarea id="ldap_attributes_for_group_search" name="ldap_attributes_for_group_search" placeholder="<?php p($l->t('Optional; one attribute per line'));?>" data-default="<?php p($_['ldap_attributes_for_group_search_default']); ?>" title="<?php p($l->t('Group Search Attributes'));?>"></textarea></p>
|
||||||
<p><label for="ldap_group_member_assoc_attribute"><?php p($l->t('Group-Member association'));?></label><select id="ldap_group_member_assoc_attribute" name="ldap_group_member_assoc_attribute" data-default="<?php p($_['ldap_group_member_assoc_attribute_default']); ?>" ><option value="uniqueMember"<?php if (isset($_['ldap_group_member_assoc_attribute']) && ($_['ldap_group_member_assoc_attribute'] == 'uniqueMember')) p(' selected'); ?>>uniqueMember</option><option value="memberUid"<?php if (isset($_['ldap_group_member_assoc_attribute']) && ($_['ldap_group_member_assoc_attribute'] == 'memberUid')) p(' selected'); ?>>memberUid</option><option value="member"<?php if (isset($_['ldap_group_member_assoc_attribute']) && ($_['ldap_group_member_assoc_attribute'] == 'member')) p(' selected'); ?>>member (AD)</option></select></p>
|
<p><label for="ldap_group_member_assoc_attribute"><?php p($l->t('Group-Member association'));?></label><select id="ldap_group_member_assoc_attribute" name="ldap_group_member_assoc_attribute" data-default="<?php p($_['ldap_group_member_assoc_attribute_default']); ?>" ><option value="uniqueMember"<?php if (isset($_['ldap_group_member_assoc_attribute']) && ($_['ldap_group_member_assoc_attribute'] === 'uniqueMember')) p(' selected'); ?>>uniqueMember</option><option value="memberUid"<?php if (isset($_['ldap_group_member_assoc_attribute']) && ($_['ldap_group_member_assoc_attribute'] === 'memberUid')) p(' selected'); ?>>memberUid</option><option value="member"<?php if (isset($_['ldap_group_member_assoc_attribute']) && ($_['ldap_group_member_assoc_attribute'] === 'member')) p(' selected'); ?>>member (AD)</option></select></p>
|
||||||
</div>
|
</div>
|
||||||
<h3><?php p($l->t('Special Attributes'));?></h3>
|
<h3><?php p($l->t('Special Attributes'));?></h3>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -197,9 +197,9 @@ class USER_LDAP extends lib\Access implements \OCP\UserInterface {
|
||||||
//if attribute's value is an absolute path take this, otherwise append it to data dir
|
//if attribute's value is an absolute path take this, otherwise append it to data dir
|
||||||
//check for / at the beginning or pattern c:\ resp. c:/
|
//check for / at the beginning or pattern c:\ resp. c:/
|
||||||
if(
|
if(
|
||||||
'/' == $path[0]
|
'/' === $path[0]
|
||||||
|| (3 < strlen($path) && ctype_alpha($path[0])
|
|| (3 < strlen($path) && ctype_alpha($path[0])
|
||||||
&& $path[1] == ':' && ('\\' == $path[2] || '/' == $path[2]))
|
&& $path[1] === ':' && ('\\' === $path[2] || '/' === $path[2]))
|
||||||
) {
|
) {
|
||||||
$homedir = $path;
|
$homedir = $path;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue