Package org.sakaiproject.provider.user
Class SampleUserDirectoryProvider
- java.lang.Object
-
- org.sakaiproject.provider.user.SampleUserDirectoryProvider
-
- All Implemented Interfaces:
DisplayAdvisorUDP,ExternalUserSearchUDP,UserDirectoryProvider,UsersShareEmailUDP
public class SampleUserDirectoryProvider extends Object implements UserDirectoryProvider, UsersShareEmailUDP, DisplayAdvisorUDP, ExternalUserSearchUDP
SampleUserDirectoryProvider is a samaple UserDirectoryProvider.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classSampleUserDirectoryProvider.Info
-
Field Summary
Fields Modifier and Type Field Description static StringEMAIL_DOMAINprotected ValueEncryptionUtilitiesencryptionUtilitiesprotected intm_courseStudentshow many students to recognize (1.. this).protected Hashtable<String,SampleUserDirectoryProvider.Info>m_infoA collection of user ids/names.
-
Constructor Summary
Constructors Constructor Description SampleUserDirectoryProvider()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)booleancreateUserRecord(String id)voiddestroy()Returns to uninitialized state.booleanfindUserByEmail(UserEdit edit, String email)Find a user object who has this email address.Collection<UserEdit>findUsersByEmail(String email, UserFactory factory)Find all user objects which have this email address.StringgetDisplayId(User user)StringgetDisplayName(User user)booleangetUser(UserEdit edit)Access a user object.voidgetUsers(Collection<UserEdit> 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)voidsetCourseStudents(String count)Set how many students to recognize.voidsetValueEncryptionUtilities(ValueEncryptionUtilities encryptionUtilities)protected booleanuserExists(String userId)See if a user by this id exists.
-
-
-
Field Detail
-
EMAIL_DOMAIN
public static final String EMAIL_DOMAIN
- See Also:
- Constant Field Values
-
m_courseStudents
protected int m_courseStudents
how many students to recognize (1.. this).
-
encryptionUtilities
protected ValueEncryptionUtilities encryptionUtilities
-
m_info
protected Hashtable<String,SampleUserDirectoryProvider.Info> m_info
A collection of user ids/names.
-
-
Method Detail
-
setCourseStudents
public void setCourseStudents(String count)
Set how many students to recognize.- Parameters:
count- How many students to recognize.
-
setValueEncryptionUtilities
public void setValueEncryptionUtilities(ValueEncryptionUtilities encryptionUtilities)
-
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.
-
userExists
protected boolean userExists(String userId)
See if a user by this id exists.- Parameters:
userId- The user id string.- Returns:
- true if a user by this id exists, false if not.
-
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<UserEdit> 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.
Note: this method won't be used, because we are a UsersShareEmailUPD.
This is the sort of method to provide if your external source has only a single user for any email address.- 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<UserEdit> 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.
-
searchExternalUsers
public List<UserEdit> searchExternalUsers(String criteria, int first, int last, UserFactory factory)
- Specified by:
searchExternalUsersin interfaceExternalUserSearchUDP
-
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.
-
authenticateWithProviderFirst
public boolean authenticateWithProviderFirst(String id)
- Specified by:
authenticateWithProviderFirstin interfaceUserDirectoryProvider
-
createUserRecord
public boolean createUserRecord(String id)
-
getDisplayId
public String getDisplayId(User user)
- Specified by:
getDisplayIdin interfaceDisplayAdvisorUDP
-
getDisplayName
public String getDisplayName(User user)
- Specified by:
getDisplayNamein interfaceDisplayAdvisorUDP
-
-