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"> <bean id="RepoServerMgmt" class="org.alfresco.repo.admin.RepoServerMgmt">
<property name="transactionService"><ref bean="transactionService"/></property> <property name="transactionService"><ref bean="transactionService"/></property>
<property name="authenticationService"><ref bean="authenticationService"/></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="maxUsers"><value>${server.maxusers}</value></property>
<property name="singleUserOnly"><value>${server.singleuseronly.name}</value></property> <property name="singleUserOnly"><value>${server.singleuseronly.name}</value></property>
</bean> </bean>

View File

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

View File

@ -65,7 +65,8 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
this.authenticationService = authenticationService; 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; this.linkValidationService = linkValidationService;
} }
@ -344,6 +345,12 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
*/ */
public void setLinkValidationDisabled(boolean disable) public void setLinkValidationDisabled(boolean disable)
{ {
if (linkValidationService == null)
{
log.error("LinkValidationService not registered");
throw new AlfrescoRuntimeException("LinkValidationService not registered");
}
linkValidationService.setLinkValidationDisabled(disable); linkValidationService.setLinkValidationDisabled(disable);
if (disable) if (disable)
{ {
@ -361,6 +368,12 @@ public class RepoServerMgmt implements RepoServerMgmtMBean, ApplicationContextAw
*/ */
public boolean isLinkValidationDisabled() public boolean isLinkValidationDisabled()
{ {
if (linkValidationService == null)
{
log.error("LinkValidationService not registered");
throw new AlfrescoRuntimeException("LinkValidationService not registered");
}
return linkValidationService.isLinkValidationDisabled(); 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.AVMExistsException;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor; import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
import org.alfresco.service.cmr.avm.AVMNotFoundException; import org.alfresco.service.cmr.avm.AVMNotFoundException;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.util.Pair; import org.alfresco.util.Pair;
/** /**
@ -373,27 +374,38 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
public Map<String, AVMNode> getListing(Lookup lPath, boolean includeDeleted) public Map<String, AVMNode> getListing(Lookup lPath, boolean includeDeleted)
{ {
// Get the base listing from the thing we indirect to. // Get the base listing from the thing we indirect to.
Map<String, AVMNode> listing = null; Map<String, AVMNode> listing = new HashMap<String, AVMNode>();
if (fOpacity) if (!fOpacity)
{
listing = new HashMap<String, AVMNode>();
}
else
{ {
Lookup lookup = AVMRepository.GetInstance().lookupDirectory(getUnderlyingVersion(lPath), getUnderlying(lPath)); Lookup lookup = AVMRepository.GetInstance().lookupDirectory(getUnderlyingVersion(lPath), getUnderlying(lPath));
if (lookup != null) if (lookup != null)
{ {
DirectoryNode dir = (DirectoryNode)lookup.getCurrentNode(); DirectoryNode dir = (DirectoryNode)lookup.getCurrentNode();
listing = dir.getListing(lookup, includeDeleted); Map<String, AVMNode> underListing = dir.getListing(lookup, includeDeleted);
} for (Map.Entry<String, AVMNode> entry : underListing.entrySet())
else
{ {
// It's OK for an indirection to dangle. if (entry.getValue().getType() == AVMNodeType.LAYERED_DIRECTORY ||
listing = new HashMap<String, AVMNode>(); 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)) 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) if (!includeDeleted && entry.getChild().getType() == AVMNodeType.DELETED_NODE)
{ {
listing.remove(entry.getKey().getName()); listing.remove(entry.getKey().getName());
@ -416,6 +428,14 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
Map<String, AVMNode> listing = new HashMap<String, AVMNode>(); Map<String, AVMNode> listing = new HashMap<String, AVMNode>();
for (ChildEntry entry : AVMDAOs.Instance().fChildEntryDAO.getByParent(this)) 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) if (includeDeleted || entry.getChild().getType() != AVMNodeType.DELETED_NODE)
{ {
listing.put(entry.getKey().getName(), entry.getChild()); listing.put(entry.getKey().getName(), entry.getChild());
@ -438,6 +458,14 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
for (ChildEntry child : children) for (ChildEntry child : children)
{ {
AVMNode childNode = child.getChild(); 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) if (!includeDeleted && childNode.getType() == AVMNodeType.DELETED_NODE)
{ {
continue; continue;
@ -471,10 +499,18 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
{ {
DirectoryNode dirNode = (DirectoryNode)lookup.getCurrentNode(); DirectoryNode dirNode = (DirectoryNode)lookup.getCurrentNode();
Map<String, AVMNode> listing = dirNode.getListing(lookup, includeDeleted); Map<String, AVMNode> listing = dirNode.getListing(lookup, includeDeleted);
for (String name : listing.keySet()) for (Map.Entry<String, AVMNode> entry : listing.entrySet())
{ {
baseListing.put(name, if (entry.getValue().getType() == AVMNodeType.LAYERED_DIRECTORY ||
listing.get(name).getDescriptor(dir.getPath(), name, 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.getCurrentIndirection(),
lookup.getCurrentIndirectionVersion())); lookup.getCurrentIndirectionVersion()));
} }
@ -483,6 +519,14 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
List<ChildEntry> children = AVMDAOs.Instance().fChildEntryDAO.getByParent(this); List<ChildEntry> children = AVMDAOs.Instance().fChildEntryDAO.getByParent(this);
for (ChildEntry child : children) 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) if (!includeDeleted && child.getChild().getType() == AVMNodeType.DELETED_NODE)
{ {
baseListing.remove(child.getKey().getName()); 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.AVMExistsException;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor; import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
import org.alfresco.service.cmr.avm.AVMNotFoundException; import org.alfresco.service.cmr.avm.AVMNotFoundException;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.util.Pair; import org.alfresco.util.Pair;
/** /**
@ -110,6 +111,14 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
List<ChildEntry> children = AVMDAOs.Instance().fChildEntryDAO.getByParent(this); List<ChildEntry> children = AVMDAOs.Instance().fChildEntryDAO.getByParent(this);
for (ChildEntry child : children) 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) if (!includeDeleted && child.getChild().getType() == AVMNodeType.DELETED_NODE)
{ {
continue; continue;
@ -156,6 +165,14 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
List<ChildEntry> children = AVMDAOs.Instance().fChildEntryDAO.getByParent(this); List<ChildEntry> children = AVMDAOs.Instance().fChildEntryDAO.getByParent(this);
for (ChildEntry child : children) 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) if (!includeDeleted && child.getChild().getType() == AVMNodeType.DELETED_NODE)
{ {
continue; continue;