server icon indicating copy to clipboard operation
server copied to clipboard

LDAP-Import with field mail

Open Putzlappeneimer opened this issue 10 years ago • 6 comments

Steps to reproduce

  1. Fill in all LDAP settings and filters
  2. Set E-Mail field under advanced settings as mail
  3. After the import delete the E-Mail field under advanced settings as mail

Expected behaviour

Tell us what should happen and what actually happens

I want the LDAP-Users to lose their e-mail adress, because the Activity-App sends mails by default. Only special users shall get activity-mails and i would set up local accounts with their mail adress and the right activity settings. The problem is, that I can´t delete the mails from the LDAP-imported Users. If i delete the E-Mail field under advanced settings in the LDAP-Administration menu, the users still have all their mail adresses. And if i want to delete them manually in the user-setting it gets an error because it wants to delete the mail on the LDAP and it cant write there (which is allright, because I don´t want to delete the mail on the LDAP itself). Even deleting the whole LDAP-Configuration and making a new one doesnt help, because after the import mail and group-membership are automatically the old ones (I guess because even after deleting the LDAP-Settings the user-data is kept in the database somewhere? I installed the defaultactivity-App to disable Mail-notifications, but it didnt work for my LDAP-imported Users. I would be happy if i could somehow delete the imported mails for my users.

Server configuration

Operating system: Ubuntu 16.04. TLS

Web server: Apache2

Database: mariadb 10

PHP version: php 7.0

Nextcloud version: (see Nextcloud admin page) Nextcloud 10.0.1

Updated from an older Nextcloud/ownCloud or fresh install: Updated from 10.0.0 (didnt work there too)

Where did you install Nextcloud from: wget https://download.nextcloud.com/server/releases/nextcloud-10.0.0.tar.bz2

Login as admin user into your Nextcloud and access 
http://example.com/index.php/settings/integrity/failed 
paste the results here.

No errors have been found.

</details>

**List of activated apps:**
<details>
<summary>App list</summary>
Enabled:
  - admin_audit: 1.0.0
  - comments: 1.0.0
  - dav: 1.0.1
  - federatedfilesharing: 1.0.1
  - federation: 1.0.1
  - files: 1.5.2
  - files_automatedtagging: 1.1.1
  - files_external: 1.0.2
  - files_pdfviewer: 0.8.1
  - files_retention: 1.0.0
  - files_sharing: 1.0.0
  - files_texteditor: 2.1
  - files_versions: 1.3.0
  - firstrunwizard: 1.1
  - gallery: 15.0.0
  - notifications: 0.3.0
  - password_policy: 1.0.0
  - provisioning_api: 1.0.0
  - serverinfo: 1.1.1
  - survey_client: 0.1.5
  - systemtags: 1.0.2
  - templateeditor: 0.1
  - theming: 1.0.1
  - updatenotification: 1.0.1
  - user_ldap: 1.0.1
  - workflowengine: 1.0.1
Disabled:
  - activity
  - audioplayer
  - encryption
  - external
  - files_accesscontrol
  - files_trashbin
  - files_videoplayer
  - user_external
  - user_saml

</details>

**The content of config/config.php:**
<details>
<summary>Config report</summary>
  "system": {
        "instanceid": "oc74taetoih3",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            REMOVED,
            REMOVED
        ],
        "datadirectory": "\/var\/www\/nextcloud\/data",
        "overwrite.cli.url": "REMOVED
        "dbtype": "mysql",
        "version": "9.1.1.5",
        "dbname": "nextcloud",
        "dbhost": "localhost",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "Europe\/Berlin",
        "installed": true,
        "ldapIgnoreNamingRules": false,
        "ldapProviderFactory": "\\OCA\\User_LDAP\\LDAPProviderFactory",
        "mail_smtpmode": "smtp",
        "activity_expire_days": 365,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "filelocking.enabled": "true",
        "redis": {
            "host": "\/var\/run\/redis\/redis.sock",
            "port": 0,
            "timeout": 0
        },
        "loglevel": 0,
        "updater.secret": "***REMOVED SENSITIVE VALUE***",
        "maintenance": false,
        "mail_from_address": REMOVED
        "mail_domain": REMOVED
        "mail_smtphost":  REMOVED
        "mail_smtpport": "REMOVED
    }



**Are you using external storage, if yes which one:
SMB on a NAS

