org.apache.jackrabbit.core.security
Interface AccessManager

All Known Implementing Classes:
DefaultAccessManager, SimpleAccessManager, SimpleAccessManager, SimpleJBossAccessManager

public interface AccessManager

The AccessManager can be queried to determines whether privileges are granted on a specific item.


Field Summary
static int READ
          Deprecated.  
static int REMOVE
          Deprecated.  
static int WRITE
          Deprecated.  
 
Method Summary
 boolean canAccess(String workspaceName)
          Determines whether the subject of the current context is granted access to the given workspace.
 boolean canRead(Path itemPath)
          Determines whether the item at the specified absolute path can be read.
 void checkPermission(ItemId id, int permissions)
          Deprecated.  
 void close()
          Close this access manager.
 void init(AMContext context)
          Initialize this access manager.
 void init(AMContext context, AccessControlProvider acProvider, WorkspaceAccessManager wspAccessMgr)
          Initialize this access manager.
 boolean isGranted(ItemId id, int permissions)
          Deprecated.  
 boolean isGranted(Path absPath, int permissions)
          Determines whether the specified permissions are granted on the item with the specified absPath (i.e. the target item, that may or may not yet exist).
 boolean isGranted(Path parentPath, Name childName, int permissions)
          Determines whether the specified permissions are granted on an item represented by the combination of the given parentPath and childName (i.e. the target item, that may or may not yet exist).
 

Field Detail

READ

static final int READ
Deprecated. 
READ permission constant

See Also:
Constant Field Values

WRITE

static final int WRITE
Deprecated. 
WRITE permission constant

See Also:
Constant Field Values

REMOVE

static final int REMOVE
Deprecated. 
REMOVE permission constant

See Also:
Constant Field Values
Method Detail

init

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

init

void init(AMContext context,
          AccessControlProvider acProvider,
          WorkspaceAccessManager wspAccessMgr)
          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
acProvider -
wspAccessMgr -
Throws:
AccessDeniedException - if the subject is not granted access to the specified workspace.
Exception - if another error occurs

close

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

void checkPermission(ItemId id,
                     int permissions)
                     throws AccessDeniedException,
                            ItemNotFoundException,
                            RepositoryException
Deprecated. 

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

boolean isGranted(ItemId id,
                  int permissions)
                  throws ItemNotFoundException,
                         RepositoryException
Deprecated. 

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

isGranted

boolean isGranted(Path absPath,
                  int permissions)
                  throws RepositoryException
Determines whether the specified permissions are granted on the item with the specified absPath (i.e. the target item, that may or may not yet exist).

Parameters:
absPath - the absolute path to test
permissions - A combination of one or more of the following constants encoded as a bitmask value:
Returns:
true if the specified permissions are granted; otherwise false.
Throws:
RepositoryException - if an error occurs.

isGranted

boolean isGranted(Path parentPath,
                  Name childName,
                  int permissions)
                  throws RepositoryException
Determines whether the specified permissions are granted on an item represented by the combination of the given parentPath and childName (i.e. the target item, that may or may not yet exist).

Parameters:
parentPath - Path to an existing parent node.
childName - Name of the child item that may or may not exist yet.
permissions - A combination of one or more of the following constants encoded as a bitmask value:
Returns:
true if the specified permissions are granted; otherwise false.
Throws:
RepositoryException - if an error occurs.

canRead

boolean canRead(Path itemPath)
                throws RepositoryException
Determines whether the item at the specified absolute path can be read.

Parameters:
itemPath -
Returns:
true if the item can be read; otherwise false.
Throws:
RepositoryException - if an error occurs.

canAccess

boolean canAccess(String workspaceName)
                  throws RepositoryException
Determines whether the subject of the current context is granted access to the given workspace. Note that an implementation is free to test for the existance of a workspace with the specified name. In this case the expected return value is false, if no such workspace exists.

Parameters:
workspaceName - name of workspace
Returns:
true if the subject of the current context is granted access to the given workspace; otherwise false.
Throws:
RepositoryException - if an error occurs.


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