atg.adapter.secure
Class GenericSecuredMutableRepository

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.adapter.secure.GenericSecuredRepository
              extended by atg.adapter.secure.GenericSecuredMutableRepository
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, atg.repository.DisplayableRepository, MutableRepository, Repository, RepositoryViewContainer, SecuredMutableRepository, SecuredRepository, java.util.EventListener
Direct Known Subclasses:
GenericSecuredMutableContentRepository

public class GenericSecuredMutableRepository
extends GenericSecuredRepository
implements SecuredMutableRepository

An implementation of SecureMutableRepository that wraps a normal MutableRepository, using properties of its items to store access control information as formatted strings. This is a very basic system whose primary purpose is flexibility rather than performance, although some effort has been given towards providing acceptable performance.

This implementation is not intended to provide absolute security, but rather to allow an application the ability to provide security features without having to implement its own access checking.


Field Summary
static java.lang.String CLASS_VERSION
           
protected  atg.adapter.secure.WeakItemCache mMutableItemCache
          A cache of secured repository items indexed by the repository item.
 
Fields inherited from class atg.adapter.secure.GenericSecuredRepository
mItemCache, mRepository, mSecurityConfiguration, mTransactionManager
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
GenericSecuredMutableRepository()
           
 
Method Summary
 RepositoryItem addItem(MutableRepositoryItem pItem)
          Adds the supplied item populated to the repository.
 RepositoryItem addItem(RepositoryItem pItem, java.lang.String pDescriptorName)
          Deprecated.  
 MutableRepositoryItem createItem(java.lang.String pDescriptorName)
          Returns a new item using an auto-generated unique id.
 MutableRepositoryItem createItem(java.lang.String pId, java.lang.String pDescriptorName)
          Returns a new item populated with the supplied id.
 MutableRepositoryItem[] filterMutableItems(MutableRepositoryItem[] pItems, AccessRight pRight)
          Filters out any repository items returned from a query that the user should not be able to access in the indicated mode.
 MutableRepositoryItem getItemForUpdate(java.lang.String pId)
          Deprecated.  
 MutableRepositoryItem getItemForUpdate(java.lang.String pId, java.lang.String pDescriptorName)
          If one wants write access to an item it should be retrieved through this method.
 MutableRepositoryItem[] getItemsForUpdate(java.lang.String[] pIds)
          If one wants write access to a set of items they should be retrieved through this method.
 MutableRepositoryItem[] getItemsForUpdate(java.lang.String[] pIds, java.lang.String pDescriptorName)
          If one wants write access to a set of items they should be retrieved through this method.
 void removeItem(java.lang.String pId)
          Deprecated.  
 void removeItem(java.lang.String pId, java.lang.String pDescriptorName)
          Removes an item from the Repository permanently.
 void setRepository(Repository pRepository)
          Makes a copy of the repository reference as a mutable repository.
 void updateItem(MutableRepositoryItem pItem)
          Updates the item's values into the Repository.
 
Methods inherited from class atg.adapter.secure.GenericSecuredRepository
checkAccess, checkAccess, checkAccess, checkForInvalidRepository, doStartService, filterItems, getComponentResourceBundleName, getConfigurationFile, getDefaultViewName, getItem, getItem, getItemDescriptor, getItemDescriptor, getItemDescriptorNames, getItems, getItems, getRepository, getRepositoryDisplayName, getRepositoryDisplayNameResource, getRepositoryName, getSecurityConfiguration, getSecurityPolicy, getTransactionManager, getView, getView, getViewNames, getXMLToolsFactory, hasAccess, setComponentResourceBundleName, setConfigurationFile, setRepositoryDisplayNameResource, setRepositoryName, setSecurityConfiguration, setTransactionManager, setXMLToolsFactory, unwrapArray, unwrapList, unwrapMap, unwrapSet, unwrapValue
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface atg.repository.SecuredRepository
getSecurityConfiguration, getSecurityPolicy
 
Methods inherited from interface atg.repository.Repository
getDefaultViewName, getItem, getItem, getItemDescriptor, getItemDescriptor, getItemDescriptorNames, getItems, getItems, getRepositoryName, getView, getView, getViewNames
 
Methods inherited from interface atg.repository.Repository
getDefaultViewName, getItem, getItem, getItemDescriptor, getItemDescriptor, getItemDescriptorNames, getItems, getItems, getRepositoryName, getView, getView, getViewNames
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION

mMutableItemCache

protected atg.adapter.secure.WeakItemCache mMutableItemCache
A cache of secured repository items indexed by the repository item.

Constructor Detail

GenericSecuredMutableRepository

public GenericSecuredMutableRepository()
Method Detail

filterMutableItems

public MutableRepositoryItem[] filterMutableItems(MutableRepositoryItem[] pItems,
                                                  AccessRight pRight)
Filters out any repository items returned from a query that the user should not be able to access in the indicated mode.


setRepository

public void setRepository(Repository pRepository)
Makes a copy of the repository reference as a mutable repository.

Overrides:
setRepository in class GenericSecuredRepository

getItemForUpdate

public MutableRepositoryItem getItemForUpdate(java.lang.String pId)
                                       throws RepositoryException
Deprecated. 

If one wants write access to an item it should be retrieved through this method. This item must have already been added to the repository using addItem. This version updates an item in the default item descriptor.

Specified by:
getItemForUpdate in interface MutableRepository
Parameters:
pId - the id of the item to update.
Throws:
RepositoryException - if the item could be retreived for updates

