Class MCRRoleManager

java.lang.Object
org.mycore.user2.MCRRoleManager

public class MCRRoleManager extends Object
Manages roles and role assignments using a database table.
Author:
Frank Lützenkirchen, Thomas Scheffler (yagee)
  • Constructor Details

    • MCRRoleManager

      public MCRRoleManager()
  • Method Details

    • getRole

      public static MCRRole getRole(String name)
      Returns the role with the given role name, or null.
      Parameters:
      name - the unique role name
      Returns:
      the role with the given role name, or null.
    • getExternalRole

      public static MCRRole getExternalRole(String name)
      Factory for external roles
      Parameters:
      name - a valid MCRCategoryID
      Returns:
      MCRRole instance or null if category does not exist
    • getRoles

      public static MCRRole[] getRoles(String... names)
      Returns a role array for the given role names.
      Parameters:
      names - unique role names
      Returns:
      array each element either MCRRole instance, or null
    • getRoles

      public static Collection<MCRRole> getRoles(Collection<String> names)
      Returns a role collection for the given role names. If a role is not known the returning collection contains fewer items.
      Parameters:
      names - unique role names
      Returns:
      collection each element is MCRRole instance.
    • listSystemRoles

      public static List<MCRRole> listSystemRoles()
      Returns a list of all defined roles
      Returns:
      a list of all defined roles
    • addRole

      public static void addRole(MCRRole role)
      Adds role to the classification system. If the representing MCRCategory already exists this method does nothing. It will create any category if necessary.
    • deleteRole

      public static void deleteRole(String roleID)
      Deletes a role from the system. If the role is currently not stored in the classification system this method does nothing. This method will fail if any objects (e.g. users) are linked to it.
    • listUserIDs

      public static Collection<String> listUserIDs(MCRRole role)
      Returns a collection of userIDs linked to the given role.
      Parameters:
      role - role to list user IDs.