Merged V2.2 to HEAD

7336: JMX-based admin: workaround for LinkValidationService circular reference (to allow unit tests to be run in Eclipse)
   7419: Directory listings are filtered so that child directories without READ_CHILDREN permissions
   7421: Update FOP from 0.92beta to 0.94
         Fixed line endings for .classpath


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8337 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley 2008-02-20 13:14:05 +00:00
parent a0834aed8e
commit dc9ccc985e
5 changed files with 97 additions and 20 deletions

View File

@ -135,7 +135,6 @@
<bean id="RepoServerMgmt" class="org.alfresco.repo.admin.RepoServerMgmt">
<property name="transactionService"><ref bean="transactionService"/></property>
<property name="authenticationService"><ref bean="authenticationService"/></property>
<property name="linkValidationService"><ref bean="linkValidationService"/></property>
<property name="maxUsers"><value>${server.maxusers}</value></property>
<property name="singleUserOnly"><value>${server.singleuseronly.name}</value></property>
</bean>

View File

@ -218,7 +218,8 @@
<bean id="linkValidationService"
class="org.alfresco.linkvalidation.LinkValidationServiceImpl"
lazy-init="true">
lazy-init="true"
init-method="register">
<property name="attributeService">
<ref bean="AttributeService"/>
</property>
@ -255,6 +256,9 @@
<property name="sysAdminCache">
<ref bean="sysAdminCache"/>
</property>
<property name="repoServerMgmt">
<ref bean="RepoServerMgmt"/>
</property>
<!-- Poll interval to check getLatestSnapshotID (in milliseconds). -->
<!-- Note: If pollInterval is 0, link validation is disabled. -->

View File

