Marzban icon indicating copy to clipboard operation
Marzban copied to clipboard

Search by note implemented

Open Alirezaja1384 opened this issue 10 months ago • 7 comments

Partially implements #902.

Details:

  • crud.py's get_users(): search param added.
  • get_users view: search param added.
  • CLI's list_users command: search option added.
  • Dashboard: username param replaced by search param.
  • Dashboard built and CLI documentation re-generated.

Side effects:

  • CONTRIBUTING.md improved.

Alirezaja1384 avatar Apr 06 '24 20:04 Alirezaja1384

Do we need to mark username(s) params as deprecated? Since they support multiple usernames (unlike search) I didn't touch them yet. Is a multi-username search functionality necessary?

Alirezaja1384 avatar Apr 06 '24 20:04 Alirezaja1384

Do we need to mark username(s) params as deprecated? Since they support multiple usernames (unlike search) I didn't touch them yet. Is a multi-username search functionality necessary?

multi-username search can be used with api for third party programs and should be available i think its better to have 2 separated search option for user and note, this can help us to have more accurate result

M03ED avatar Apr 06 '24 20:04 M03ED

This options would be great if exist : set multiple input to search for (user1,user2,user3) set the owner(admin) name (search for the input only in users of specific admin) config if must search for the input in users or notes or both (search only in notes seems useless) config if search for exact input or *input*

and as notes can contain any character, is your current PR working correct with utf-8 characters and symbols?

fodhelper avatar Apr 07 '24 11:04 fodhelper

Do we need to mark username(s) params as deprecated? Since they support multiple usernames (unlike search) I didn't touch them yet. Is a multi-username search functionality necessary?

multi-username search can be used with api for third party programs and should be available i think its better to have 2 separated search option for user and note, this can help us to have more accurate result

I don't feel comfortable with the username param's dual function (Search if there's only 1 given username and exact match if there are multiple usernames, It somehow makes its behavior inconsistent). Using an exact match for usernames and admins[^1] (if implemented) and a partial match for search might be better. Of course, it will be a breaking change for clients who use username for search.

[^1]: Admin param should only be available to superusers since normal users can only see their users and it makes no sense to allow them to filter users by their admin users.

Alirezaja1384 avatar Apr 08 '24 19:04 Alirezaja1384

This options would be great if exist : set multiple input to search for (user1,user2,user3) set the owner(admin) name (search for the input only in users of specific admin) config if must search for the input in users or notes or both (search only in notes seems useless) config if search for exact input or input

and as notes can contain any character, is your current PR working correct with utf-8 characters and symbols?

  1. set multiple input to search for (user1,user2,user3): I don't think it's really necessary. username's exact match might be enough for third-party apps.
  2. set the owner(admin) name (search for the input only in users of specific admin): I can handle the API (PS: as I said, it only makes sense for superusers), but I don't want to change the front end too much. Maybe @gozarman can help.
  3. config if must search for the input in users or notes or both (search only in notes seems useless): Is it necessary? Maye username's exact match and search's partial match be more than enough.
  4. config if search for exact input or *input*: Does exact match for search make sense when there's a username param?
  • and as notes can contain any character, is your current PR working correct with utf-8 characters and symbols? It's a DB/ORM thing. There should be no problem (As my tests also confirm this).

Alirezaja1384 avatar Apr 08 '24 19:04 Alirezaja1384

And I think the username and admin params' changes should be a separate PR.

Alirezaja1384 avatar Apr 08 '24 19:04 Alirezaja1384

I checked API codes and your back-end changes You are right, all the options mentioned are already available the only absent feature is to add multiple input to search in notes! which is totally useless so sorry for confusing anyone here with my previous comment

fodhelper avatar Apr 08 '24 22:04 fodhelper