Class SakaiUserProviderInstance
java.lang.Object
org.opencastproject.userdirectory.sakai.SakaiUserProviderInstance
- All Implemented Interfaces:
CachingUserProviderMXBean,RoleProvider,UserProvider
public class SakaiUserProviderInstance
extends Object
implements UserProvider, RoleProvider, CachingUserProviderMXBean
A UserProvider that reads user roles from Sakai.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ObjectA token to store in the miss cachestatic final StringFields inherited from interface org.opencastproject.security.api.UserProvider
ALL_ORGANIZATIONS -
Constructor Summary
ConstructorsConstructorDescriptionSakaiUserProviderInstance(String pid, Organization organization, String url, String userName, String password, String sitePattern, String userPattern, Set<String> instructorRoles, int cacheSize, int cacheExpiration) Constructs an Sakai user provider with the needed settings. -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the number of users in the providerfindRoles(String query, Role.Target target, int offset, int limit) Return the found roles as an iterator.Return the found user's as an iterator.floatGets the ratio of cache hits to total requests.getName()Gets the provider nameReturns the identifier for the organization that is associated with this user provider.getRolesForUser(String userName) Returns the roles for this user or an empty array if no roles are applicable.getUsers()Gets all known users.voidinvalidate(String userName) Discards any cached value for given user name.Loads a user by username, or returns null if this user is not known to this provider.protected UserloadUserFromSakai(String userName) Loads a user from Sakai.protected voidregisterMBean(String pid) Registers an MXBean.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opencastproject.security.api.UserProvider
findUsers
-
Field Details
-
PROVIDER_NAME
- See Also:
-
nullToken
A token to store in the miss cache
-
-
Constructor Details
-
SakaiUserProviderInstance
public SakaiUserProviderInstance(String pid, Organization organization, String url, String userName, String password, String sitePattern, String userPattern, Set<String> instructorRoles, int cacheSize, int cacheExpiration) Constructs an Sakai user provider with the needed settings.- Parameters:
pid- the pid of this serviceorganization- the organizationurl- the url of the Sakai serveruserName- the user to authenticate aspassword- the user credentialscacheSize- the number of users to cachecacheExpiration- the number of minutes to cache users
-
-
Method Details
-
getName
Description copied from interface:UserProviderGets the provider name- Specified by:
getNamein interfaceUserProvider- Returns:
- the provider name
-
registerMBean
Registers an MXBean. -
getOrganization
Returns the identifier for the organization that is associated with this user provider. If equal toUserProvider.ALL_ORGANIZATIONS, this provider will always be consulted, regardless of the organization.- Specified by:
getOrganizationin interfaceRoleProvider- Specified by:
getOrganizationin interfaceUserProvider- Returns:
- the defining organization
- See Also:
-
loadUser
Loads a user by username, or returns null if this user is not known to this provider.- Specified by:
loadUserin interfaceUserProvider- Parameters:
userName- the username- Returns:
- the user
- See Also:
-
loadUserFromSakai
Loads a user from Sakai.- Parameters:
userName- the username- Returns:
- the user
-
getCacheHitRatio
public float getCacheHitRatio()Gets the ratio of cache hits to total requests.- Specified by:
getCacheHitRatioin interfaceCachingUserProviderMXBean- Returns:
- the hit ratio
- See Also:
-
findUsers
Description copied from interface:UserProviderReturn the found user's as an iterator.- Specified by:
findUsersin interfaceUserProvider- Parameters:
query- the query. Use the wildcards "_" to match any single character and "%" to match an arbitrary number of characters (including zero characters).offset- the offsetlimit- the limit. 0 means no limit- Returns:
- an iterator of user's
-
getUsers
Description copied from interface:UserProviderGets all known users.- Specified by:
getUsersin interfaceUserProvider- Returns:
- the users
-
invalidate
Description copied from interface:UserProviderDiscards any cached value for given user name.- Specified by:
invalidatein interfaceUserProvider- Parameters:
userName- the user name
-
countUsers
public long countUsers()Description copied from interface:UserProviderReturns the number of users in the provider- Specified by:
countUsersin interfaceUserProvider- Returns:
- the count of users in the provider
-
getRolesForUser
Description copied from interface:RoleProviderReturns the roles for this user or an empty array if no roles are applicable.- Specified by:
getRolesForUserin interfaceRoleProvider- Parameters:
userName- the user id- Returns:
- the set of roles
-
findRoles
Description copied from interface:RoleProviderReturn the found roles as an iterator.- Specified by:
findRolesin interfaceRoleProvider- Parameters:
query- the query. Use the wildcards "_" to match any single character and "%" to match an arbitrary number of characters (including zero characters).offset- the offsetlimit- the limit. 0 means no limit- Returns:
- an iterator of role's
-