nextcloud / nextcloud/server

[Bug]: Deleted ldap account is not listed in disabled users with markRemnantsAsDisabled = 1

Open
#50,165 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage 28-feedback bug feature: ldap feature: users and groups
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

Bug description

Deleted ldap account is not listed in disabled users with markRemnantsAsDisabled = 1

Steps to reproduce
  1. Have an LDAP confguration
  2. Modify the config per cli: occ ldap:set-config s01 markRemnantsAsDisabled 1
  3. Delete a users on LDAP
  4. Ensure the user is known as deleted: occ ldap:check-user $USERID
  5. Open the user management and select "disabled users"
Expected behavior

The user should appear there ;)

Nextcloud Server version

28

Additional info
  1. Weird implementation of the markRemnantsAsDisabled flag

https://github.com/nextcloud/server/blob/f63ac94b348475d144fa57d7b1399ffa84a4b330/apps/user_ldap/lib/User_Proxy.php#L423-L425

It's possible to have more than one ldap backend. The above code seems to check if the first ldap connection have the flag set. It should take all backends into account.

Likely resolved by https://github.com/nextcloud/server/pull/46992.

  1. Wrong enable state for ldap remnants

stable28:
https://github.com/nextcloud/server/blob/6c9bb46aea4492d91d6f4c0c45d742ad2005a28f/apps/provisioning_api/lib/Controller/AUserData.php#L127

master:
https://github.com/nextcloud/server/blob/f63ac94b348475d144fa57d7b1399ffa84a4b330/apps/provisioning_api/lib/Controller/AUserDataOCSController.php#L90

The controller reads the disable state from the oc_preferences table. That does not take the disabled state for ldap remnants into account.

Apparently the users are returned by the endpoint, but filtered out by the frontend because they have enabled = true. Using $data['enabled'] = $targetUserObject->isEnabled(); makes it work. However there are some menu options, like enable user, that needs to be hidden for ldap remnants.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with apps/user_ldap/lib/User_Proxy.php around the markRemnantsAsDisabled logic and the provisioning API controllers named for stable28 and master. Check how LDAP remnants are represented in the disabled-users response and how the frontend filters their enabled state, including menu actions. Confirm the behavior with the relevant LDAP and provisioning API tests, if present.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api, authentication, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.