Class FilterUserDirectoryProvider

  • All Implemented Interfaces:
    AuthenticationIdUDP, DisplayAdvisorUDP, ExternalUserSearchUDP, UserDirectoryProvider, UsersShareEmailUDP

    public class FilterUserDirectoryProvider
    extends Object
    implements UserDirectoryProvider, ExternalUserSearchUDP, UsersShareEmailUDP, AuthenticationIdUDP, DisplayAdvisorUDP

    Filter User Directory Provider, calls a configure provider, and if that fails calls the next provider in the chain. It does this for all methods. If the response is a boolean, then true stop processing, false continues processon. It is the reponsibility of the injected user directory provider to ignore those calls that have nothing to do with it, either by reference to the session, or by refernce to something in the environment or request. To Use, add one or more of these beans to Spring, in a chain, marking the first one in the chain as the 'official' userdirectory provider used by Sakai. Construct the chain by setting the next FilterUserDirectorProvider to the nextProvider and the real User Directory Provider to myProvider eg

       
       <bean
                    id="org.sakaiproject.user.api.UserDirectoryProvider"
                    class="org.sakaiproject.provider.user.FilterUserDirectoryProvider"
                    init-method="init" destroy-method="destroy" singleton="true">
                    <property name="myProvider">
                            <ref bean="org.sakaiproject.user.api.UserDirectoryProvider.provider1" />
                    </property>
                    <property name="nextProvider">
                            <ref bean="org.sakaiproject.user.api.UserDirectoryProvider.chain1" />
                    </property>
            </bean>
            <bean
                    id="org.sakaiproject.user.api.UserDirectoryProvider.chain1"
                    class="org.sakaiproject.provider.user.FilterUserDirectoryProvider"
                    init-method="init" destroy-method="destroy" singleton="true">
                    <property name="myProvider">
                            <ref bean="org.sakaiproject.user.api.UserDirectoryProvider.provider2" />
                    </property>
            </bean>
     
    Version:
    $Revision$
    Author:
    Ian Boston, Andrew Thornton, Daniel Parry, Raad
    • Constructor Detail

      • FilterUserDirectoryProvider

        public FilterUserDirectoryProvider()
        Construct.
    • Method Detail

      • init

        public void init()
        Final initialization, once all dependencies are set.
      • destroy

        public void destroy()
        Returns to uninitialized state. You can use this method to release resources thet your Service allocated when Turbine shuts down.
      • getUser

        public boolean getUser​(UserEdit edit)
        Access a user object. Update the object with the information found.
        Specified by:
        getUser in interface UserDirectoryProvider
        Parameters:
        edit - The user object (id is set) to fill in.
        Returns:
        true if the user object was found and information updated, false if not.
      • getUsers

        public void getUsers​(Collection users)
        Access a collection of UserEdit objects; if the user is found, update the information, otherwise remove the UserEdit object from the collection.
        Specified by:
        getUsers in interface UserDirectoryProvider
        Parameters:
        users - The UserEdit objects (with id set) to fill in or remove.
      • findUserByEmail

        public boolean findUserByEmail​(UserEdit edit,
                                       String email)
        Find a user object who has this email address. Update the object with the information found.
        Specified by:
        findUserByEmail in interface UserDirectoryProvider
        Parameters:
        email - The email address string.
        Returns:
        true if the user object was found and information updated, false if not.
      • findUsersByEmail

        public Collection findUsersByEmail​(String email,
                                           UserFactory factory)
        Find all user objects which have this email address.
        Specified by:
        findUsersByEmail in interface UsersShareEmailUDP
        Parameters:
        email - The email address string.
        factory - Use this factory's newUser() method to create all the UserEdit objects you populate and return in the return collection.
        Returns:
        Collection (UserEdit) of user objects that have this email address, or an empty Collection if there are none.
      • authenticateUser

        public boolean authenticateUser​(String userId,
                                        UserEdit edit,
                                        String password)
        Authenticate a user / password. If the user edit exists it may be modified, and will be stored if...
        Specified by:
        authenticateUser in interface UserDirectoryProvider
        Parameters:
        id - The user id.
        edit - The UserEdit matching the id to be authenticated (and updated) if we have one.
        password - The password.
        Returns:
        true if authenticated, false if not.
      • getMyProvider

        public UserDirectoryProvider getMyProvider()
        The UserDirectoryProvider used by this filter
        Returns:
      • setMyProvider

        public void setMyProvider​(UserDirectoryProvider myProvider)
        The UserDirectoryProvider used by this filter
        Parameters:
        myProvider -
      • getNextProvider

        public UserDirectoryProvider getNextProvider()
        The Next Directory Provider in the chain
        Returns:
      • setNextProvider

        public void setNextProvider​(UserDirectoryProvider nextDirectoryProvider)
        The Next Directory Provider in the chain
        Parameters:
        nextDirectoryProvider -