Good Morning Dspace-Tech!

We are trying out some ways to automate collection and group creation
steps on a development dspace (1.5.1) server here at WSU and have
recently been able to grab the first group that a user in Active
Directory is a memberOf.  Since Java is not my native tongue, I was
hoping a member of this list has already figured out how to enumerate
and return all groups that a user is a member of or can point me in the
right direction on how to accomplish this request using java (I have
read about (SearchResult)answer.next() and answer.hasMore() but have had
no luck getting all groups to be returned properly).  

Here is an example of prototype code starting at approximately line 330
of the LDAPServlet.java file :
--------------------------------------------------------------------
        if (attlist[4]!=null) // fifth element of attribute list is set
to "memberOf" property
        {
                att = atts.get(attlist[4]);
                if (att != null)
                {
                ldapResult.memberof = (String)att.get(); 
                String[] a = ldapResult.memberof.split(","); // split up
the returned memberOf attribute, we just want cn.
(String).get("cn").get() did not work
                if (a[0]!=null) ldapResult.memberof =
a[0].substring(3,a[0].length()); // trim off just the "cn=" attribute
and remove the "cn=" key
                else ldapResult.memberof = "failed!";
                }
        }
--------------------------------------------------------------------
Thank you in advance for any help or advice you can provide.  We are
very happy to share our experience (and code) with anyone interested in
doing the same type of modification/automation within Dspace.

- jon.scott

--------------------------------------------------------------------
Jon Scott - [EMAIL PROTECTED]
IT Specialist 3
WSU Libraries Systems
Washington State University
Pullman, WA 99164-5610
Ph: 509.335.5713
--------------------------------------------------------------------
www.wsulibs.wsu.edu | www.systems.wsu.edu
--------------------------------------------------------------------


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech

Reply via email to