philbertphotos / osticket-multildap-auth-plugin

Plugin for OS Ticket that allows for authentication with multiple domains.
GNU General Public License v3.0
28 stars 16 forks source link

Only a single result returned when searching for users #6

Closed perryk closed 5 years ago

perryk commented 7 years ago

Hi,

I'm trying out this plugin in a test install of OsTicket v1.10 with php v5.6.31 and mariadb v5.5.21.

Settings seem ok however when I try to find a user (who would be in ldap but not in osticket yet) to make them a ticket I can only bring up a single search result when I enter either their first name, surname, or username.

I know there should be more than 1 result as if I enter a more specific value or use the surname to vary the search I can find the other results, however still I can only see a single result in the dropdown.

Just to be a little more precise, I am entering a search term in the box which says "Search existing users or add a new user." which gives a hint of "Search by email, phone or name".

Entering a phone number does not return any results btw, again for a user who would be in ldap but not yet in osticket.

I appreciate there will be some limit to the number of results returned however a screenshot indicates it should be possible for at least a couple of results to be shown.

I have the latest revision of your code and the plugin setting for "Search Filter" now populates with a default of:

(&(objectCategory=person)(objectClass=user)(|(sAMAccountName={q}*)(firstName={q}*)(lastName={q}*)(displayName={q}*)))

Otherwise, this is looking like a very useful plugin and I'm keen to evaluate the sync function shortly too.

Cheers.

philbertphotos commented 7 years ago

If you have firebug (press F12) and go to console when you do a search check the results and let me know if it get multiple users. The search filter is tricky and this combination work great for me. screenshot_38

philbertphotos commented 7 years ago

To search by mobile you will need to add (telephone={q}*) I think that is the LDAP attrib for it.

perryk commented 7 years ago

Thanks for the quick response.

I've dusted off my old "apache directory studio" application and taken a closer look.

My LDAP server is an active directory host and some of the attributes are different. ie. givenName, sn, telephoneNumber, and mail.

So I've changed the "Search Filter" setting to:

(&(objectCategory=person)(objectClass=user)(|(givenName={q}*)(sn={q}*)(sAMAccountName={q}*)(mail={q}*)(telephoneNumber={q}*)(displayName={q}*)))

This didn't change anything so I next tried with no setting for "Search Filter", ie. just completely empty, and this strangely still worked with exactly the same behaviour.

Next, I took your advice and fired up developer tools and I've worked out that /scp/ajax.php/users?q=perry isn't returning my attributes in the response. Rather it is instead returning the following items each with a value: /bin/true, email, id, info, and name . The developer tools show only a single returned result in the response section.

So I'm not quite sure where to check next. Perhaps I have missed something relating to the function of the "Search Filter" setting or during the initial install. It seems to be doing whatever is the default in OsTicket and it understands what are "remote" users and is able to find results. It just is returning only 1 result at a time for me now whereas the other "auth-ldap" plugin was ok and returning I think up to 8 results.

I've tried again also with a clean install of osTicket v1.10 with only this pull request applied which seems to be required to get any result returned at all.

https://github.com/osTicket/osTicket/pull/3456

Should I have the auth-ldap plugin installed also perhaps ?

Cheers.

EBS-DarkD commented 7 years ago

Perryk, I've found recently that this works a lot better with the auth-ldap plugin installed and enabled. Not sure if it's supposed to need it but it seems to like it??

philbertphotos commented 7 years ago

they will conflict with each other... I am making a verbose version ... now that more people are using the plugin I need information when things dont work correctly,.

perryk commented 7 years ago

All good, I'm happy to try again whenever you are ready.

Cheers.

shanept commented 6 years ago

From looking at the codebase, it looks like osTicket used to use the user lookup function - which returned multiple results. Now, it uses the 'search' function which only returns one result, as is expected by osTicket.

Bizarre...

philbertphotos commented 5 years ago

Fixed this issue.

perryk commented 5 years ago

Thanks @philbertphotos