**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)
<details>
<summary>LDAP config</summary>
| Configuration                 | s01                                                                                               |
+-------------------------------+---------------------------------------------------------------------------------------------------+
| hasMemberOfFilterSupport      | 0                                                                                                 |
| hasPagedResultSupport         |                                                                                                   |
| homeFolderNamingRule          |                                                                                                   |
| lastJpegPhotoLookup           | 0                                                                                                 |
| ldapAgentName                 | REMOVED                                                                                |
| ldapAgentPassword             | ***                                                                                               |
| ldapAttributesForGroupSearch  |                                                                                                   |
| ldapAttributesForUserSearch   |                                                                                                   |
| ldapBackupHost                |                                                                                                   |
| ldapBackupPort                |                                                                                                   |
| ldapBase                      | REMOVED                                                                                             |
| ldapBaseGroups                |                                                                                                   |
| ldapBaseUsers                 |                                                                                                   |
| ldapCacheTTL                  | 600                                                                                               |
| ldapConfigurationActive       | 1                                                                                                 |
| ldapDynamicGroupMemberURL     |                                                                                                   |
| ldapEmailAttribute            |                                                                                                   |
| ldapExperiencedAdmin          | 0                                                                                                 |
| ldapExpertUUIDGroupAttr       | gidNumber                                                                                         |
| ldapExpertUUIDUserAttr        | uid                                                                                               |
| ldapExpertUsernameAttr        | uid                                                                                               |
| ldapGroupDisplayName          | cn                                                                                                |
| ldapGroupFilter               |                                                                                                   |
| ldapGroupFilterGroups         |                                                                                                   |
| ldapGroupFilterMode           | 0                                                                                                 |
| ldapGroupFilterObjectclass    |                                                                                                   |
| ldapGroupMemberAssocAttr      | uniqueMember                                                                                      |
| ldapHost                      | ldap.REMOVED.de                                                                                       |
| ldapIgnoreNamingRules         |                                                                                                   |
| ldapLoginFilter               | (&(&(objectclass=REMOVED)(!(gesperrt=1)))(|(uid=%uid)(|(mailPrimaryAddress=%uid)(mail=%uid)))) |
| ldapLoginFilterAttributes     |                                                                                                   |
| ldapLoginFilterEmail          | 1                                                                                                 |
| ldapLoginFilterMode           | 0                                                                                                 |
| ldapLoginFilterUsername       | 1                                                                                                 |
| ldapNestedGroups              | 0                                                                                                 |
| ldapOverrideMainServer        |                                                                                                   |
| ldapPagingSize                | 500                                                                                               |
| ldapPort                      | 389                                                                                               |
| ldapQuotaAttribute            |                                                                                                   |
| ldapQuotaDefault              |                                                                                                   |
| ldapTLS                       | 0                                                                                                 |
| ldapUserDisplayName           | displayName                                                                                       |
| ldapUserDisplayName2          |                                                                                                   |
| ldapUserFilter                | (&(objectclass=REMOVED)(!(gesperrt=1)))                                                        |
| ldapUserFilterGroups          |                                                                                                   |
| ldapUserFilterMode            | 1                                                                                                 |
| ldapUserFilterObjectclass     | REMOVED                                                                                  |
| ldapUuidGroupAttribute        | auto                                                                                              |
| ldapUuidUserAttribute         | auto                                                                                              |
| turnOffCertCheck              | 0                                                                                                 |
| useMemberOfToDetectMembership | 1         

