mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Merged 5.0.N (5.0.3) to HEAD (5.1)
110822: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3) 110619: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6) 110422: Merged DEV to V4.2.5 (4.2.5) 110332: MNT-14151 : CMIS Upload/Create in 4.2 adds the sys:hidden and cm:indexControl Aspect to documents starting with a period - added system property in order to enable/disable cmis hidden behavior git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@110935 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -28,6 +28,7 @@
|
|||||||
<property name="filter" value="\..*" />
|
<property name="filter" value="\..*" />
|
||||||
<property name="visibility" value="webdav,nfs,ftp" />
|
<property name="visibility" value="webdav,nfs,ftp" />
|
||||||
<property name="hiddenAttribute" value="cifs" />
|
<property name="hiddenAttribute" value="cifs" />
|
||||||
|
<property name="cmisDisableHideConfig" value="${cmis.disable.hidden.leading.period.files}" />
|
||||||
</bean>
|
</bean>
|
||||||
<bean class="org.alfresco.repo.model.filefolder.HiddenFileFilter">
|
<bean class="org.alfresco.repo.model.filefolder.HiddenFileFilter">
|
||||||
<property name="filter" value="Thumbs\.db" />
|
<property name="filter" value="Thumbs\.db" />
|
||||||
|
@@ -1100,4 +1100,6 @@ solr_facets.inheritanceHierarchy=default,custom
|
|||||||
models.enforceTenantInNamespace=false
|
models.enforceTenantInNamespace=false
|
||||||
|
|
||||||
# Allowed protocols for links
|
# Allowed protocols for links
|
||||||
links.protocosl.white.list=http,https,ftp,mailto
|
links.protocosl.white.list=http,https,ftp,mailto
|
||||||
|
|
||||||
|
cmis.disable.hidden.leading.period.files=false
|
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.alfresco.repo.model.filefolder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents configurable hidden file information, based on which some filename
|
||||||
|
* patterns will be hidden or not depending the client
|
||||||
|
*
|
||||||
|
* @author Andreea Dragoi
|
||||||
|
* @since 4.2.5
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface ConfigurableHiddenFileInfo extends HiddenFileInfo
|
||||||
|
{
|
||||||
|
public boolean isCmisDisableHideConfig();
|
||||||
|
public void setCmisDisableHideConfig(boolean cmisDisableHideConfig);
|
||||||
|
|
||||||
|
}
|
@@ -165,7 +165,7 @@ public class HiddenAspect
|
|||||||
{
|
{
|
||||||
for(HiddenFileFilter filter : filters)
|
for(HiddenFileFilter filter : filters)
|
||||||
{
|
{
|
||||||
this.filters.add(new HiddenFileInfoImpl(filter.getFilter(), filter.getVisibility(), filter.getHiddenAttribute(), filter.cascadeHiddenAspect(), filter.cascadeIndexControlAspect()));
|
this.filters.add(new HiddenFileInfoImpl(filter.getFilter(), filter.getVisibility(), filter.getHiddenAttribute(), filter.cascadeHiddenAspect(), filter.cascadeIndexControlAspect(), filter.isCmisDisableHideConfig()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -527,6 +527,13 @@ public class HiddenAspect
|
|||||||
|
|
||||||
OUTER: for(HiddenFileInfo filter : filters)
|
OUTER: for(HiddenFileInfo filter : filters)
|
||||||
{
|
{
|
||||||
|
if (Client.cmis.equals(FileFilterMode.getClient()) && filter instanceof ConfigurableHiddenFileInfo)
|
||||||
|
{
|
||||||
|
if (((ConfigurableHiddenFileInfo) filter).isCmisDisableHideConfig())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
if(filter.cascadeHiddenAspect() || filter.cascadeIndexControlAspect())
|
if(filter.cascadeHiddenAspect() || filter.cascadeIndexControlAspect())
|
||||||
{
|
{
|
||||||
if(path == null)
|
if(path == null)
|
||||||
@@ -943,7 +950,7 @@ public class HiddenAspect
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class HiddenFileInfoImpl implements HiddenFileInfo
|
private class HiddenFileInfoImpl implements ConfigurableHiddenFileInfo
|
||||||
{
|
{
|
||||||
private Pattern filter;
|
private Pattern filter;
|
||||||
private Set<Client> clientVisibility = new HashSet<Client>(10);
|
private Set<Client> clientVisibility = new HashSet<Client>(10);
|
||||||
@@ -951,6 +958,7 @@ public class HiddenAspect
|
|||||||
private int visibilityMask;
|
private int visibilityMask;
|
||||||
private boolean cascadeHiddenAspect;
|
private boolean cascadeHiddenAspect;
|
||||||
private boolean cascadeIndexControlAspect;
|
private boolean cascadeIndexControlAspect;
|
||||||
|
private boolean cmisDisableHideConfig;
|
||||||
|
|
||||||
public HiddenFileInfoImpl(String regexp, String visibility, String hiddenAttribute, boolean cascadeHiddenAspect, boolean cascadeIndexControlAspect)
|
public HiddenFileInfoImpl(String regexp, String visibility, String hiddenAttribute, boolean cascadeHiddenAspect, boolean cascadeIndexControlAspect)
|
||||||
{
|
{
|
||||||
@@ -961,6 +969,12 @@ public class HiddenAspect
|
|||||||
setHiddenAttribute(hiddenAttribute);
|
setHiddenAttribute(hiddenAttribute);
|
||||||
calculateVisibilityMask();
|
calculateVisibilityMask();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HiddenFileInfoImpl(String regexp, String visibility, String hiddenAttribute, boolean cascadeHiddenAspect, boolean cascadeIndexControlAspect, boolean cmisDisableHideConfig)
|
||||||
|
{
|
||||||
|
this(regexp,visibility,hiddenAttribute, cascadeHiddenAspect, cascadeIndexControlAspect);
|
||||||
|
this.cmisDisableHideConfig = cmisDisableHideConfig;
|
||||||
|
}
|
||||||
|
|
||||||
private void setVisibility(String visibility)
|
private void setVisibility(String visibility)
|
||||||
{
|
{
|
||||||
@@ -1036,5 +1050,15 @@ public class HiddenAspect
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCmisDisableHideConfig()
|
||||||
|
{
|
||||||
|
return cmisDisableHideConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmisDisableHideConfig(boolean cmisDisableHideConfig)
|
||||||
|
{
|
||||||
|
this.cmisDisableHideConfig = cmisDisableHideConfig;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,6 +16,7 @@ public class HiddenFileFilter implements InitializingBean
|
|||||||
private String hiddenAttribute;
|
private String hiddenAttribute;
|
||||||
private boolean cascadeHiddenAspect = true;
|
private boolean cascadeHiddenAspect = true;
|
||||||
private boolean cascadeIndexControlAspect = true;
|
private boolean cascadeIndexControlAspect = true;
|
||||||
|
private boolean cmisDisableHideConfig;
|
||||||
|
|
||||||
public HiddenFileFilter()
|
public HiddenFileFilter()
|
||||||
{
|
{
|
||||||
@@ -70,7 +71,16 @@ public class HiddenFileFilter implements InitializingBean
|
|||||||
{
|
{
|
||||||
return cascadeIndexControlAspect;
|
return cascadeIndexControlAspect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCmisDisableHideConfig(boolean cmisDisableHideConfig)
|
||||||
|
{
|
||||||
|
this.cmisDisableHideConfig = cmisDisableHideConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCmisDisableHideConfig()
|
||||||
|
{
|
||||||
|
return cmisDisableHideConfig;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
|
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
|
||||||
|
@@ -23,6 +23,7 @@ import org.alfresco.repo.model.filefolder.FileFolderLoaderTest;
|
|||||||
import org.alfresco.repo.model.filefolder.FileFolderPerformanceTester;
|
import org.alfresco.repo.model.filefolder.FileFolderPerformanceTester;
|
||||||
import org.alfresco.repo.model.filefolder.FileFolderServiceImplTest;
|
import org.alfresco.repo.model.filefolder.FileFolderServiceImplTest;
|
||||||
import org.alfresco.repo.model.filefolder.FileFolderServicePropagationTest;
|
import org.alfresco.repo.model.filefolder.FileFolderServicePropagationTest;
|
||||||
|
import org.alfresco.repo.model.filefolder.HiddenAspectCmisConfigTest;
|
||||||
import org.alfresco.repo.model.filefolder.HiddenAspectTest;
|
import org.alfresco.repo.model.filefolder.HiddenAspectTest;
|
||||||
import org.alfresco.repo.model.ml.tools.ContentFilterLanguagesMapTest;
|
import org.alfresco.repo.model.ml.tools.ContentFilterLanguagesMapTest;
|
||||||
import org.alfresco.repo.model.ml.tools.EditionServiceImplTest;
|
import org.alfresco.repo.model.ml.tools.EditionServiceImplTest;
|
||||||
@@ -47,9 +48,8 @@ import org.junit.runners.Suite.SuiteClasses;
|
|||||||
MultilingualDocumentAspectTest.class,
|
MultilingualDocumentAspectTest.class,
|
||||||
EditionServiceImplTest.class,
|
EditionServiceImplTest.class,
|
||||||
LanguagesTest.class,
|
LanguagesTest.class,
|
||||||
|
HiddenAspectTest.class,
|
||||||
HiddenAspectTest.class,
|
HiddenAspectCmisConfigTest.class,
|
||||||
|
|
||||||
FileFolderLoaderTest.class,
|
FileFolderLoaderTest.class,
|
||||||
FileFolderPerformanceTester.class,
|
FileFolderPerformanceTester.class,
|
||||||
|
|
||||||
|
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.model.filefolder;
|
||||||
|
|
||||||
|
import javax.transaction.NotSupportedException;
|
||||||
|
import javax.transaction.SystemException;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Associated tests methods for HiddenAspectTest with the non-default value for cmisDisableHide
|
||||||
|
*
|
||||||
|
* @author Andreea Dragoi
|
||||||
|
* @since 4.2.5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class HiddenAspectCmisConfigTest extends HiddenAspectTest
|
||||||
|
{
|
||||||
|
private static final String FILENAME_LEADING_DOT_PATTERN = "\\..*";
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setup() throws SystemException, NotSupportedException
|
||||||
|
{
|
||||||
|
super.setup();
|
||||||
|
//change cmisHiddenConfing default value
|
||||||
|
switchCmisHiddenConfig();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() throws Exception
|
||||||
|
{
|
||||||
|
//revert to cmisHiddenConfing default value
|
||||||
|
switchCmisHiddenConfig();
|
||||||
|
super.tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* switch value for cmisDisableHide in order to tests the configuration in both states
|
||||||
|
*/
|
||||||
|
private void switchCmisHiddenConfig()
|
||||||
|
{
|
||||||
|
for (HiddenFileInfo hiddenFileInfo : hiddenAspect.getPatterns())
|
||||||
|
{
|
||||||
|
if (FILENAME_LEADING_DOT_PATTERN.equals(hiddenFileInfo.getFilter()) && hiddenFileInfo instanceof ConfigurableHiddenFileInfo)
|
||||||
|
{
|
||||||
|
ConfigurableHiddenFileInfo configurableHiddenFileInfo = (ConfigurableHiddenFileInfo) hiddenFileInfo;
|
||||||
|
configurableHiddenFileInfo.setCmisDisableHideConfig(!configurableHiddenFileInfo.isCmisDisableHideConfig());
|
||||||
|
cmisDisableHide = !cmisDisableHide;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -13,6 +13,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
import javax.transaction.NotSupportedException;
|
import javax.transaction.NotSupportedException;
|
||||||
import javax.transaction.Status;
|
import javax.transaction.Status;
|
||||||
@@ -71,7 +72,7 @@ public class HiddenAspectTest
|
|||||||
|
|
||||||
private static final ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
|
private static final ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
|
||||||
|
|
||||||
private HiddenAspect hiddenAspect;
|
protected HiddenAspect hiddenAspect;
|
||||||
private TransactionService transactionService;
|
private TransactionService transactionService;
|
||||||
private NodeDAO nodeDAO;
|
private NodeDAO nodeDAO;
|
||||||
private NodeService nodeService;
|
private NodeService nodeService;
|
||||||
@@ -97,6 +98,8 @@ public class HiddenAspectTest
|
|||||||
private final String MAILBOX_NAME_B = ".mailbox_a";
|
private final String MAILBOX_NAME_B = ".mailbox_a";
|
||||||
private String username;
|
private String username;
|
||||||
private AlfrescoImapUser user;
|
private AlfrescoImapUser user;
|
||||||
|
|
||||||
|
protected boolean cmisDisableHide;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() throws SystemException, NotSupportedException
|
public void setup() throws SystemException, NotSupportedException
|
||||||
@@ -117,6 +120,8 @@ public class HiddenAspectTest
|
|||||||
imapEnabled = serviceRegistry.getImapService().getImapServerEnabled();
|
imapEnabled = serviceRegistry.getImapService().getImapServerEnabled();
|
||||||
|
|
||||||
nodeDAO = (NodeDAO)ctx.getBean("nodeDAO");
|
nodeDAO = (NodeDAO)ctx.getBean("nodeDAO");
|
||||||
|
Properties properties = (Properties) ctx.getBean("global-properties");
|
||||||
|
cmisDisableHide = Boolean.getBoolean(properties.getProperty("cmis.disable.hidden.leading.period.files"));
|
||||||
|
|
||||||
// start the transaction
|
// start the transaction
|
||||||
txn = transactionService.getUserTransaction();
|
txn = transactionService.getUserTransaction();
|
||||||
@@ -417,13 +422,13 @@ public class HiddenAspectTest
|
|||||||
FileFilterMode.setClient(saveClient);
|
FileFilterMode.setClient(saveClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
assertTrue(nodeService.hasAspect(child, ContentModel.ASPECT_HIDDEN));
|
assertTrue(nodeService.hasAspect(child, ContentModel.ASPECT_HIDDEN) != cmisDisableHide );
|
||||||
assertTrue(nodeService.hasAspect(child, ContentModel.ASPECT_INDEX_CONTROL));
|
assertTrue(nodeService.hasAspect(child, ContentModel.ASPECT_INDEX_CONTROL ) != cmisDisableHide);
|
||||||
assertTrue(nodeService.hasAspect(child1, ContentModel.ASPECT_HIDDEN));
|
assertTrue(nodeService.hasAspect(child1, ContentModel.ASPECT_HIDDEN) != cmisDisableHide);
|
||||||
assertTrue(nodeService.hasAspect(child1, ContentModel.ASPECT_INDEX_CONTROL));
|
assertTrue(nodeService.hasAspect(child1, ContentModel.ASPECT_INDEX_CONTROL) != cmisDisableHide);
|
||||||
|
|
||||||
List<FileInfo> children = fileFolderService.list(parent);
|
List<FileInfo> children = fileFolderService.list(parent);
|
||||||
assertEquals(0, children.size());
|
assertEquals(cmisDisableHide ? 1: 0, children.size());
|
||||||
|
|
||||||
saveClient = FileFilterMode.setClient(Client.script);
|
saveClient = FileFilterMode.setClient(Client.script);
|
||||||
try
|
try
|
||||||
@@ -434,7 +439,7 @@ public class HiddenAspectTest
|
|||||||
{
|
{
|
||||||
FileFilterMode.setClient(saveClient);
|
FileFilterMode.setClient(saveClient);
|
||||||
}
|
}
|
||||||
assertEquals(0, children.size());
|
assertEquals(cmisDisableHide ? 1: 0, children.size());
|
||||||
|
|
||||||
saveClient = FileFilterMode.setClient(Client.cmis);
|
saveClient = FileFilterMode.setClient(Client.cmis);
|
||||||
try
|
try
|
||||||
@@ -445,7 +450,7 @@ public class HiddenAspectTest
|
|||||||
{
|
{
|
||||||
FileFilterMode.setClient(saveClient);
|
FileFilterMode.setClient(saveClient);
|
||||||
}
|
}
|
||||||
assertEquals(0, children.size());
|
assertEquals(cmisDisableHide ? 1: 0, children.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user