aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_ldap
diff options
context:
space:
mode:
authorCôme Chilliet <91878298+come-nc@users.noreply.github.com>2023-04-24 14:11:16 +0200
committerGitHub <noreply@github.com>2023-04-24 14:11:16 +0200
commite8a48b51dc074ee2f5d23d5f48369764f917d499 (patch)
tree99060dc93d805ca18fb76c1bd0e288948e7b7e97 /apps/user_ldap
parent0f0be52be8ed1567528a341dcc950d136bd9e45c (diff)
parent621c6c3c56453360599190cbbf248a5e5ad23500 (diff)
downloadnextcloud-server-e8a48b51dc074ee2f5d23d5f48369764f917d499.tar.gz
nextcloud-server-e8a48b51dc074ee2f5d23d5f48369764f917d499.zip
Merge pull request #37856 from march42/bugfix/ldap_profiledata_removed
removed profile data from LDAP will get removed
Diffstat (limited to 'apps/user_ldap')
-rw-r--r--apps/user_ldap/lib/User/User.php30
1 files changed, 18 insertions, 12 deletions
diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php
index f6a3bf70792..f85e4206eff 100644
--- a/apps/user_ldap/lib/User/User.php
+++ b/apps/user_ldap/lib/User/User.php
@@ -249,9 +249,9 @@ class User {
$profileValues = array();
//User Profile Field - Phone number
$attr = strtolower($this->connection->ldapAttributePhone);
- if (isset($ldapEntry[$attr])) {
+ if (!empty($attr)) { // attribute configured
$profileValues[\OCP\Accounts\IAccountManager::PROPERTY_PHONE]
- = $ldapEntry[$attr][0];
+ = $ldapEntry[$attr][0] ?? "";
}
//User Profile Field - website
$attr = strtolower($this->connection->ldapAttributeWebsite);
@@ -265,6 +265,8 @@ class User {
$profileValues[\OCP\Accounts\IAccountManager::PROPERTY_WEBSITE]
= $ldapEntry[$attr][0];
}
+ } elseif (!empty($attr)) { // configured, but not defined
+ $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_WEBSITE] = "";
}
//User Profile Field - Address
$attr = strtolower($this->connection->ldapAttributeAddress);
@@ -277,36 +279,38 @@ class User {
$profileValues[\OCP\Accounts\IAccountManager::PROPERTY_ADDRESS]
= $ldapEntry[$attr][0];
}
+ } elseif (!empty($attr)) { // configured, but not defined
+ $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_ADDRESS] = "";
}
//User Profile Field - Twitter
$attr = strtolower($this->connection->ldapAttributeTwitter);
- if (isset($ldapEntry[$attr])) {
+ if (!empty($attr)) {
$profileValues[\OCP\Accounts\IAccountManager::PROPERTY_TWITTER]
- = $ldapEntry[$attr][0];
+ = $ldapEntry[$attr][0] ?? "";
}
//User Profile Field - fediverse
$attr = strtolower($this->connection->ldapAttributeFediverse);
- if (isset($ldapEntry[$attr])) {
+ if (!empty($attr)) {
$profileValues[\OCP\Accounts\IAccountManager::PROPERTY_FEDIVERSE]
- = $ldapEntry[$attr][0];
+ = $ldapEntry[$attr][0] ?? "";
}
//User Profile Field - organisation
$attr = strtolower($this->connection->ldapAttributeOrganisation);
- if (isset($ldapEntry[$attr])) {
+ if (!empty($attr)) {
$profileValues[\OCP\Accounts\IAccountManager::PROPERTY_ORGANISATION]
- = $ldapEntry[$attr][0];
+ = $ldapEntry[$attr][0] ?? "";
}
//User Profile Field - role
$attr = strtolower($this->connection->ldapAttributeRole);
- if (isset($ldapEntry[$attr])) {
+ if (!empty($attr)) {
$profileValues[\OCP\Accounts\IAccountManager::PROPERTY_ROLE]
- = $ldapEntry[$attr][0];
+ = $ldapEntry[$attr][0] ?? "";
}
//User Profile Field - headline
$attr = strtolower($this->connection->ldapAttributeHeadline);
- if (isset($ldapEntry[$attr])) {
+ if (!empty($attr)) {
$profileValues[\OCP\Accounts\IAccountManager::PROPERTY_HEADLINE]
- = $ldapEntry[$attr][0];
+ = $ldapEntry[$attr][0] ?? "";
}
//User Profile Field - biography
$attr = strtolower($this->connection->ldapAttributeBiography);
@@ -319,6 +323,8 @@ class User {
$profileValues[\OCP\Accounts\IAccountManager::PROPERTY_BIOGRAPHY]
= $ldapEntry[$attr][0];
}
+ } elseif (!empty($attr)) { // configured, but not defined
+ $profileValues[\OCP\Accounts\IAccountManager::PROPERTY_BIOGRAPHY] = "";
}
// check for changed data and cache just for TTL checking
$checksum = hash('sha256', json_encode($profileValues));