Without access to your command line download the data/owncloud.db to your local computer or access your SQL server remotely and run the select query: SELECT * FROM oc_appconfig WHERE appid = 'user_ldap'; MariaDB [nextcloud]> SELECT * FROM oc_appconfig WHERE appid = 'user_ldap'; +-----------+--------------------------------------+---------------------------------------------------------------------------------------------------+ | appid | configkey | configvalue | +-----------+--------------------------------------+---------------------------------------------------------------------------------------------------+ | user_ldap | cleanUpJobOffset | 250 | | user_ldap | enabled | yes | | user_ldap | installed_version | 1.0.1 | | user_ldap | s01has_memberof_filter_support | 0 | | user_ldap | s01home_folder_naming_rule | | | user_ldap | s01last_jpegPhoto_lookup | 0 | | user_ldap | s01ldap_agent_password | REMOVED | | user_ldap | s01ldap_attributes_for_group_search | | | user_ldap | s01ldap_attributes_for_user_search | | | user_ldap | s01ldap_backup_host | | | user_ldap | s01ldap_backup_port | | | user_ldap | s01ldap_base | o=REMOVED | | user_ldap | s01ldap_base_groups | | | user_ldap | s01ldap_base_users | | | user_ldap | s01ldap_cache_ttl | 600 | | user_ldap | s01ldap_configuration_active | 1 | | user_ldap | s01ldap_display_name | displayName | | user_ldap | s01ldap_dn | REMOVED | | user_ldap | s01ldap_dynamic_group_member_url | | | user_ldap | s01ldap_email_attr | | | user_ldap | s01ldap_experienced_admin | 0 | | user_ldap | s01ldap_expert_username_attr | uid | | user_ldap | s01ldap_expert_uuid_group_attr | gidNumber | | user_ldap | s01ldap_expert_uuid_user_attr | uid | | user_ldap | s01ldap_group_display_name | cn | | user_ldap | s01ldap_group_filter | | | user_ldap | s01ldap_group_filter_mode | 0 | | user_ldap | s01ldap_group_member_assoc_attribute | uniqueMember | | user_ldap | s01ldap_groupfilter_groups | | | user_ldap | s01ldap_groupfilter_objectclass | | | user_ldap | s01ldap_host | REMOVED | | user_ldap | s01ldap_login_filter | (&(&(objectclass=REMOVED)(!(gesperrt=1)))(|(uid=%uid)(|(mailPrimaryAddress=%uid)(mail=%uid)))) | | user_ldap | s01ldap_login_filter_mode | 0 | | user_ldap | s01ldap_loginfilter_attributes | | | user_ldap | s01ldap_loginfilter_email | 1 | | user_ldap | s01ldap_loginfilter_username | 1 | | user_ldap | s01ldap_nested_groups | 0 | | user_ldap | s01ldap_override_main_server | | | user_ldap | s01ldap_paging_size | 500 | | user_ldap | s01ldap_port | 389 | | user_ldap | s01ldap_quota_attr | | | user_ldap | s01ldap_quota_def | | | user_ldap | s01ldap_tls | 0 | | user_ldap | s01ldap_turn_off_cert_check | 0 | | user_ldap | s01ldap_user_display_name_2 | | | user_ldap | s01ldap_user_filter_mode | 1 | | user_ldap | s01ldap_userfilter_groups | | | user_ldap | s01ldap_userfilter_objectclass | REMOVED | | user_ldap | s01ldap_userlist_filter | (&(objectclass=REMOVED)(!(gesperrt=1))) | | user_ldap | s01use_memberof_to_detect_membership | 1 | | user_ldap | types | authentication | +-----------+--------------------------------------+-------------------

Eventually replace sensitive data as the name/IP-address of your LDAP server or groups.

</details>

### Client configuration
**Browser:**
Opera
Mozilla
Edge


Putzlappeneimer avatar Nov 03 '16 10:11 Putzlappeneimer

You could also disable emails for everyone, by using the defaultactivity (which only works for new users) and manually changing the settings in the database for all existing users:

UPDATE `oc_preferences` SET `configvalue` = '0' WHERE `appid` = 'activity' AND `configkey` LIKE 'notify_email_%'

nickvergessen avatar Nov 03 '16 10:11 nickvergessen

Thanks for that Statement! I tested it out and it worked for Users, who already logged in. Imported LDAP-Users who didnt log in yet, are not effected by it, because the data for appid=activity isnt created until they log in. At least it looks like that in my database.

The default activity doesnt work for users, who already are imported, but didnt log in yet (because they aren´t new, as you said).

Putzlappeneimer avatar Nov 03 '16 12:11 Putzlappeneimer

cc @GitHubUser4234 @blizzz

MorrisJobke avatar May 11 '17 16:05 MorrisJobke

I am not convinced the email field should be emptied automatically, when the attribute is empty. After all, users can set their email address themselves in that case! To get this done properly, we would need to set a flag, that an email attribute was set and removed, and another one to track whether a users' email was reset. I have doubts whether this effort is justified.

blizzz avatar May 15 '17 22:05 blizzz

Closing, since no further comments for a while and no intentions to implement it.

blizzz avatar Dec 16 '17 10:12 blizzz

The problem still exists. If you remove the attribute "mail" from the LDAP configuration, the e-mail addresses of the LDAP users are still displayed. The user cannot change the e-mail address then.

Only those attributes should be read from the LDAP which are configured.

Please reopen this bug report and implement a fix.

Thanks!

garblixa avatar Sep 05 '20 05:09 garblixa