Hi Stuart

You kindly helped me customise the special groups code in
/home/dspace/dspace-1.7.0-src-release/dspace-pi/src/main/java/org/dspace/authenticate/LDAPHierarchicalAuthentication.java
to differentiate between staff and student login.

Before I build DSpace 1.7.1 from source can you please confirm that
the patch below should work properly with 1.7.1

Thanks very much

 Clive


   /*
     * New code written by Stuart Lewis and added by Clive Gould on
7th April 2011 (modified 20/10/11)
     */

    public int[] getSpecialGroups(Context context, HttpServletRequest request)
    {
       try
       {
           if (!context.getCurrentUser().getNetid().equals(""))
           {
               Group staffGroup = Group.findByName(context, "all-staff");
               Group studentsGroup = Group.findByName(context, "all-students");

               // Does the username start with a '1', '4', or '7'?
               if ((studentsGroup != null) &&
(context.getCurrentUser().getNetid().startsWith("1") ||
context.getCurrentUser().getNetid().startsWith("4") ||
context.getCurrentUser().getNetid().startsWith("7")))
               {
                   // Add them to the students group
                   return new int[] { studentsGroup.getID() };
               }
               else if (staffGroup != null)
               {
                   // Add them to the staff group
                   return new int[] { staffGroup.getID() };
               }
           }
       }
       catch (Exception npe) {
           // The user is not an LDAP user, so we don't need to worry about them
       }
       return new int[0];
    }

------------------------------------------------------------------------------
Cloud Computing - Latest Buzzword or a Glimpse of the Future?
This paper surveys cloud computing today: What are the benefits? 
Why are businesses embracing it? What are its payoffs and pitfalls?
http://www.accelacomm.com/jaw/sdnl/114/51425149/
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech

Reply via email to