remove noise from detectUuid and cache results
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
b68b673ea9
commit
78681a78cd
1 changed files with 25 additions and 17 deletions
|
@ -1708,13 +1708,19 @@ class Access extends LDAPUtility {
|
||||||
$uuidOverride = $this->connection->ldapExpertUUIDGroupAttr;
|
$uuidOverride = $this->connection->ldapExpertUUIDGroupAttr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(($this->connection->$uuidAttr !== 'auto') && !$force) {
|
if(!$force) {
|
||||||
return true;
|
if($this->connection->$uuidAttr !== 'auto') {
|
||||||
}
|
return true;
|
||||||
|
} else if (is_string($uuidOverride) && trim($uuidOverride) !== '') {
|
||||||
|
$this->connection->$uuidAttr = $uuidOverride;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (is_string($uuidOverride) && trim($uuidOverride) !== '' && !$force) {
|
$attribute = $this->connection->getFromCache($uuidAttr);
|
||||||
$this->connection->$uuidAttr = $uuidOverride;
|
if(!$attribute === null) {
|
||||||
return true;
|
$this->connection->$uuidAttr = $attribute;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(self::UUID_ATTRIBUTES as $attribute) {
|
foreach(self::UUID_ATTRIBUTES as $attribute) {
|
||||||
|
@ -1723,27 +1729,29 @@ class Access extends LDAPUtility {
|
||||||
if(isset($ldapRecord[$attribute])) {
|
if(isset($ldapRecord[$attribute])) {
|
||||||
$this->connection->$uuidAttr = $attribute;
|
$this->connection->$uuidAttr = $attribute;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$value = $this->readAttribute($dn, $attribute);
|
$value = $this->readAttribute($dn, $attribute);
|
||||||
if(is_array($value) && isset($value[0]) && !empty($value[0])) {
|
if(is_array($value) && isset($value[0]) && !empty($value[0])) {
|
||||||
\OCP\Util::writeLog(
|
\OC::$server->getLogger()->debug(
|
||||||
'user_ldap',
|
'Setting {attribute} as {subject}',
|
||||||
'Setting '.$attribute.' as '.$uuidAttr,
|
[
|
||||||
ILogger::DEBUG
|
'app' => 'user_ldap',
|
||||||
|
'attribute' => $attribute,
|
||||||
|
'subject' => $uuidAttr
|
||||||
|
]
|
||||||
);
|
);
|
||||||
$this->connection->$uuidAttr = $attribute;
|
$this->connection->$uuidAttr = $attribute;
|
||||||
|
$this->connection->writeToCache($uuidAttr, $attribute);
|
||||||
return true;
|
return true;
|
||||||
|
} elseif ($value === false) {
|
||||||
|
// record not available
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
\OCP\Util::writeLog(
|
\OC::$server->getLogger()->debug('Could not autodetect the UUID attribute', ['app' => 'user_ldap']);
|
||||||
'user_ldap',
|
|
||||||
'Could not autodetect the UUID attribute',
|
|
||||||
ILogger::ERROR
|
|
||||||
);
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue