Class MoodleUserProviderInstance

java.lang.Object
org.opencastproject.userdirectory.moodle.MoodleUserProviderInstance
All Implemented Interfaces:
org.opencastproject.security.api.CachingUserProviderMXBean, org.opencastproject.security.api.RoleProvider, org.opencastproject.security.api.UserProvider

public class MoodleUserProviderInstance extends Object implements org.opencastproject.security.api.UserProvider, org.opencastproject.security.api.RoleProvider, org.opencastproject.security.api.CachingUserProviderMXBean
A UserProvider that reads user roles from Moodle.
  • Constructor Details

    • MoodleUserProviderInstance

      public MoodleUserProviderInstance(String pid, MoodleWebService client, org.opencastproject.security.api.Organization organization, String coursePattern, String userPattern, String groupPattern, boolean groupRoles, int cacheSize, int cacheExpiration, String adminUserName, boolean lowercaseUsername, String contextRolePrefix)
      Constructs an Moodle user provider with the needed settings.
      Parameters:
      pid - The pid of this service.
      client - The Moodle web service client.
      organization - The organization.
      coursePattern - The pattern of a Moodle course ID.
      userPattern - The pattern of a Moodle user ID.
      groupPattern - The pattern of a Moodle group ID.
      groupRoles - Whether to activate groupRoles
      cacheSize - The number of users to cache.
      cacheExpiration - The number of minutes to cache users.
      adminUserName - Name of the global admin user.
      contextRolePrefix - Prefix to prepend to context roles like 1234_Learner
  • Method Details

    • getCacheHitRatio

      public float getCacheHitRatio()
      Specified by:
      getCacheHitRatio in interface org.opencastproject.security.api.CachingUserProviderMXBean
      See Also:
      • CachingUserProviderMXBean.getCacheHitRatio()
    • getName

      public String getName()
      Specified by:
      getName in interface org.opencastproject.security.api.UserProvider
      See Also:
      • UserProvider.getName()
    • getUsers

      public Iterator<org.opencastproject.security.api.User> getUsers()
      Specified by:
      getUsers in interface org.opencastproject.security.api.UserProvider
      See Also:
      • UserProvider.getUsers()
    • loadUser

      public org.opencastproject.security.api.User loadUser(String userName)
      Specified by:
      loadUser in interface org.opencastproject.security.api.UserProvider
      See Also:
      • UserProvider.loadUser(java.lang.String)
    • countUsers

      public long countUsers()
      Specified by:
      countUsers in interface org.opencastproject.security.api.UserProvider
      See Also:
      • UserProvider.countUsers()
    • getOrganization

      public String getOrganization()
      Specified by:
      getOrganization in interface org.opencastproject.security.api.RoleProvider
      Specified by:
      getOrganization in interface org.opencastproject.security.api.UserProvider
      See Also:
      • UserProvider.getOrganization()
    • findUsers

      public Iterator<org.opencastproject.security.api.User> findUsers(String query, int offset, int limit)
      Specified by:
      findUsers in interface org.opencastproject.security.api.UserProvider
      See Also:
      • UserProvider.findUsers(java.lang.String, int, int)
    • invalidate

      public void invalidate(String userName)
      Specified by:
      invalidate in interface org.opencastproject.security.api.UserProvider
      See Also:
      • UserProvider.invalidate(java.lang.String)
    • getRolesForUser

      public List<org.opencastproject.security.api.Role> getRolesForUser(String username)
      Specified by:
      getRolesForUser in interface org.opencastproject.security.api.RoleProvider
      See Also:
      • RoleProvider.getRolesForUser(java.lang.String)
    • findRoles

      public Iterator<org.opencastproject.security.api.Role> findRoles(String query, org.opencastproject.security.api.Role.Target target, int offset, int limit)

      We search for COURSEID, COURSEID_Learner, COURSEID_Instructor

      Specified by:
      findRoles in interface org.opencastproject.security.api.RoleProvider