Class FilterUserDirectoryProvider
- java.lang.Object
-
- org.sakaiproject.provider.user.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 Summary
Constructors Constructor Description FilterUserDirectoryProvider()Construct.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanauthenticateUser(String userId, UserEdit edit, String password)Authenticate a user / password.booleanauthenticateWithProviderFirst(String id)voiddestroy()Returns to uninitialized state.booleanfindUserByEmail(UserEdit edit, String email)Find a user object who has this email address.CollectionfindUsersByEmail(String email, UserFactory factory)Find all user objects which have this email address.StringgetDisplayId(User user)StringgetDisplayName(User user)UserDirectoryProvidergetMyProvider()The UserDirectoryProvider used by this filterUserDirectoryProvidergetNextProvider()The Next Directory Provider in the chainbooleangetUser(UserEdit edit)Access a user object.booleangetUserbyAid(String aid, UserEdit user)voidgetUsers(Collection users)Access a collection of UserEdit objects; if the user is found, update the information, otherwise remove the UserEdit object from the collection.voidinit()Final initialization, once all dependencies are set.List<UserEdit>searchExternalUsers(String criteria, int first, int last, UserFactory factory)voidsetMyProvider(UserDirectoryProvider myProvider)The UserDirectoryProvider used by this filtervoidsetNextProvider(UserDirectoryProvider nextDirectoryProvider)The Next Directory Provider in the chain
-
-
-
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:
getUserin interfaceUserDirectoryProvider- 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:
getUsersin interfaceUserDirectoryProvider- 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:
findUserByEmailin interfaceUserDirectoryProvider- 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:
findUsersByEmailin interfaceUsersShareEmailUDP- 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:
authenticateUserin interfaceUserDirectoryProvider- 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-
-
authenticateWithProviderFirst
public boolean authenticateWithProviderFirst(String id)
- Specified by:
authenticateWithProviderFirstin interfaceUserDirectoryProvider
-
searchExternalUsers
public List<UserEdit> searchExternalUsers(String criteria, int first, int last, UserFactory factory)
- Specified by:
searchExternalUsersin interfaceExternalUserSearchUDP
-
getUserbyAid
public boolean getUserbyAid(String aid, UserEdit user)
- Specified by:
getUserbyAidin interfaceAuthenticationIdUDP
-
getDisplayId
public String getDisplayId(User user)
- Specified by:
getDisplayIdin interfaceDisplayAdvisorUDP
-
getDisplayName
public String getDisplayName(User user)
- Specified by:
getDisplayNamein interfaceDisplayAdvisorUDP
-
-