@ -65,7 +65,8 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
this.authenticationService = authenticationService;
}
public void setLinkValidationService(LinkValidationService linkValidationService)
// TODO - temporary workaround, can be removed when link validation is part of repo
public void registerLinkValidationService(LinkValidationService linkValidationService)
{
this.linkValidationService = linkValidationService;
}
@ -344,6 +345,12 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
*/
public void setLinkValidationDisabled(boolean disable)
{
if (linkValidationService == null)
{
log.error("LinkValidationService not registered");
throw new AlfrescoRuntimeException("LinkValidationService not registered");
}
linkValidationService.setLinkValidationDisabled(disable);
if (disable)
{
@ -361,6 +368,12 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
*/
public boolean isLinkValidationDisabled()
{
if (linkValidationService == null)
{
log.error("LinkValidationService not registered");
throw new AlfrescoRuntimeException("LinkValidationService not registered");
}
return linkValidationService.isLinkValidationDisabled();
}
}

View File

@ -35,6 +35,7 @@ import org.alfresco.service.cmr.avm.AVMException;
import org.alfresco.service.cmr.avm.AVMExistsException;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
import org.alfresco.service.cmr.avm.AVMNotFoundException;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.util.Pair;
/**
@ -373,27 +374,38 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
public Map<String, AVMNode> getListing(Lookup lPath, boolean includeDeleted)
{
// Get the base listing from the thing we indirect to.
Map<String, AVMNode> listing = null;
if (fOpacity)
{
listing = new HashMap<String, AVMNode>();
}
else
Map<String, AVMNode> listing = new HashMap<String, AVMNode>();
if (!fOpacity)
{
Lookup lookup = AVMRepository.GetInstance().lookupDirectory(getUnderlyingVersion(lPath), getUnderlying(lPath));
if (lookup != null)
{
DirectoryNode dir = (DirectoryNode)lookup.getCurrentNode();
listing = dir.getListing(lookup, includeDeleted);
}
else
{
// It's OK for an indirection to dangle.
listing = new HashMap<String, AVMNode>();
Map<String, AVMNode> underListing = dir.getListing(lookup, includeDeleted);
for (Map.Entry<String, AVMNode> entry : underListing.entrySet())
{
if (entry.getValue().getType() == AVMNodeType.LAYERED_DIRECTORY ||
entry.getValue().getType() == AVMNodeType.PLAIN_DIRECTORY)
{
if (!AVMRepository.GetInstance().can(entry.getValue(), PermissionService.READ_CHILDREN))
{
continue;
}
}
listing.put(entry.getKey(), entry.getValue());
}
}
}
for (ChildEntry entry : AVMDAOs.Instance().fChildEntryDAO.getByParent(this))
{
if (entry.getChild().getType() == AVMNodeType.LAYERED_DIRECTORY ||
entry.getChild().getType() == AVMNodeType.PLAIN_DIRECTORY)
{
if (!AVMRepository.GetInstance().can(entry.getChild(), PermissionService.READ_CHILDREN))
{
continue;
}
}
if (!includeDeleted && entry.getChild().getType() == AVMNodeType.DELETED_NODE)
{
listing.remove(entry.getKey().getName());
@ -416,6 +428,14 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
Map<String, AVMNode> listing = new HashMap<String, AVMNode>();
for (ChildEntry entry : AVMDAOs.Instance().fChildEntryDAO.getByParent(this))
{
if (entry.getChild().getType() == AVMNodeType.LAYERED_DIRECTORY ||
entry.getChild().getType() == AVMNodeType.PLAIN_DIRECTORY)
{
if (!AVMRepository.GetInstance().can(entry.getChild(), PermissionService.READ_CHILDREN))
{
continue;
}
}
if (includeDeleted || entry.getChild().getType() != AVMNodeType.DELETED_NODE)
{
listing.put(entry.getKey().getName(), entry.getChild());
@ -438,6 +458,14 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
for (ChildEntry child : children)
{
AVMNode childNode = child.getChild();
if (childNode.getType() == AVMNodeType.LAYERED_DIRECTORY ||
childNode.getType() == AVMNodeType.PLAIN_DIRECTORY)
{
if (!AVMRepository.GetInstance().can(childNode, PermissionService.READ_CHILDREN))
{
continue;
}
}
if (!includeDeleted && childNode.getType() == AVMNodeType.DELETED_NODE)
{
continue;
@ -471,18 +499,34 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
{
DirectoryNode dirNode = (DirectoryNode)lookup.getCurrentNode();
Map<String, AVMNode> listing = dirNode.getListing(lookup, includeDeleted);
for (String name : listing.keySet())
for (Map.Entry<String, AVMNode> entry : listing.entrySet())
{
baseListing.put(name,
listing.get(name).getDescriptor(dir.getPath(), name,
lookup.getCurrentIndirection(),
lookup.getCurrentIndirectionVersion()));
if (entry.getValue().getType() == AVMNodeType.LAYERED_DIRECTORY ||
entry.getValue().getType() == AVMNodeType.PLAIN_DIRECTORY)
{
if (!AVMRepository.GetInstance().can(entry.getValue(), PermissionService.READ_CHILDREN))
{
continue;
}
}
baseListing.put(entry.getKey(),
entry.getValue().getDescriptor(dir.getPath(), entry.getKey(),
lookup.getCurrentIndirection(),
lookup.getCurrentIndirectionVersion()));
}
}
}
List<ChildEntry> children = AVMDAOs.Instance().fChildEntryDAO.getByParent(this);
for (ChildEntry child : children)
{
if (child.getChild().getType() == AVMNodeType.LAYERED_DIRECTORY ||
child.getChild().getType() == AVMNodeType.PLAIN_DIRECTORY)
{
if (!AVMRepository.GetInstance().can(child.getChild(), PermissionService.READ_CHILDREN))
{
continue;
}
}
if (!includeDeleted && child.getChild().getType() == AVMNodeType.DELETED_NODE)
{
baseListing.remove(child.getKey().getName());

View File

@ -34,6 +34,7 @@ import org.alfresco.service.cmr.avm.AVMBadArgumentException;
import org.alfresco.service.cmr.avm.AVMExistsException;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
import org.alfresco.service.cmr.avm.AVMNotFoundException;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.util.Pair;
/**
@ -110,6 +111,14 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
List<ChildEntry> children = AVMDAOs.Instance().fChildEntryDAO.getByParent(this);
for (ChildEntry child : children)
{
if (child.getChild().getType() == AVMNodeType.LAYERED_DIRECTORY ||
child.getChild().getType() == AVMNodeType.PLAIN_DIRECTORY)
{
if (!AVMRepository.GetInstance().can(child.getChild(), PermissionService.READ_CHILDREN))
{
continue;
}
}
if (!includeDeleted && child.getChild().getType() == AVMNodeType.DELETED_NODE)
{
continue;
@ -156,6 +165,14 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
List<ChildEntry> children = AVMDAOs.Instance().fChildEntryDAO.getByParent(this);
for (ChildEntry child : children)
{
if (child.getChild().getType() == AVMNodeType.LAYERED_DIRECTORY ||
child.getChild().getType() == AVMNodeType.PLAIN_DIRECTORY)
{
if (!AVMRepository.GetInstance().can(child.getChild(), PermissionService.READ_CHILDREN))
{
continue;
}
}
if (!includeDeleted && child.getChild().getType() == AVMNodeType.DELETED_NODE)
{
continue;