Package org.mycore.user2
Class MCRRoleManager
java.lang.Object
org.mycore.user2.MCRRoleManager
Manages roles and role assignments using a database table.
- Author:
- Frank Lützenkirchen, Thomas Scheffler (yagee)
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Addsrole
to the classification system.static void
deleteRole
(String roleID) Deletes a role from the system.static MCRRole
getExternalRole
(String name) Factory for external rolesstatic MCRRole
Returns the role with the given role name, or null.static MCRRole[]
Returns a role array for the given role names.static Collection<MCRRole>
getRoles
(Collection<String> names) Returns a role collection for the given role names.Returns a list of all defined rolesstatic Collection<String>
listUserIDs
(MCRRole role) Returns a collection of userIDs linked to the givenrole
.
-
Constructor Details
-
MCRRoleManager
public MCRRoleManager()
-
-
Method Details
-
getRole
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
Factory for external roles- Parameters:
name
- a validMCRCategoryID
- Returns:
- MCRRole instance or null if category does not exist
-
getRoles
Returns a role array for the given role names.- Parameters:
names
- unique role names- Returns:
- array each element either MCRRole instance, or null
-
getRoles
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
Returns a list of all defined roles- Returns:
- a list of all defined roles
-
addRole
Addsrole
to the classification system. If the representingMCRCategory
already exists this method does nothing. It will create any category if necessary. -
deleteRole
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
Returns a collection of userIDs linked to the givenrole
.- Parameters:
role
- role to list user IDs.
-