Skip to Content.
Sympa Menu

grouper-users - RE: [grouper-users] RE: Question about sources.xml and searching

Subject: Grouper Users - Open Discussion List

List archive

RE: [grouper-users] RE: Question about sources.xml and searching


Chronological Thread 
  • From: Chris Hyzer <>
  • To: Gagné Sébastien <>, "Bryan E. Wooten" <>, "" <>
  • Subject: RE: [grouper-users] RE: Question about sources.xml and searching
  • Date: Mon, 8 Apr 2013 17:25:49 +0000
  • Accept-language: en-US
  • Authentication-results: sfpop-ironport01.merit.edu; dkim=neutral (message not signed) header.i=none

Good catch… should we change the sources.example.xml?

 

FROM:

       <searchType>search</searchType>

         <param>

            <param-name>filter</param-name>

            <param-value>

                (&amp; (|(uid=%TERM%)(cn=*%TERM%*)(exampleEduRegId=%TERM%))(objectclass=exampleEduPerson))

            </param-value>

        </param>

 

TO:

       <searchType>search</searchType>

         <param>

            <param-name>filter</param-name>

            <param-value>

                (&amp; (|(|(uid=%TERM%)(cn=*%TERM%*))(exampleEduRegId=%TERM%))(objectclass=exampleEduPerson))

            </param-value>

        </param>

 

Thanks,

Chris

 

From: Gagné Sébastien [mailto:]
Sent: Monday, April 08, 2013 1:11 PM
To: Chris Hyzer; Bryan E. Wooten;
Subject: RE: [grouper-users] RE: Question about sources.xml and searching

 

I would like to add that “searchSubject” and “searchSubjectByIdentifier” MUST return a single unique value, while the plain “search” can return multiple values.

 

Here is what I did so we can search for PART of a login/name (note the stars):

 

(&amp; (|(displayName=*%TERM%*) (sAMAccountName=*%TERM%*)) (&amp;(objectclass=user)(!(objectclass=computer))))

 

Could the problem be because you cannot put more than two parts in the OR ? i.e. you might have to do :

(&amp; (|(cn=%TERM%)(|(displayName=%TERM%)(sn=%TERM%))) (objectclass=inetOrgPerson))

 

De : [] De la part de Chris Hyzer
Envoyé : 8 avril 2013 12:41
À : Bryan E. Wooten;
Objet : [grouper-users] RE: Question about sources.xml and searching

 

If the subject API does a search by subject id, then the “searchSubject” will be used.

If the subject API does a search by identifier, then the “searchSubjectByIdentifier” will be used.

If the subject API does a “freeform” search, then “search” will be used, which is what is used from that part of the UI.

 

I wasn’t aware of this, but apparently if you type in this in the UI “last,first” then if you have an LDAP source and that filter setup in the sources.xml it will search by last,first.  The Carnegie Mellon request for multiple search terms separated with a comma will conflict with this (2.2+).  So, if you have the multiple search terms feature enabled in 2.2+ (which is the default) you wont be able to search by last/first anymore…  does anyone have strong feelings about the last,first search?  J

 

Back to your request:    why doesn’t this work?

 

            <param-name>filter</param-name>

            <param-value>

                (&amp; (| (cn=%TERM%)(displayName=%TERM%)(sn=%TERM%))(objectclass=inetOrgPerson))

            </param-value>

        </param>

 

But change it a bit:

 

            <param-name>filter</param-name>

            <param-value>

                (&amp; (| (cn=%TERM%)(displayName=%TERM%)(sn=%TERM%)(email=%TERM%)(netId=%TERM%))(objectclass=inetOrgPerson))

            </param-value>

        </param>

 

Can you see the right filter going to LDAP?  If you cant see it in your LDAP server, you can get it from the Grouper logs if you put this in the log4j.properties:

 

log4j.logger. edu.internet2.middleware.subject.provider.LdapSourceAdapter = DEBUG

 

Thanks,

Chris

 

 

 

From: [] On Behalf Of Bryan E. Wooten
Sent: Monday, April 08, 2013 11:07 AM
To:
Subject: [grouper-users] Question about sources.xml and searching

 

I would like to be able to search for subjects in the UI (say adding a group member)  by subjectID (in our case the U’s netid), last name(sn) or displayname perhaps others like email address)

 

I see in the sources.xml  there are 3 “searchType”: searchSubject, searchSubjectByIdentifier and search. In all cases %TERM% is substituted for the actual search.

 

All the search types have a param named “filter”, while the “search” search type also has a param “firstlastfilter”.

 

Through trial and error the only search that seems to have any effect on the UI is this:

 

<search>

       <searchType>search</searchType>

         <param>

            <param-name>filter</param-name>

            <param-value>

                 (&amp;(cn=%TERM%)(objectclass=person))

            </param-value>

        </param>

       

         <param>

            <param-name>firstlastfilter</param-name>

            <param-value>

                (&amp;(displayName=%TERM%)(objectclass=person)))

            </param-value>

         </param>

       

        <param>

            <param-name>scope</param-name>

            <param-value>SUBTREE_SCOPE</param-value>

        </param>

         <param>

            <param-name>base</param-name>

            <param-value>ou=people,dc=testad,dc=utah,dc=edu</param-value>

        </param>

    </search>

 

However the firstlastfilter  does not seem to work. I can search by other that our netid if I do something like this:

 

  <param>

            <param-name>filter</param-name>

            <param-value>

                (&amp; (| (cn=%TERM%)(displayName=%TERM%)(sn=%TERM%))(objectclass=inetOrgPerson))

            </param-value>

        </param>

 

But this doesn’t seem like the intended solution. Poking around the source code I found LdapSourceAdapter.java and the method getLdapResultsHelper() with is snippet:

 

if ((cp=searchValue.indexOf(',')) >0 ) {

            int lb, rb;

            if ( (lb=searchValue.indexOf('['))>cp && (rb=searchValue.indexOf(']'))>lb ) {

               aff = searchValue.substring(lb+1, rb);

               searchValue = searchValue.substring(0, lb);

               // log.debug("first, last [" + aff + "] search: " + searchValue);

               filter = search.getParam("affiliationfilter");

            } else {

               // log.debug("first, last search: " + searchValue);

               filter = search.getParam("firstlastfilter");

            }

            if (filter==null) filter = search.getParam("filter");  // fall back

            if (filter==null) {

                log.error("Search filter not found for search type:  " + search.getSearchType());

                return null;

            }

            String last = searchValue.substring(0, cp);

            String first = searchValue.substring(cp+1);

            if (last!=null) filter = filter.replaceAll("%LAST%", escapeSearchFilter(last));

            if (first!=null) filter = filter.replaceAll("%FIRST%", escapeSearchFilter(first));

            if (aff!=null) filter = filter.replaceAll("%AFFILIATION%", escapeSearchFilter(aff));

 

Sorry this is so long. Can someone educate me on how to have multiple search filters configured in sources.xml so I can use in the UI?

 

Thanks,

 

Bryan

 

 

 

 

 




Archive powered by MHonArc 2.6.16.

Top of Page