Skip to Content.
Sympa Menu

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

Subject: Grouper Users - Open Discussion List

List archive

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


Chronological Thread 
  • From: "Bryan E. Wooten" <>
  • To: "" <>
  • Subject: [grouper-users] Question about sources.xml and searching
  • Date: Mon, 8 Apr 2013 15:07:22 +0000
  • Accept-language: en-US
  • Authentication-results: sfpop-ironport05.merit.edu; dkim=neutral (message not signed) header.i=none

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