org.apache.jackrabbit.core.security
Interface AccessManager

All Known Implementing Classes:
SimpleAccessManager

public interface AccessManager

The AccessManager can be queried to determines whether permission is granted to perform a specific action on a specific item.


Field Summary
static int READ
          READ permission constant
static int REMOVE
          REMOVE permission constant
static int WRITE
          WRITE permission constant
 
Method Summary
 boolean canAccess(String workspaceName)
          Determines whether the subject of the current context is granted access to the given workspace.
 void checkPermission(ItemId id, int permissions)
          Determines whether the specified permissions are granted on the item with the specified id (i.e.
 void close()
          Close this access manager.
 void init(AMContext context)
          Initialize this access manager.
 boolean isGranted(ItemId id, int permissions)
          Determines whether the specified permissions are granted on the item with the specified id (i.e.
 

Field Detail

READ

public static final int READ
READ permission constant

See Also:
Constant Field Values

WRITE

public static final int WRITE
WRITE permission constant

See Also:
Constant Field Values

REMOVE

public static final int REMOVE
REMOVE permission constant

See Also:
Constant Field Values
Method Detail

init

public void init(AMContext context)
          throws AccessDeniedException,
                 Exception
Initialize this access manager. An AccessDeniedException will be thrown if the subject of the given context is not granted access to the specified workspace.

Parameters:
context - access manager context
Throws:
AccessDeniedException - if the subject is not granted access to the specified workspace.
Exception - if another error occurs

close

public void close()
           throws Exception
Close this access manager. After having closed an access manager, further operations on this object are treated as illegal and throw

Throws:
Exception - if an error occurs

checkPermission

public void checkPermission(ItemId id,
                            int permissions)
                     throws AccessDeniedException,
                            ItemNotFoundException,
                            RepositoryException
Determines whether the specified permissions are granted on the item with the specified id (i.e. the target item).

Parameters:
id - the id of the target item
permissions - A combination of one or more of the following constants encoded as a bitmask value:
  • READ
  • WRITE
  • REMOVE
Throws:
AccessDeniedException - if permission is denied
ItemNotFoundException - if the target item does not exist
RepositoryException - it an error occurs

isGranted

public boolean isGranted(ItemId id,
                         int permissions)
                  throws ItemNotFoundException,
                         RepositoryException
Determines whether the specified permissions are granted on the item with the specified id (i.e. the target item).

Parameters:
id - the id of the target item
permissions - A combination of one or more of the following constants encoded as a bitmask value:
  • READ
  • WRITE
  • REMOVE
Returns:
true if permission is granted; otherwise false
Throws:
ItemNotFoundException - if the target item does not exist
RepositoryException - if another error occurs

canAccess

public boolean canAccess(String workspaceName)
                  throws NoSuchWorkspaceException,
                         RepositoryException
Determines whether the subject of the current context is granted access to the given workspace.

Parameters:
workspaceName - name of workspace
Returns:
true if the subject of the current context is granted access to the given workspace; otherwise false.
Throws:
NoSuchWorkspaceException - if a workspace with the given name does not exist.
RepositoryException - if another error occurs


Copyright © 2004-2006 The Apache Software Foundation. All Rights Reserved.