getItemForUpdate

public MutableRepositoryItem getItemForUpdate(java.lang.String pId,
                                              java.lang.String pDescriptorName)
                                       throws RepositoryException
If one wants write access to an item it should be retrieved through this method. This item must have already been added to the repository using addItem.

Specified by:
getItemForUpdate in interface MutableRepository
Parameters:
pId - the id of the item to update.
pDescriptorName - the name of the type of item to update.
Throws:
RepositoryException - if the item could be retreived for updates

getItemsForUpdate

public MutableRepositoryItem[] getItemsForUpdate(java.lang.String[] pIds)
                                          throws RepositoryException
If one wants write access to a set of items they should be retrieved through this method.

The caller must have LIST access on each item that is requested or that item's slot will be set to null following this query. Note that the ability to actually update the item will be controlled by the item itself and by the item descriptor when the actual call to updateItem() is attempted.

Specified by:
getItemsForUpdate in interface MutableRepository
Throws:
RepositoryException - if the item could be retreived for updates

getItemsForUpdate

public MutableRepositoryItem[] getItemsForUpdate(java.lang.String[] pIds,
                                                 java.lang.String pDescriptorName)
                                          throws RepositoryException
If one wants write access to a set of items they should be retrieved through this method. This version updates items in the default item descriptor.

The caller must have LIST access on each item that is requested or that item's slot will be set to null following this query. Note that the ability to actually update the item will be controlled by the item itself and by the item descriptor when the actual call to updateItem() is attempted.

Specified by:
getItemsForUpdate in interface MutableRepository
Parameters:
pIds - the list of ids of items to retrieve for update
pDescriptorName - the name of the item descriptor that contains these items.
Throws:
RepositoryException - if the item could be retreived for updates

createItem

public MutableRepositoryItem createItem(java.lang.String pDescriptorName)
                                 throws RepositoryException
Returns a new item using an auto-generated unique id.

The caller must have CREATE access on the item descriptor for this operation to succeed.

Specified by:
createItem in interface MutableRepository
Parameters:
pDescriptorName - the name of the RepositoryItemDescriptor which should be used as the "template" to create the item
Throws:
RepositoryException - if the item could not be created

createItem

public MutableRepositoryItem createItem(java.lang.String pId,
                                        java.lang.String pDescriptorName)
                                 throws RepositoryException
Returns a new item populated with the supplied id.

The new item is not added to the repository; addItem must be called in order to change the repository.

The caller must have CREATE access on the item descriptor for this operation to succeed.

Specified by:
createItem in interface MutableRepository
Parameters:
pId - the id to use in an attempt to create the RepositoryItem
pDescriptorName - the name of the RepositoryItemDescriptor which should be used as the "template" to create the item
Throws:
RepositoryException - if the item could not be created
DuplicateIdException - if the id is already in use

addItem

public RepositoryItem addItem(RepositoryItem pItem,
                              java.lang.String pDescriptorName)
                       throws RepositoryException
Deprecated. 

Adds the supplied item populated to the repository.

The caller must have WRITE access on the item descriptor for this operation to succeed. Note that the attempt to create a new item would already have failed if the caller did not have CREATE access.

Specified by:
addItem in interface MutableRepository
Parameters:
pItem - the item to add
pDescriptorName - the name of the RepositoryItemDescriptor which should be used as the "template" to add the item
Returns:
An instance of RepositoryItem which describes the newly added item
Throws:
RepositoryException - if the item could not be added

addItem

public RepositoryItem addItem(MutableRepositoryItem pItem)
                       throws RepositoryException
Adds the supplied item populated to the repository. Returns a new item (with potentially a different id) that represents a persistent item in the repository.

The caller must have WRITE access on the item descriptor for this operation to succeed. Note that the attempt to create a new item would already have failed if the caller did not have CREATE access.

Specified by:
addItem in interface MutableRepository
Parameters:
pItem - the item to add
Returns:
An instance of RepositoryItem which describes the newly added item
Throws:
RepositoryException - if the item could not be added

updateItem

public void updateItem(MutableRepositoryItem pItem)
                throws RepositoryException
Updates the item's values into the Repository.

As of version 5.5p1, the caller need not have any special permission to call this method. Modification access is expected to be controlled by either the per-item ACL or the default ACL provided by the item descriptor.

Specified by:
updateItem in interface MutableRepository
Parameters:
pItem - the item to update
Throws:
RepositoryException - if the item could not be updated
ConcurrentUpdateException - if the item has been changed in another transaction since this transaction started using this item.

removeItem

public void removeItem(java.lang.String pId)
                throws RepositoryException
Deprecated. 

Removes an item from the Repository permanently. This method is uses the default item descriptor. You should use the other version of removeItem to specify a particular item descriptor.

The caller must have both DELETE access on the item descriptor and DESTROY access on the item for this operation to succeed.

Specified by:
removeItem in interface MutableRepository
Parameters:
pItem - the item to remove
Throws:
RepositoryException - if the item could not be deleted

removeItem

public void removeItem(java.lang.String pId,
                       java.lang.String pDescriptorName)
                throws RepositoryException
Removes an item from the Repository permanently.

The caller must have both DELETE access on the item descriptor and DESTROY access on the item for this operation to succeed.

Specified by:
removeItem in interface MutableRepository
Parameters:
pItem - the item to remove
pDescriptorName - the name of the item descriptor that contains this item.
Throws:
RepositoryException - if the item could not be deleted