-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nextcloud 13: User changes do not get displayed #9112
Comments
@nextcloud/ldap |
There's a cache holding data for 10 minutes (by default). I guess that kicked in. I am not aware of any issues, and saw it also working as expected on a change on our instance just recently. |
I edited the user account about 4 days ago und NC still displays the old name in the contact search. |
@kroerig then, for some reasons, the local addressbook (where the contactsmenu get its data from) was not updated. Could you provide your Nextcoud log file? |
https://archiv.leibniz-remscheid.de/nextcloud.log.bz2 (9.2MB, uncompressed 400MB) |
I'm having the same issue. 'occ user:info username' on the other hand displays the correct values |
Fyi @kroerig, for now you could update Nextcloud users manually. alias occ="sudo -u www-data php /var/www/html/occ"
# read values
occ user:setting USERNAME user_ldap displayName
occ user:setting USERNAME settings email
# write values
occ user:setting USERNAME user_ldap displayName "Firstname Lastname"
occ user:setting USERNAME settings email "user@host.org"
|
I tried your commands
already shows the right value. |
Today I had the next user that had to be renamed. Same problem. Now I'm on NC 13.0.4.
I found the wrong values also in 'oc_cards_properties'. This one seems to be used for seaching of contacts. Can I clear both tables and have NC populate them again? |
You're right, oc_cards does not get updated when changing the displayName. I'd interested in a way to repopulate oc_cards from ldap too. |
fix in #12054, would be awesome if you could test it |
I tested and for me it does not work. I changed LDAP:displayname and also tried LDAP:givenname and LDAP:sn Is it possible that NC does this changes in the backgroud via cron, too? The problem is that not all users log into NC regulary, but others search for them. |
@kroerig you would need to apply the patch, first.
Yes, we switched to update user date from LDAP in a background job (unless the mode is still ajax), apart from first fetch and on logins. |
Howto? |
(In case of errors, copy to the backed up file back to its place) |
I only get |
@kroerig you were a bit overeager in trimming it down. Copy that into a file (I added a commit anyhow): From bbe44108b5661d0c3935fa76e27abbc433fd458e Mon Sep 17 00:00:00 2001
From: Arthur Schiwon <blizzz@arthur-schiwon.de>
Date: Thu, 25 Oct 2018 23:41:12 +0200
Subject: [PATCH 1/2] only write when the displayname differs, but then
announce it
refs #5212 and fixes #9112
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
---
apps/user_ldap/lib/User/User.php | 11 +++++++++--
apps/user_ldap/tests/User/UserTest.php | 25 +++++++++++++++++++++++++
2 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php
index 02764a72eca..4afc8032f73 100644
--- a/apps/user_ldap/lib/User/User.php
+++ b/apps/user_ldap/lib/User/User.php
@@ -414,14 +414,21 @@ private function store($key, $value) {
*
* @param string $displayName
* @param string $displayName2
- * @returns string the effective display name
+ * @return string the effective display name
*/
public function composeAndStoreDisplayName($displayName, $displayName2 = '') {
$displayName2 = (string)$displayName2;
if($displayName2 !== '') {
$displayName .= ' (' . $displayName2 . ')';
}
- $this->store('displayName', $displayName);
+ $oldName = $this->config->getUserValue($this->uid, 'user_ldap', 'displayName', '');
+ if ($oldName !== $displayName) {
+ $this->store('displayName', $displayName);
+ $user = $this->userManager->get($this->getUsername());
+ if ($user instanceof \OC\User\User) {
+ $user->triggerChange('displayName', $displayName);
+ }
+ }
return $displayName;
}
From 9adf5422a2b3f44018a99a0979cda3f6e297a253 Mon Sep 17 00:00:00 2001
From: Arthur Schiwon <blizzz@arthur-schiwon.de>
Date: Fri, 26 Oct 2018 17:38:42 +0200
Subject: [PATCH 2/2] do not run into UniqueConstraintViolationException
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
… when an unmapped user logs in for the first time when background job
mode is ajax and no memcache was configured.
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
---
apps/user_ldap/lib/User/User.php | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php
index 4afc8032f73..f4be19a7ad5 100644
--- a/apps/user_ldap/lib/User/User.php
+++ b/apps/user_ldap/lib/User/User.php
@@ -421,11 +421,13 @@ public function composeAndStoreDisplayName($displayName, $displayName2 = '') {
if($displayName2 !== '') {
$displayName .= ' (' . $displayName2 . ')';
}
- $oldName = $this->config->getUserValue($this->uid, 'user_ldap', 'displayName', '');
- if ($oldName !== $displayName) {
+ $oldName = $this->config->getUserValue($this->uid, 'user_ldap', 'displayName', null);
+ if ($oldName !== $displayName) {
$this->store('displayName', $displayName);
$user = $this->userManager->get($this->getUsername());
- if ($user instanceof \OC\User\User) {
+ if (!empty($oldName) && $user instanceof \OC\User\User) {
+ // if it was empty, it would be a new record, not a change emitting the trigger could
+ // potentially cause a UniqueConstraintViolationException, depending on some factors.
$user->triggerChange('displayName', $displayName);
}
}
|
hm, seams that one of my tries work. Got a new marrige announcemet for this weekend. Will try then. |
@kroerig best, copy back the backup and apply the new patch. i fixed a corner case inbetween, that probably does not affect you, nevertheless better to have the current code :) and, thanks for testing! :) |
only write when the displayname differs, but then announce it refs #5212 and fixes #9112 Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de> do not run into UniqueConstraintViolationException … when an unmapped user logs in for the first time when background job mode is ajax and no memcache was configured. Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
only write when the displayname differs, but then announce it refs #5212 and fixes #9112 Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de> do not run into UniqueConstraintViolationException … when an unmapped user logs in for the first time when background job mode is ajax and no memcache was configured. Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
@blizzz |
@kroerig email address changes are already done via the core user object and it propagates changes. Best clue: from a previous state the email was the same as saved as user preference, but the addressbook contained a different value. |
Hello,
I'm using LDAP as user source. Now I had to change some users last names und logins because of marrige. But the changes do not get into Nextcloud.
Steps to reproduce
Expected behaviour
The user should be displayed with the new values
Actual behaviour
The user is show with his old data. On CLI occ display the new data.
Server configuration
Operating system: Debian 8.10
Web server: Apache
Database: MySQL
PHP version: 5.6.33
Nextcloud version: 13.0.1
Updated from an older Nextcloud/ownCloud or fresh install: Migrated from OC
Where did you install Nextcloud from: tar ball
Signing status:
Signing status
No errors have been found.
List of activated apps:
App list
Enabled: - activity: 2.6.1 - admin_audit: 1.3.0 - admin_notifications: 1.0.1 - announcementcenter: 3.2.1 - audioplayer: 2.2.5 - bruteforcesettings: 1.0.3 - checksum: 0.3.5 - circles: 0.13.6 - comments: 1.3.0 - dav: 1.4.6 - federatedfilesharing: 1.3.1 - files: 1.8.0 - files_accesscontrol: 1.3.0 - files_automatedtagging: 1.3.0 - files_downloadactivity: 1.2.0 - files_pdfviewer: 1.2.1 - files_retention: 1.2.0 - files_sharing: 1.5.0 - files_texteditor: 2.5.1 - files_trashbin: 1.3.0 - files_versions: 1.6.0 - files_videoplayer: 1.2.0 - firstrunwizard: 2.2.1 - gallery: 18.0.0 - groupfolders: 1.2.0 - impersonate: 1.0.3 - logreader: 2.0.0 - lookup_server_connector: 1.1.0 - metadata: 0.6.0 - nextcloud_announcements: 1.2.0 - notifications: 2.1.2 - oauth2: 1.1.0 - password_policy: 1.3.0 - provisioning_api: 1.3.0 - quota_warning: 1.2.0 - richdocuments: 2.0.5 - serverinfo: 1.3.0 - sharebymail: 1.3.0 - spreed: 3.1.0 - survey_client: 1.1.0 - systemtags: 1.3.0 - theming: 1.4.1 - twofactor_backupcodes: 1.2.3 - updatenotification: 1.3.0 - user_ldap: 1.3.1 - workflowengine: 1.3.0 Disabled: - encryption - federation - files_external - user_externalNextcloud configuration:
Config report
"system": { "instanceid": "***REMOVED SENSITIVE VALUE***", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ ***REMOVED SENSITIVE VALUE***", ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "memcache.local": "\\OC\\Memcache\\APCu", "dbtype": "mysql", "version": "13.0.1.1", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbtableprefix": "oc_", "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "installed": true, "forcessl": true, "mail_from_address": "***REMOVED SENSITIVE VALUE***", "mail_smtpmode": "php", "mail_domain": "***REMOVED SENSITIVE VALUE***", "preview_libreoffice_path": "\/usr\/bin\/libreoffice", "loglevel": 3, "ldapIgnoreNamingRules": false, "ldapUserCleanupInterval": 30, "preview_max_x": 100, "preview_max_y": 100, "theme": "", "secret": "***REMOVED SENSITIVE VALUE***", "maintenance": false, "trashbin_retention_obligation": "auto", "updater.release.channel": "stable", "ldapProviderFactory": "\\OCA\\User_LDAP\\LDAPProviderFactory", "overwrite.cli.url": ***REMOVED SENSITIVE VALUE***", "htaccess.RewriteBase": "\/"Are you using external storage, if yes which one: local/smb/sftp/...
Are you using encryption: no
Are you using an external user-backend, if yes which one: LDAP
LDAP configuration (delete this part if not used)
LDAP config
+-------------------------------+------------------------------------------------------------------------------------------------------------------+ | Configuration | | +-------------------------------+------------------------------------------------------------------------------------------------------------------+ | hasMemberOfFilterSupport | | | hasPagedResultSupport | | | homeFolderNamingRule | | | lastJpegPhotoLookup | 0 | | ldapAgentName | | | ldapAgentPassword | *** | | ldapAttributesForGroupSearch | | | ldapAttributesForUserSearch | sn;givenname | | ldapBackupHost | | | ldapBackupPort | | | ldapBase | ***REMOVED SENSITIVE VALUE*** | | ldapBaseGroups | ou=Klassen,ou=Verteiler,***REMOVED SENSITIVE VALUE*** | | ldapBaseUsers | ou=Benutzer,***REMOVED SENSITIVE VALUE*** | | ldapCacheTTL | 600 | | ldapConfigurationActive | 1 | | ldapDefaultPPolicyDN | | | ldapDynamicGroupMemberURL | | | ldapEmailAttribute | mailLocalAddress | | ldapExperiencedAdmin | 0 | | ldapExpertUUIDGroupAttr | | | ldapExpertUUIDUserAttr | | | ldapExpertUsernameAttr | | | ldapGidNumber | gidNumber | | ldapGroupDisplayName | cn | | ldapGroupFilter | (&(|(objectclass=posixGroup))) | | ldapGroupFilterGroups | | | ldapGroupFilterMode | 0 | | ldapGroupFilterObjectclass | posixGroup | | ldapGroupMemberAssocAttr | memberUid | | ldapHost | localhost | | ldapIgnoreNamingRules | | | ldapLoginFilter | (&(|(objectclass=inetOrgPerson))(uid=%uid)) | | ldapLoginFilterAttributes | | | ldapLoginFilterEmail | 0 | | ldapLoginFilterMode | 0 | | ldapLoginFilterUsername | 1 | | ldapNestedGroups | 0 | | ldapOverrideMainServer | 0 | | ldapPagingSize | 500 | | ldapPort | 389 | | ldapQuotaAttribute | ownCloudQuota | | ldapQuotaDefault | 209715200 | | ldapTLS | 0 | | ldapUserDisplayName | displayname | | ldapUserDisplayName2 | | | ldapUserFilter | (|(objectclass=inetOrgPerson)) | | ldapUserFilterGroups | | | ldapUserFilterMode | 1 | | ldapUserFilterObjectclass | inetOrgPerson | | ldapUuidGroupAttribute | auto | | ldapUuidUserAttribute | auto | | turnOffCertCheck | 0 | | turnOnPasswordChange | 0 | | useMemberOfToDetectMembership | 0 | +-------------------------------+------------------------------------------------------------------------------------------------------------------+The text was updated successfully, but these errors were encountered: