Class InMemoryUserAndRoleProvider

java.lang.Object
org.opencastproject.userdirectory.InMemoryUserAndRoleProvider
All Implemented Interfaces:
RoleProvider, UserProvider, org.osgi.service.cm.ManagedService

public class InMemoryUserAndRoleProvider extends Object implements UserProvider, RoleProvider, org.osgi.service.cm.ManagedService
An in-memory user directory containing the users and roles used by the system.
  • Field Details

  • Constructor Details

    • InMemoryUserAndRoleProvider

      public InMemoryUserAndRoleProvider()
  • Method Details

    • activate

      protected void activate(org.osgi.service.component.ComponentContext cc)
      Callback to activate the component.
      Parameters:
      cc - the declarative services component context
    • updated

      public void updated(Dictionary<String,?> properties) throws org.osgi.service.cm.ConfigurationException
      Specified by:
      updated in interface org.osgi.service.cm.ManagedService
      Throws:
      org.osgi.service.cm.ConfigurationException
    • getName

      public String getName()
      Description copied from interface: UserProvider
      Gets the provider name
      Specified by:
      getName in interface UserProvider
      Returns:
      the provider name
    • getUsers

      public Iterator<User> getUsers()
      Description copied from interface: UserProvider
      Gets all known users.
      Specified by:
      getUsers in interface UserProvider
      Returns:
      the users
    • loadUser

      public User loadUser(String userName)
      Loads a user by username, or returns null if this user is not known to this provider.
      Specified by:
      loadUser in interface UserProvider
      Parameters:
      userName - the username
      Returns:
      the user
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also:
    • getOrganization

      public String getOrganization()
      Returns the identifier for the organization that is associated with this user provider. If equal to UserProvider.ALL_ORGANIZATIONS, this provider will always be consulted, regardless of the organization.
      Specified by:
      getOrganization in interface RoleProvider
      Specified by:
      getOrganization in interface UserProvider
      Returns:
      the defining organization
      See Also:
    • getRolesForUser

      public List<Role> getRolesForUser(String userName)
      Returns the roles for this user or an empty array if no roles are applicable.
      Specified by:
      getRolesForUser in interface RoleProvider
      Parameters:
      userName - the user id
      Returns:
      the set of roles
      See Also:
    • findUsers

      public Iterator<User> findUsers(String query, int offset, int limit)
      Description copied from interface: UserProvider
      Return the found user's as an iterator.
      Specified by:
      findUsers in interface UserProvider
      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 offset
      limit - the limit. 0 means no limit
      Returns:
      an iterator of user's
    • findRoles

      public Iterator<Role> findRoles(String query, Role.Target target, int offset, int limit)
      Description copied from interface: RoleProvider
      Return the found roles as an iterator.
      Specified by:
      findRoles in interface RoleProvider
      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 offset
      limit - the limit. 0 means no limit
      Returns:
      an iterator of role's
    • countUsers

      public long countUsers()
      Description copied from interface: UserProvider
      Returns the number of users in the provider
      Specified by:
      countUsers in interface UserProvider
      Returns:
      the count of users in the provider
    • invalidate

      public void invalidate(String userName)
      Description copied from interface: UserProvider
      Discards any cached value for given user name.
      Specified by:
      invalidate in interface UserProvider
      Parameters:
      userName - the user name