Package org.apache.wiki.auth.authorize
Interface GroupDatabase
-
- All Known Implementing Classes:
JDBCGroupDatabase
,XMLGroupDatabase
public interface GroupDatabase
Defines an interface for loading, persisting and storing wiki groups.- Since:
- 2.4.22
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
delete(Group group)
Looks up and deletes aGroup
from the group database.Group[]
groups()
Returns all wiki groups that are stored in the GroupDatabase as an array of Group objects.void
initialize(Engine engine, java.util.Properties props)
Initializes the group database based on values from a Properties object.void
save(Group group, java.security.Principal modifier)
Saves a Group to the group database.
-
-
-
Method Detail
-
delete
void delete(Group group) throws WikiSecurityException
Looks up and deletes aGroup
from the group database. If the group database does not contain the supplied Group. this method throws aNoSuchPrincipalException
. The method commits the results of the delete to persistent storage.- Parameters:
group
- the group to remove- Throws:
WikiSecurityException
- if the database does not contain the supplied group (thrown asNoSuchPrincipalException
) or if the commit did not succeed
-
initialize
void initialize(Engine engine, java.util.Properties props) throws NoRequiredPropertyException, WikiSecurityException
Initializes the group database based on values from a Properties object.- Parameters:
engine
- the wiki engineprops
- the properties used to initialize the group database- Throws:
WikiSecurityException
- if the database could not be initialized successfullyNoRequiredPropertyException
- if a required property is not present
-
save
void save(Group group, java.security.Principal modifier) throws WikiSecurityException
Saves a Group to the group database. Note that this method must fail, and throw anIllegalArgumentException
, if the proposed group is the same name as one of the built-in Roles: e.g., Admin, Authenticated, etc. The database is responsible for setting create/modify timestamps, upon a successful save, to the Group. The method commits the results of the delete to persistent storage.- Parameters:
group
- the Group to savemodifier
- the user who saved the Group- Throws:
WikiSecurityException
- if the Group could not be saved successfully
-
groups
Group[] groups() throws WikiSecurityException
Returns all wiki groups that are stored in the GroupDatabase as an array of Group objects. If the database does not contain any groups, this method will return a zero-length array. This method causes back-end storage to load the entire set of group; thus, it should be called infrequently (e.g., at initialization time). Note that this method should use the protected constructorGroup(String, String)
rather than the various "parse" methods (GroupManager.parseGroup(String, String, boolean)
) to construct the group. This is so as not to flood GroupManager's event queue with spurious events.- Returns:
- the wiki groups
- Throws:
WikiSecurityException
- if the groups cannot be returned by the back-end
-
-