mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix for ALF-20318 Metadata query does not enforce security using SOLR and NOINDEX
- unit test only covers the lucene sub-system in the build git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@56666 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -500,6 +500,11 @@ public class ACLEntryAfterInvocationProvider implements AfterInvocationProvider,
|
||||
|
||||
{
|
||||
ResultSet raw = returnedObject.getWrapped();
|
||||
// Check for nested evaluation FilteringResultSet is only wrapped here
|
||||
if(raw instanceof FilteringResultSet)
|
||||
{
|
||||
return returnedObject;
|
||||
}
|
||||
ResultSet filteredForPermissions = decide(authentication, object, config, raw);
|
||||
PagingLuceneResultSet newPaging = new PagingLuceneResultSet(filteredForPermissions, returnedObject.getResultSetMetaData().getSearchParameters(), nodeService);
|
||||
return newPaging;
|
||||
|
@@ -123,30 +123,30 @@ public class SearchServiceTest extends TestCase
|
||||
rootNodeRef = nodeService.getRootNode(storeRef);
|
||||
|
||||
n1 = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("{test}01"),
|
||||
ContentModel.TYPE_CONTAINER).getChildRef();
|
||||
ContentModel.TYPE_FOLDER).getChildRef();
|
||||
pubPermissionService.setPermission(n1, "andy", "Read", true);
|
||||
n2 = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("{test}02"),
|
||||
ContentModel.TYPE_CONTAINER).getChildRef();
|
||||
ContentModel.TYPE_FOLDER).getChildRef();
|
||||
pubPermissionService.setPermission(n2, "andy", "Read", true);
|
||||
n3 = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("{test}03"),
|
||||
ContentModel.TYPE_CONTAINER).getChildRef();
|
||||
ContentModel.TYPE_FOLDER).getChildRef();
|
||||
pubPermissionService.setPermission(n3, "andy", "Read", true);
|
||||
n4 = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("{test}04"),
|
||||
ContentModel.TYPE_CONTAINER).getChildRef();
|
||||
ContentModel.TYPE_FOLDER).getChildRef();
|
||||
pubPermissionService.setPermission(n4, "andy", "Read", true);
|
||||
n5 = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("{test}05"),
|
||||
ContentModel.TYPE_CONTAINER).getChildRef();
|
||||
ContentModel.TYPE_FOLDER).getChildRef();
|
||||
pubPermissionService.setPermission(n5, "andy", "Read", true);
|
||||
n6 = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("{test}06"),
|
||||
ContentModel.TYPE_CONTAINER).getChildRef();
|
||||
ContentModel.TYPE_FOLDER).getChildRef();
|
||||
n7 = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("{test}07"),
|
||||
ContentModel.TYPE_CONTAINER).getChildRef();
|
||||
ContentModel.TYPE_FOLDER).getChildRef();
|
||||
n8 = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("{test}08"),
|
||||
ContentModel.TYPE_CONTAINER).getChildRef();
|
||||
ContentModel.TYPE_FOLDER).getChildRef();
|
||||
n9 = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("{test}09"),
|
||||
ContentModel.TYPE_CONTAINER).getChildRef();
|
||||
ContentModel.TYPE_FOLDER).getChildRef();
|
||||
n10 = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("{test}10"),
|
||||
ContentModel.TYPE_CONTAINER).getChildRef();
|
||||
ContentModel.TYPE_FOLDER).getChildRef();
|
||||
|
||||
}
|
||||
|
||||
@@ -259,4 +259,19 @@ public class SearchServiceTest extends TestCase
|
||||
assertEquals(results.getResultSetMetaData().getPermissionEvaluationMode(), PermissionEvaluationMode.EAGER);
|
||||
results.close();
|
||||
}
|
||||
|
||||
public void testAndyCMIS()
|
||||
{
|
||||
authenticationComponent.setCurrentUser("andy");
|
||||
SearchParameters sp = new SearchParameters();
|
||||
sp.setLanguage(SearchService.LANGUAGE_CMIS_ALFRESCO);
|
||||
sp.setQuery("select * from cmis:folder");
|
||||
sp.addStore(rootNodeRef.getStoreRef());
|
||||
ResultSet results = pubSearchService.query(sp);
|
||||
assertEquals(results.length(), 5);
|
||||
assertNotNull(results.getResultSetMetaData());
|
||||
assertEquals(results.getResultSetMetaData().getLimitedBy(), LimitBy.UNLIMITED);
|
||||
assertEquals(results.getResultSetMetaData().getPermissionEvaluationMode(), PermissionEvaluationMode.EAGER);
|
||||
results.close();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user