Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorblizzz <blizzz@arthur-schiwon.de>2019-10-02 17:32:52 +0300
committerGitHub <noreply@github.com>2019-10-02 17:32:52 +0300
commite105d19585aef02f8d6664f6c5bc1c69cef85e39 (patch)
treeb3f454b603f52965b10f16e4f0c5af47fc02ac26 /apps/user_ldap/lib
parent9bf55c33e15e6c2a576604e35e86b344fa6f534f (diff)
parent8d2f7124201d1364e29feecedb52b96907cf0347 (diff)
Merge pull request #17002 from nextcloud/fix/noid/ldap-dont-process-known-avas
Don't process known avatars from LDAP
Diffstat (limited to 'apps/user_ldap/lib')
-rw-r--r--apps/user_ldap/lib/User/User.php22
1 files changed, 20 insertions, 2 deletions
diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php
index 5c89950e080..95e29689224 100644
--- a/apps/user_ldap/lib/User/User.php
+++ b/apps/user_ldap/lib/User/User.php
@@ -584,10 +584,26 @@ class User {
//not set, nothing left to do;
return false;
}
+
if(!$this->image->loadFromBase64(base64_encode($avatarImage))) {
return false;
}
- return $this->setOwnCloudAvatar();
+
+ // use the checksum before modifications
+ $checksum = md5($this->image->data());
+
+ if($checksum === $this->config->getUserValue($this->uid, 'user_ldap', 'lastAvatarChecksum', '')) {
+ return true;
+ }
+
+ $isSet = $this->setOwnCloudAvatar();
+
+ if($isSet) {
+ // save checksum only after successful setting
+ $this->config->setUserValue($this->uid, 'user_ldap', 'lastAvatarChecksum', $checksum);
+ }
+
+ return $isSet;
}
/**
@@ -599,8 +615,10 @@ class User {
$this->log->log('avatar image data from LDAP invalid for '.$this->dn, ILogger::ERROR);
return false;
}
+
+
//make sure it is a square and not bigger than 128x128
- $size = min(array($this->image->width(), $this->image->height(), 128));
+ $size = min([$this->image->width(), $this->image->height(), 128]);
if(!$this->image->centerCrop($size)) {
$this->log->log('croping image for avatar failed for '.$this->dn, ILogger::ERROR);
return false;