Skip to content
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

User search not efficient, returns partial matches #11540

Closed
ghost opened this issue Oct 2, 2018 · 10 comments · May be fixed by #45555
Closed

User search not efficient, returns partial matches #11540

ghost opened this issue Oct 2, 2018 · 10 comments · May be fixed by #45555
Labels

Comments

@ghost
Copy link

ghost commented Oct 2, 2018

Steps to reproduce

  1. Go to the user section
  2. Search for part of the full name or username

Expected behaviour

I should find users with parts of there full name or there username

Actual behaviour

I only find user when i start with the full name, if i just enter the lastname or the username I don't find anything

Server configuration

Operating system:CentOS

Web server: NginX

Database: MariaDB

PHP version: 7.1

Nextcloud version: 13.0.4

Updated from an older Nextcloud/ownCloud or fresh install: updated

Where did you install Nextcloud from: nextcloud.com

@nextcloud-bot

This comment was marked as outdated.

@ChristophWurst

This comment was marked as resolved.

@ChristophWurst ChristophWurst added 0. Needs triage Pending check for reproducibility or if it fits our roadmap feature: settings labels Oct 2, 2018
@MorrisJobke
Copy link
Member

Related to #7510

@skjnldsv skjnldsv added 1. to develop Accepted and waiting to be taken care of and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Oct 4, 2018
@skjnldsv
Copy link
Member

skjnldsv commented Oct 4, 2018

We're using the ocs api search:

$users = $this->userManager->search($search, $limit, $offset);

Which is apparently only filtering by id :)
/**
* search by user id
*
* @param string $pattern
* @param int $limit
* @param int $offset
* @return \OC\User\User[]
*/
public function search($pattern, $limit = null, $offset = null) {
$users = array();
foreach ($this->backends as $backend) {
$backendUsers = $backend->getUsers($pattern, $limit, $offset);
if (is_array($backendUsers)) {
foreach ($backendUsers as $uid) {
$users[$uid] = $this->getUserObject($uid, $backend);
}
}
}
uasort($users, function ($a, $b) {
/**
* @var \OC\User\User $a
* @var \OC\User\User $b
*/
return strcasecmp($a->getUID(), $b->getUID());
});
return $users;
}

@paszczus

This comment was marked as abuse.

@devil1970
Copy link

Hi, I'have two servers, one is "Owncloud 10.3.2" the other is "Nextcloud 23.04".

  • Both the machines are connected via LDAP to an AD Windows Domain.
  • Connection string is the same.
  • Cache is the same.
  • Time to live is the same.
  • Also advanced options are the same.

Now: Owncloud server is dying, in fact I'm not upgrading it since I've installed Nexcloud with nicer interface. The problem instead is in the "users searching!!" Particularly LDAP/AD USERS!!!
Ever since (also wth previous version of OwnCloud/Nextcloud/Windows Domain) if I search AD connected users in Owncloud I find every users I'm looking for. I can write two letters in Owncloud and I will find every thing. Instead if I search under Nextcloud most times I can't find what I'm looking for. Very sad is that Nextcloud can tell me one time a user is not present and the second time I seek, the user is present. Also if I use wildcards. Also if I write whole user account name. If I try on both the platforms via SSH with OCC and I write: 'sudo -u www-data php ./occ user:list | grep "string I'm lookin for"', here I can find every thing.
Other problem is "sorting". Under Nextcloud users are loaded gradually and in a strange way (likely they are sorted first by objectguid). The first loaded page is alphabetic sorted by A To Z. After that the system load another page with "other" users newly sorted by A to Z. The right way is receveing A To B on the first page, B To C on the second and so on.
Now also if I search for a displayed user Nextcloud sometime find it and in other time it doesn't find anything.

Someone of you has the same experience?

Greetings and many thanks for reading.
Davide

@devil1970
Copy link

devil1970 commented May 19, 2022

Hi, I'have two servers, one is "Owncloud 10.3.2" the other is "Nextcloud 23.04".

  • Both the machines are connected via LDAP to an AD Windows Domain.
  • Connection string is the same.
  • Cache is the same.
  • Time to live is the same.
  • Also advanced options are the same.

Now: Owncloud server is dying, in fact I'm not upgrading it since I've installed Nexcloud with nicer interface. The problem instead is in the "users searching!!" Particularly LDAP/AD USERS!!! Ever since (also wth previous version of OwnCloud/Nextcloud/Windows Domain) if I search AD connected users in Owncloud I find every users I'm looking for. I can write two letters in Owncloud and I will find every thing. Instead if I search under Nextcloud most times I can't find what I'm looking for. Very sad is that Nextcloud can tell me one time a user is not present and the second time I seek, the user is present. Also if I use wildcards. Also if I write whole user account name. If I try on both the platforms via SSH with OCC and I write: 'sudo -u www-data php ./occ user:list | grep "string I'm lookin for"', here I can find every thing. Other problem is "sorting". Under Nextcloud users are loaded gradually and in a strange way (likely they are sorted first by objectguid). The first loaded page is alphabetic sorted by A To Z. After that the system load another page with "other" users newly sorted by A to Z. The right way is receveing A To B on the first page, B To C on the second and so on. Now also if I search for a displayed user Nextcloud sometime find it and in other time it doesn't find anything.

Someone of you has the same experience?

Greetings and many thanks for reading. Davide

FINALLY SOLVED!!!!

Hi folks, I've finally found the solution to this very (in quote reported) bad problem.
Definitley I can tell you: "The system is not able to sort recursively all the users it gradually finds BUT there is a solution about the search of the LDAP users (users connected via LDAP) and after all these years it doesn't real to me."

Solution:

Under:
Settings -> LDAP/AD Integration -> (on the Right Top of the page) Advanced -> Directory Settings -> User Search Attributes
Write the fields in which you want the search has to be done; in my case I wrote:
samaccountname
mail
givenname
sn

At the end of the page it's better you push on:
Test Configuration

Note:
The solution is useful to administrator searching users in the system and to users sharing folders with other users in the organization

Greetings.
Davide

@szaimen
Copy link
Contributor

szaimen commented Jan 9, 2023

Hi, please update to 24.0.8 or better 25.0.2 and report back if it fixes the issue. Thank you!

@szaimen szaimen added needs info 0. Needs triage Pending check for reproducibility or if it fits our roadmap and removed 1. to develop Accepted and waiting to be taken care of labels Jan 9, 2023
@ghost
Copy link
Author

ghost commented Jan 9, 2023

Hi,
I don't use nextcloud anymore.
You can close this issue or wait for someone else to confirm that it's solved.

@szaimen szaimen closed this as completed Mar 6, 2023
@smarinier
Copy link

smarinier commented May 28, 2024

Hi,

This is still a bug to my opinion. As searching users from Database or users from LDAP doesn't act the same (LDAP works only as "term*" and Database as "term" (And the issue seems to be strongly linked to LDAP users search)

smarinier added a commit to smarinier/server that referenced this issue May 28, 2024
smarinier added a commit to smarinier/server that referenced this issue Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants