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

Accounts filter only matches against email address #2224

Closed
Peter-H-Etteplan opened this issue Jan 17, 2022 · 4 comments
Closed

Accounts filter only matches against email address #2224

Peter-H-Etteplan opened this issue Jan 17, 2022 · 4 comments
Assignees

Comments

@Peter-H-Etteplan
Copy link

When you enter text in the Filter field on the Accounts list page, it seems that only the Email field of the users is taken into consideration. Searching for something that only matches a Username or a Full Name yields no results. I guess this could be by design, but in user-accounts.yaml all fields have search: true, which I reckon indicates that they should be evaluated by the search.

I have confirmed this on a clean install of Grav 1.7.21.1, Admin 1.10.27 and can't find any open or closed issues or PRs about this.

Similarly, on the Groups page, the filter matches against Group Name and Description but not against Display Name, despite all three of these fields having search: true in user-groups.yaml.

In a project I'm working on, I have extended user.yaml and added some custom fields, and added some of them to user-accounts.yaml with search: true, but they too were ignored by the filter.

Steps to reproduce:

  1. Create on or more users with different values for Email Address, Username and Full Name
  2. Enter a filter expression that matches a Username or a Full Name (but not an email address) and check the results

Expected behavior: all fields that have search: true are taken into account when searching.

Apologies in advance if I've misunderstood the design of this.

@w00fz
Copy link
Member

w00fz commented Feb 4, 2022

I can confirm this issue, the request seems to be going in properly but it appears to be only filtering by the main key (ie, email).

For example this request is searching for admin but I get nothing back.

Request: http://grav.local/sandbox/admin/accounts/users.json?sort=username%7Casc&page=1&per_page=20&filter=admin

sort: username|asc
page: 1
per_page: 20
filter: admin

@w00fz w00fz added the bug label Feb 4, 2022
@w00fz
Copy link
Member

w00fz commented Feb 4, 2022

This is also flex related, not admin, we can't transfer it though.

@Peter-H-Etteplan
Copy link
Author

Thanks @w00fz and @mahagr for looking into and fixing this. I missed that data->search->fields section. I assume when adding custom fields that I can just make sure to list them there as well. Will try that out.

I guess the Group case I mentioned remains to be addressed in the same way though. If I'm not mistaken, it's a matter of adding readableName to the same section in user-groups.yaml. I can create a PR but maybe that creates more overhead for you than fixing yourselves, for such a small thing?

@mahagr
Copy link
Member

mahagr commented Feb 7, 2022

@Peter-H-Etteplan Yup, fixed that one too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants