summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2013-11-22 23:58:30 +0100
committerArthur Schiwon <blizzz@owncloud.com>2013-11-22 23:58:30 +0100
commitd9347f2c9b1411a06a742e45702d6c27d7a2d1b4 (patch)
tree8f2dbd1212f990ddd4898d5bc749707d3e0068ef
parent6085878966e44ff53d1d088ae6776ebfba70ff72 (diff)
downloadnextcloud-server-d9347f2c9b1411a06a742e45702d6c27d7a2d1b4.tar.gz
nextcloud-server-d9347f2c9b1411a06a742e45702d6c27d7a2d1b4.zip
LDAP: last avatar lookup must be stored per user. Someone had a blackout, eh?
-rw-r--r--apps/user_ldap/user_ldap.php11
1 files changed, 6 insertions, 5 deletions
diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php
index 2bff4b28212..97fc2fbb6c8 100644
--- a/apps/user_ldap/user_ldap.php
+++ b/apps/user_ldap/user_ldap.php
@@ -76,20 +76,22 @@ class USER_LDAP extends BackendUtility implements \OCP\UserInterface {
* @return void
*/
private function updateAvatar($uid, $dn) {
- $lastChecked = $this->access->connection->lastJpegPhotoLookup;
+ $lastChecked = \OCP\Config::getUserValue($uid, 'user_ldap', 'lastJpegPhotoLookup', 0);
if((time() - $lastChecked) < 86400 ) {
//update only once a day
return;
}
$jpegPhoto = $this->access->readAttribute($dn, 'jpegPhoto');
- $this->access->connection->lastJpegPhotoLookup = time();
+ \OCP\Config::setUserValue($uid, 'user_ldap', 'lastJpegPhotoLookup', time());
if(!$jpegPhoto || !is_array($jpegPhoto) || !isset($jpegPhoto[0])) {
//not set, nothing left to do;
return;
}
- $image = new \OCP\Image($jpegPhoto[0]);
+ $image = new \OCP\Image();
+ $image->loadFromBase64(base64_encode($jpegPhoto[0]));
+
if(!$image->valid()) {
\OCP\Util::writeLog('user_ldap', 'jpegPhoto data invalid for '.$dn,
\OCP\Util::ERROR);
@@ -103,10 +105,9 @@ class USER_LDAP extends BackendUtility implements \OCP\UserInterface {
\OCP\Util::ERROR);
return;
}
-
$avatarManager = \OC::$server->getAvatarManager();
$avatar = $avatarManager->getAvatar($uid);
- $avatar->set($image->data());
+ $avatar->set($image);
}
/**