Nextcloud do not show accountname

nextcloud

(HF) #1

Hi,

as per title is there a way to have Nextcloud NOT display the account name between brackets (jdoe) after the users full name?

image

TIA


(Marc) #2

Display name between brackets is controlled by 2nd User Display Name Field LDAP filter:

  • Settings -> Administration: LDAP/AD integration
  • Advanced: Directory Settings:
    • Leave the 2nd User Display Name Field blank.

Nextcloud’s LDAP settings are controlled by NethServer, so a Nextcloud update or the use of some events (nethserver-nextcloud-save, nethserver-nextcloud-update…) will revert the changes to (nethserver) defaults.

A way to make the changes permanent could be to create a custom action for the events:

cp /etc/e-smith/events/actions/{nethserver-nextcloud-occ-conf,nethserver-nextcloud-occ-custom-conf}

Edit the new file:

vi /etc/e-smith/events/actions/nethserver-nextcloud-occ-custom-conf

Content of the file:

#!/usr/bin/perl

use strict;
use NethServer::SSSD;

# if php version changes, remember to update it here as well
sub OCC
{
    my $params = join(" ", @_);
    system("TERM=dumb su - apache -s /bin/bash -c \"source /opt/rh/rh-php71/enable; cd /usr/share/nextcloud/; php -dmemory_limit=512M occ $params\"");
}

# Custom user authentication
my $sssd = new NethServer::SSSD();
if ($sssd->isLdap() || $sssd->isAD()) {
    OCC "ldap:set-config s01 ldapUserDisplayName2 ''";
} else {
    # SSSD provider not configured, nothing to do
    exit 0;
}

Save the changes and quit editing the file:

:wq!

Link the new custom action to the desired events (to know which ones, I’d a look at createlinks from nethserver-nextcloud package):

cd /etc/e-smith/events/nethserver-nextcloud-save/
ln -s ../actions/nethserver-nextcloud-occ-custom-conf S31nethserver-nextcloud-occ-custom-conf
cd /etc/e-smith/events/nethserver-nextcloud-update/
ln -s ../actions/nethserver-nextcloud-occ-custom-conf S31nethserver-nextcloud-occ-custom-conf
cd /etc/e-smith/events/interface-update/
ln -s ../actions/nethserver-nextcloud-occ-custom-conf S51nethserver-nextcloud-occ-custom-conf

If full name still shows the same after the changes, and after waiting 15-20 minutes, there could be some cache involved. Check if changes are reflected in Nextcloud’s user list.


(HF) #3

So remove all old content and replace it with this short content?


(Marc) #4

Yes, on the NEW file only.


(HF) #5

Ok, I made the changes. The account name is still there (existing users), and performed both nextcloud-update and nextcloud-save. So let’s wait and see if any cache is in play.

Update, the ‘samaccountname’ re-appears after a nextcloud-save or nextcloud-update. So I need to take a look at the events.


(Marc) #6

Also check if /etc/e-smith/events/actions/nethserver-nextcloud-occ-custom-conf file is executable.

I’ve tested with openLDAP provider (not AD) and it’s working only for new users.

For old users, the old information isn’t updated and persists in database, mainly in oc_accounts table (in json format), but also in oc_cards and oc_cards_properties. Manual changes in those tables might work but have not tried. In OwnCloud occ user:sync command would take care of this, but don’t know if there’s a simple way in Nextcloud.


(HF) #7

Ok, got that corrected.

Ok, got that, I’ll try a new user.

Maybe @mrmarkuz can incorporate, while he working on NC 14.04, add a db property that prevents the display of account name by default. IMHO there is no added value in displaying the account name, and adds to security weakness.

Thank you very much.


(Marc) #8

Some related nextcloud issues…

My tests were done on NethServer 7.5 with Nextcloud 14.0.3… DisplayName not updated in database and contact list was fixed in Nextcloud 14.0.4 (available for NethServer 7.6.1810 beta):

Upgraded a test machine and the changes (customized action) worked after forcing a change in nextcloud’s ldap settings (like putting back the old value in 2nd display name and removing it afterwards).