mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Fixs for AR 1411, 1510, 1517
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5982 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -138,7 +138,7 @@ patch.contentFormFolderType.description=Update WCM Content Form folder type.
|
|||||||
patch.contentFormFolderType.result=Updated {0} WCM Content Form objects to 'wcm:formfolder' type.
|
patch.contentFormFolderType.result=Updated {0} WCM Content Form objects to 'wcm:formfolder' type.
|
||||||
|
|
||||||
patch.groupNamesAsIdentifiers.description=Reindex usr:authorityContainer gids as identifiers
|
patch.groupNamesAsIdentifiers.description=Reindex usr:authorityContainer gids as identifiers
|
||||||
patch.groupNamesAsIdentifiers.result=Reindex usr:authorityContainer gids as identifiers
|
patch.groupNamesAsIdentifiers.result=Reindexed usr:authorityContainer with identifiers
|
||||||
|
|
||||||
patch.invalidUserPersonAndGroup.description=Fix up invalid uids for people and users; and invalid gids for groups
|
patch.invalidUserPersonAndGroup.description=Fix up invalid uids for people and users; and invalid gids for groups
|
||||||
patch.invalidUserPersonAndGroup.result=Fixed ''{0}'' invalid user nodes, ''{1}'' invalid person nodes and ''{2}'' invalid authority nodes.
|
patch.invalidUserPersonAndGroup.result=Fixed ''{0}'' invalid user nodes, ''{1}'' invalid person nodes and ''{2}'' invalid authority nodes.
|
||||||
@@ -151,3 +151,7 @@ patch.webscriptsExtension.description=Adds Web Scripts Extension to Data Diction
|
|||||||
|
|
||||||
patch.AVMLayeredSnapshot.description=Set indirectionVersion on Layered Nodes.
|
patch.AVMLayeredSnapshot.description=Set indirectionVersion on Layered Nodes.
|
||||||
patch.AVMLayeredSnapshot.result=Layered Node indirectionVersions set.
|
patch.AVMLayeredSnapshot.result=Layered Node indirectionVersions set.
|
||||||
|
|
||||||
|
patch.groupMembersAsIdentifiers.description=Reindex usr:authorityContainer members as identifiers=======
|
||||||
|
|
||||||
|
|
||||||
|
@@ -783,4 +783,21 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="patch.groupMembersAsIdentifiers" class="org.alfresco.repo.admin.patch.impl.GroupTokenisationPatch" parent="basePatch" >
|
||||||
|
<property name="id"><value>patch.groupMembersAsIdentifiers</value></property>
|
||||||
|
<property name="description"><value>patch.groupMembersAsIdentifiers.description</value></property>
|
||||||
|
<property name="fixesFromSchema"><value>0</value></property>
|
||||||
|
<property name="fixesToSchema"><value>56</value></property>
|
||||||
|
<property name="targetSchema"><value>57</value></property>
|
||||||
|
<!-- bootstrap view -->
|
||||||
|
<property name="userImporterBootstrap">
|
||||||
|
<ref bean="userBootstrap" />
|
||||||
|
</property>
|
||||||
|
<property name="indexerAndSearcher">
|
||||||
|
<ref bean="indexerAndSearcherFactory" />
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
@@ -19,4 +19,4 @@ version.build=@build-number@
|
|||||||
|
|
||||||
# Schema number
|
# Schema number
|
||||||
|
|
||||||
version.schema=56
|
version.schema=57
|
||||||
|
@@ -446,10 +446,6 @@ public class ADMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<NodeRef> imp
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static class Counter
|
static class Counter
|
||||||
{
|
{
|
||||||
int countInParent = 0;
|
int countInParent = 0;
|
||||||
@@ -486,6 +482,7 @@ public class ADMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<NodeRef> imp
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper class to hold two related objects
|
* Helper class to hold two related objects
|
||||||
|
*
|
||||||
* @param first
|
* @param first
|
||||||
* @param second
|
* @param second
|
||||||
*/
|
*/
|
||||||
@@ -497,6 +494,7 @@ public class ADMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<NodeRef> imp
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the first
|
* Get the first
|
||||||
|
*
|
||||||
* @return - first
|
* @return - first
|
||||||
*/
|
*/
|
||||||
public F getFirst()
|
public F getFirst()
|
||||||
@@ -506,6 +504,7 @@ public class ADMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<NodeRef> imp
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the second
|
* Get the second
|
||||||
|
*
|
||||||
* @return -second
|
* @return -second
|
||||||
*/
|
*/
|
||||||
public S getSecond()
|
public S getSecond()
|
||||||
@@ -519,7 +518,6 @@ public class ADMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<NodeRef> imp
|
|||||||
{
|
{
|
||||||
NodeRef nodeRef = new NodeRef(stringNodeRef);
|
NodeRef nodeRef = new NodeRef(stringNodeRef);
|
||||||
|
|
||||||
|
|
||||||
Map<ChildAssociationRef, Counter> nodeCounts = getNodeCounts(nodeRef);
|
Map<ChildAssociationRef, Counter> nodeCounts = getNodeCounts(nodeRef);
|
||||||
List<Document> docs = new ArrayList<Document>();
|
List<Document> docs = new ArrayList<Document>();
|
||||||
ChildAssociationRef qNameRef = null;
|
ChildAssociationRef qNameRef = null;
|
||||||
@@ -715,7 +713,8 @@ public class ADMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<NodeRef> imp
|
|||||||
* true to ignore all properties that must be indexed non-atomically
|
* true to ignore all properties that must be indexed non-atomically
|
||||||
* @return Returns true if the property was indexed atomically, or false if it should be done asynchronously
|
* @return Returns true if the property was indexed atomically, or false if it should be done asynchronously
|
||||||
*/
|
*/
|
||||||
protected boolean indexProperty(NodeRef nodeRef, QName propertyName, Serializable value, Document doc, boolean indexAtomicPropertiesOnly)
|
protected boolean indexProperty(NodeRef nodeRef, QName propertyName, Serializable value, Document doc,
|
||||||
|
boolean indexAtomicPropertiesOnly)
|
||||||
{
|
{
|
||||||
String attributeName = "@"
|
String attributeName = "@"
|
||||||
+ QName.createQName(propertyName.getNamespaceURI(), ISO9075.encode(propertyName.getLocalName()));
|
+ QName.createQName(propertyName.getNamespaceURI(), ISO9075.encode(propertyName.getLocalName()));
|
||||||
@@ -962,7 +961,10 @@ public class ADMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<NodeRef> imp
|
|||||||
else if (isText)
|
else if (isText)
|
||||||
{
|
{
|
||||||
// Temporary special case for uids and gids
|
// Temporary special case for uids and gids
|
||||||
if(propertyName.equals(ContentModel.PROP_USER_USERNAME) || propertyName.equals(ContentModel.PROP_USERNAME) || propertyName.equals(ContentModel.PROP_AUTHORITY_NAME))
|
if (propertyName.equals(ContentModel.PROP_USER_USERNAME)
|
||||||
|
|| propertyName.equals(ContentModel.PROP_USERNAME)
|
||||||
|
|| propertyName.equals(ContentModel.PROP_AUTHORITY_NAME)
|
||||||
|
|| propertyName.equals(ContentModel.PROP_MEMBERS))
|
||||||
{
|
{
|
||||||
doc.add(new Field(attributeName, strValue, fieldStore, fieldIndex, Field.TermVector.NO));
|
doc.add(new Field(attributeName, strValue, fieldStore, fieldIndex, Field.TermVector.NO));
|
||||||
}
|
}
|
||||||
@@ -1235,7 +1237,7 @@ public class ADMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<NodeRef> imp
|
|||||||
"Failed to execute query to find content which needs updating in the index", e);
|
"Failed to execute query to find content which needs updating in the index", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < hits.length(); i++)
|
for (int i = 0; i < hits.length(); i++)
|
||||||
{
|
{
|
||||||
Document doc = hits.doc(i);
|
Document doc = hits.doc(i);
|
||||||
Helper helper = new Helper(doc.getField("ID").stringValue(), doc.getField("TX").stringValue());
|
Helper helper = new Helper(doc.getField("ID").stringValue(), doc.getField("TX").stringValue());
|
||||||
@@ -1275,7 +1277,7 @@ public class ADMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<NodeRef> imp
|
|||||||
{
|
{
|
||||||
// Document document = helper.document;
|
// Document document = helper.document;
|
||||||
NodeRef ref = new NodeRef(helper.ref);
|
NodeRef ref = new NodeRef(helper.ref);
|
||||||
// bypass nodes that have disappeared
|
// bypass nodes that have disappeared
|
||||||
if (!nodeService.exists(ref))
|
if (!nodeService.exists(ref))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@@ -938,7 +938,8 @@ public class AVMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<String> impl
|
|||||||
// Temporary special case for uids and gids
|
// Temporary special case for uids and gids
|
||||||
if (propertyName.equals(ContentModel.PROP_USER_USERNAME)
|
if (propertyName.equals(ContentModel.PROP_USER_USERNAME)
|
||||||
|| propertyName.equals(ContentModel.PROP_USERNAME)
|
|| propertyName.equals(ContentModel.PROP_USERNAME)
|
||||||
|| propertyName.equals(ContentModel.PROP_AUTHORITY_NAME))
|
|| propertyName.equals(ContentModel.PROP_AUTHORITY_NAME)
|
||||||
|
|| propertyName.equals(ContentModel.PROP_MEMBERS))
|
||||||
{
|
{
|
||||||
doc.add(new Field(attributeName, strValue, fieldStore, fieldIndex, Field.TermVector.NO));
|
doc.add(new Field(attributeName, strValue, fieldStore, fieldIndex, Field.TermVector.NO));
|
||||||
}
|
}
|
||||||
|
@@ -167,7 +167,8 @@ public class LuceneAnalyser extends Analyzer
|
|||||||
|
|
||||||
if (propertyQName.equals(ContentModel.PROP_USER_USERNAME)
|
if (propertyQName.equals(ContentModel.PROP_USER_USERNAME)
|
||||||
|| propertyQName.equals(ContentModel.PROP_USERNAME)
|
|| propertyQName.equals(ContentModel.PROP_USERNAME)
|
||||||
|| propertyQName.equals(ContentModel.PROP_AUTHORITY_NAME))
|
|| propertyQName.equals(ContentModel.PROP_AUTHORITY_NAME)
|
||||||
|
|| propertyQName.equals(ContentModel.PROP_MEMBERS))
|
||||||
{
|
{
|
||||||
analyser = new VerbatimAnalyser(true);
|
analyser = new VerbatimAnalyser(true);
|
||||||
}
|
}
|
||||||
|
@@ -80,11 +80,6 @@
|
|||||||
<property name="usr:members">
|
<property name="usr:members">
|
||||||
<type>d:text</type>
|
<type>d:text</type>
|
||||||
<multiple>true</multiple>
|
<multiple>true</multiple>
|
||||||
<index enabled="true">
|
|
||||||
<atomic>true</atomic>
|
|
||||||
<stored>false</stored>
|
|
||||||
<tokenised>false</tokenised>
|
|
||||||
</index>
|
|
||||||
</property>
|
</property>
|
||||||
</properties>
|
</properties>
|
||||||
<associations>
|
<associations>
|
||||||
|
@@ -139,7 +139,8 @@ public class AuthorityDAOImpl implements AuthorityDAO
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new AlfrescoRuntimeException("Authorities of the type "+AuthorityType.getAuthorityType(childName)+" may not be added to other authorities");
|
throw new AlfrescoRuntimeException("Authorities of the type "
|
||||||
|
+ AuthorityType.getAuthorityType(childName) + " may not be added to other authorities");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -250,11 +251,11 @@ public class AuthorityDAOImpl implements AuthorityDAO
|
|||||||
|
|
||||||
public Set<String> getContainingAuthorities(AuthorityType type, String name, boolean immediate)
|
public Set<String> getContainingAuthorities(AuthorityType type, String name, boolean immediate)
|
||||||
{
|
{
|
||||||
if (AuthorityType.getAuthorityType(name).equals(AuthorityType.USER) && ! immediate && (type == null))
|
if (AuthorityType.getAuthorityType(name).equals(AuthorityType.USER) && !immediate && (type == null))
|
||||||
{
|
{
|
||||||
// Cache user to authority look ups
|
// Cache user to authority look ups
|
||||||
HashSet<String> authorities = userToAuthorityCache.get(name);
|
HashSet<String> authorities = userToAuthorityCache.get(name);
|
||||||
if(authorities == null)
|
if (authorities == null)
|
||||||
{
|
{
|
||||||
authorities = new HashSet<String>();
|
authorities = new HashSet<String>();
|
||||||
findAuthorities(type, name, authorities, true, !immediate);
|
findAuthorities(type, name, authorities, true, !immediate);
|
||||||
@@ -278,13 +279,36 @@ public class AuthorityDAOImpl implements AuthorityDAO
|
|||||||
// Nothing to do
|
// Nothing to do
|
||||||
}
|
}
|
||||||
else if (AuthorityType.getAuthorityType(name).equals(AuthorityType.USER))
|
else if (AuthorityType.getAuthorityType(name).equals(AuthorityType.USER))
|
||||||
|
{
|
||||||
|
if (parents)
|
||||||
{
|
{
|
||||||
for (NodeRef ref : getUserContainers(name))
|
for (NodeRef ref : getUserContainers(name))
|
||||||
|
{
|
||||||
|
if (recursive)
|
||||||
{
|
{
|
||||||
findAuthorities(type, ref, authorities, parents, recursive, true);
|
findAuthorities(type, ref, authorities, parents, recursive, true);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
String authorityName = DefaultTypeConverter.INSTANCE.convert(String.class, nodeService
|
||||||
|
.getProperty(ref, ContentModel.PROP_AUTHORITY_NAME));
|
||||||
|
if (type == null)
|
||||||
|
{
|
||||||
|
authorities.add(authorityName);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AuthorityType authorityType = AuthorityType.getAuthorityType(authorityName);
|
||||||
|
if (authorityType.equals(type))
|
||||||
|
{
|
||||||
|
authorities.add(authorityName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NodeRef ref = getAuthorityOrNull(name);
|
NodeRef ref = getAuthorityOrNull(name);
|
||||||
@@ -511,11 +535,11 @@ public class AuthorityDAOImpl implements AuthorityDAO
|
|||||||
QName type = nodeService.getType(authorityRef);
|
QName type = nodeService.getType(authorityRef);
|
||||||
if (type.equals(ContentModel.TYPE_AUTHORITY_CONTAINER))
|
if (type.equals(ContentModel.TYPE_AUTHORITY_CONTAINER))
|
||||||
{
|
{
|
||||||
name = (String)nodeService.getProperty(authorityRef, ContentModel.PROP_AUTHORITY_NAME);
|
name = (String) nodeService.getProperty(authorityRef, ContentModel.PROP_AUTHORITY_NAME);
|
||||||
}
|
}
|
||||||
else if (type.equals(ContentModel.TYPE_AUTHORITY))
|
else if (type.equals(ContentModel.TYPE_AUTHORITY))
|
||||||
{
|
{
|
||||||
name = (String)nodeService.getProperty(authorityRef, ContentModel.PROP_USER_USERNAME);
|
name = (String) nodeService.getProperty(authorityRef, ContentModel.PROP_USER_USERNAME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
|
@@ -24,18 +24,25 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.repo.security.authority;
|
package org.alfresco.repo.security.authority;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.transaction.UserTransaction;
|
import javax.transaction.UserTransaction;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||||
import org.alfresco.repo.security.authentication.MutableAuthenticationDao;
|
import org.alfresco.repo.security.authentication.MutableAuthenticationDao;
|
||||||
import org.alfresco.service.ServiceRegistry;
|
import org.alfresco.service.ServiceRegistry;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||||
import org.alfresco.service.cmr.security.AuthorityService;
|
import org.alfresco.service.cmr.security.AuthorityService;
|
||||||
import org.alfresco.service.cmr.security.AuthorityType;
|
import org.alfresco.service.cmr.security.AuthorityType;
|
||||||
import org.alfresco.service.cmr.security.PermissionService;
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
import org.alfresco.service.cmr.security.PersonService;
|
import org.alfresco.service.cmr.security.PersonService;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.service.transaction.TransactionService;
|
import org.alfresco.service.transaction.TransactionService;
|
||||||
import org.alfresco.util.ApplicationContextHelper;
|
import org.alfresco.util.ApplicationContextHelper;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
@@ -523,4 +530,248 @@ public class AuthorityServiceTest extends TestCase
|
|||||||
assertTrue(pubAuthorityService.getContainedAuthorities(null, auth1, false).contains("andy"));
|
assertTrue(pubAuthorityService.getContainedAuthorities(null, auth1, false).contains("andy"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void test_AR_1510()
|
||||||
|
{
|
||||||
|
personService.getPerson("andy1");
|
||||||
|
personService.getPerson("andy2");
|
||||||
|
personService.getPerson("andy3");
|
||||||
|
personService.getPerson("andy4");
|
||||||
|
personService.getPerson("andy5");
|
||||||
|
personService.getPerson("andy6");
|
||||||
|
assertEquals(0, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
|
||||||
|
String auth1 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "one");
|
||||||
|
pubAuthorityService.addAuthority(auth1, "andy1");
|
||||||
|
String auth2 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth1, "two");
|
||||||
|
pubAuthorityService.addAuthority(auth2, "andy1");
|
||||||
|
pubAuthorityService.addAuthority(auth2, "andy2");
|
||||||
|
String auth3 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth2, "three");
|
||||||
|
pubAuthorityService.addAuthority(auth3, "andy3");
|
||||||
|
String auth4 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth3, "four");
|
||||||
|
pubAuthorityService.addAuthority(auth4, "andy1");
|
||||||
|
pubAuthorityService.addAuthority(auth4, "andy4");
|
||||||
|
String auth5 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth4, "five");
|
||||||
|
pubAuthorityService.addAuthority(auth5, "andy1");
|
||||||
|
pubAuthorityService.addAuthority(auth5, "andy5");
|
||||||
|
String auth6 = pubAuthorityService.createAuthority(AuthorityType.GROUP, auth3, "six");
|
||||||
|
pubAuthorityService.addAuthority(auth6, "andy1");
|
||||||
|
pubAuthorityService.addAuthority(auth6, "andy5");
|
||||||
|
pubAuthorityService.addAuthority(auth6, "andy6");
|
||||||
|
|
||||||
|
assertEquals(2, pubAuthorityService.getContainedAuthorities(null, auth1, true).size());
|
||||||
|
assertEquals(11, pubAuthorityService.getContainedAuthorities(null, auth1, false).size());
|
||||||
|
assertEquals(3, pubAuthorityService.getContainedAuthorities(null, auth2, true).size());
|
||||||
|
assertEquals(10, pubAuthorityService.getContainedAuthorities(null, auth2, false).size());
|
||||||
|
assertEquals(3, pubAuthorityService.getContainedAuthorities(null, auth3, true).size());
|
||||||
|
assertEquals(8, pubAuthorityService.getContainedAuthorities(null, auth3, false).size());
|
||||||
|
assertEquals(3, pubAuthorityService.getContainedAuthorities(null, auth4, true).size());
|
||||||
|
assertEquals(4, pubAuthorityService.getContainedAuthorities(null, auth4, false).size());
|
||||||
|
assertEquals(2, pubAuthorityService.getContainedAuthorities(null, auth5, true).size());
|
||||||
|
assertEquals(2, pubAuthorityService.getContainedAuthorities(null, auth5, false).size());
|
||||||
|
assertEquals(3, pubAuthorityService.getContainedAuthorities(null, auth6, true).size());
|
||||||
|
assertEquals(3, pubAuthorityService.getContainedAuthorities(null, auth6, false).size());
|
||||||
|
|
||||||
|
assertEquals(0, pubAuthorityService.getContainedAuthorities(null, "andy1", true).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainedAuthorities(null, "andy1", false).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainedAuthorities(null, "andy2", true).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainedAuthorities(null, "andy2", false).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainedAuthorities(null, "andy3", true).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainedAuthorities(null, "andy3", false).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainedAuthorities(null, "andy4", true).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainedAuthorities(null, "andy4", false).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainedAuthorities(null, "andy5", true).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainedAuthorities(null, "andy5", false).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainedAuthorities(null, "andy6", true).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainedAuthorities(null, "andy6", false).size());
|
||||||
|
|
||||||
|
assertEquals(1, pubAuthorityService.getContainedAuthorities(AuthorityType.GROUP, auth1, true).size());
|
||||||
|
assertEquals(5, pubAuthorityService.getContainedAuthorities(AuthorityType.GROUP, auth1, false).size());
|
||||||
|
assertEquals(1, pubAuthorityService.getContainedAuthorities(AuthorityType.GROUP, auth2, true).size());
|
||||||
|
assertEquals(4, pubAuthorityService.getContainedAuthorities(AuthorityType.GROUP, auth2, false).size());
|
||||||
|
assertEquals(2, pubAuthorityService.getContainedAuthorities(AuthorityType.GROUP, auth3, true).size());
|
||||||
|
assertEquals(3, pubAuthorityService.getContainedAuthorities(AuthorityType.GROUP, auth3, false).size());
|
||||||
|
assertEquals(1, pubAuthorityService.getContainedAuthorities(AuthorityType.GROUP, auth4, true).size());
|
||||||
|
assertEquals(1, pubAuthorityService.getContainedAuthorities(AuthorityType.GROUP, auth4, false).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainedAuthorities(AuthorityType.GROUP, auth5, true).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainedAuthorities(AuthorityType.GROUP, auth5, false).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainedAuthorities(AuthorityType.GROUP, auth6, true).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainedAuthorities(AuthorityType.GROUP, auth6, false).size());
|
||||||
|
|
||||||
|
assertEquals(1, pubAuthorityService.getContainedAuthorities(AuthorityType.USER, auth1, true).size());
|
||||||
|
assertEquals(6, pubAuthorityService.getContainedAuthorities(AuthorityType.USER, auth1, false).size());
|
||||||
|
assertEquals(2, pubAuthorityService.getContainedAuthorities(AuthorityType.USER, auth2, true).size());
|
||||||
|
assertEquals(6, pubAuthorityService.getContainedAuthorities(AuthorityType.USER, auth2, false).size());
|
||||||
|
assertEquals(1, pubAuthorityService.getContainedAuthorities(AuthorityType.USER, auth3, true).size());
|
||||||
|
assertEquals(5, pubAuthorityService.getContainedAuthorities(AuthorityType.USER, auth3, false).size());
|
||||||
|
assertEquals(2, pubAuthorityService.getContainedAuthorities(AuthorityType.USER, auth4, true).size());
|
||||||
|
assertEquals(3, pubAuthorityService.getContainedAuthorities(AuthorityType.USER, auth4, false).size());
|
||||||
|
assertEquals(2, pubAuthorityService.getContainedAuthorities(AuthorityType.USER, auth5, true).size());
|
||||||
|
assertEquals(2, pubAuthorityService.getContainedAuthorities(AuthorityType.USER, auth5, false).size());
|
||||||
|
assertEquals(3, pubAuthorityService.getContainedAuthorities(AuthorityType.USER, auth6, true).size());
|
||||||
|
assertEquals(3, pubAuthorityService.getContainedAuthorities(AuthorityType.USER, auth6, false).size());
|
||||||
|
|
||||||
|
// containing
|
||||||
|
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(null, auth1, true).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(null, auth1, false).size());
|
||||||
|
assertEquals(1, pubAuthorityService.getContainingAuthorities(null, auth2, true).size());
|
||||||
|
assertEquals(1, pubAuthorityService.getContainingAuthorities(null, auth2, false).size());
|
||||||
|
assertEquals(1, pubAuthorityService.getContainingAuthorities(null, auth3, true).size());
|
||||||
|
assertEquals(2, pubAuthorityService.getContainingAuthorities(null, auth3, false).size());
|
||||||
|
assertEquals(1, pubAuthorityService.getContainingAuthorities(null, auth4, true).size());
|
||||||
|
assertEquals(3, pubAuthorityService.getContainingAuthorities(null, auth4, false).size());
|
||||||
|
assertEquals(1, pubAuthorityService.getContainingAuthorities(null, auth5, true).size());
|
||||||
|
assertEquals(4, pubAuthorityService.getContainingAuthorities(null, auth5, false).size());
|
||||||
|
assertEquals(1, pubAuthorityService.getContainingAuthorities(null, auth6, true).size());
|
||||||
|
assertEquals(3, pubAuthorityService.getContainingAuthorities(null, auth6, false).size());
|
||||||
|
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(AuthorityType.GROUP, auth1, true).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(AuthorityType.GROUP, auth1, false).size());
|
||||||
|
assertEquals(1, pubAuthorityService.getContainingAuthorities(AuthorityType.GROUP, auth2, true).size());
|
||||||
|
assertEquals(1, pubAuthorityService.getContainingAuthorities(AuthorityType.GROUP, auth2, false).size());
|
||||||
|
assertEquals(1, pubAuthorityService.getContainingAuthorities(AuthorityType.GROUP, auth3, true).size());
|
||||||
|
assertEquals(2, pubAuthorityService.getContainingAuthorities(AuthorityType.GROUP, auth3, false).size());
|
||||||
|
assertEquals(1, pubAuthorityService.getContainingAuthorities(AuthorityType.GROUP, auth4, true).size());
|
||||||
|
assertEquals(3, pubAuthorityService.getContainingAuthorities(AuthorityType.GROUP, auth4, false).size());
|
||||||
|
assertEquals(1, pubAuthorityService.getContainingAuthorities(AuthorityType.GROUP, auth5, true).size());
|
||||||
|
assertEquals(4, pubAuthorityService.getContainingAuthorities(AuthorityType.GROUP, auth5, false).size());
|
||||||
|
assertEquals(1, pubAuthorityService.getContainingAuthorities(AuthorityType.GROUP, auth6, true).size());
|
||||||
|
assertEquals(3, pubAuthorityService.getContainingAuthorities(AuthorityType.GROUP, auth6, false).size());
|
||||||
|
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(AuthorityType.USER, auth1, true).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(AuthorityType.USER, auth1, false).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(AuthorityType.USER, auth2, true).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(AuthorityType.USER, auth2, false).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(AuthorityType.USER, auth3, true).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(AuthorityType.USER, auth3, false).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(AuthorityType.USER, auth4, true).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(AuthorityType.USER, auth4, false).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(AuthorityType.USER, auth5, true).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(AuthorityType.USER, auth5, false).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(AuthorityType.USER, auth6, true).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(AuthorityType.USER, auth6, false).size());
|
||||||
|
|
||||||
|
|
||||||
|
assertEquals(5, pubAuthorityService.getContainingAuthorities(null, "andy1", true).size());
|
||||||
|
assertEquals(6, pubAuthorityService.getContainingAuthorities(null, "andy1", false).size());
|
||||||
|
assertEquals(1, pubAuthorityService.getContainingAuthorities(null, "andy2", true).size());
|
||||||
|
assertEquals(2, pubAuthorityService.getContainingAuthorities(null, "andy2", false).size());
|
||||||
|
assertEquals(1, pubAuthorityService.getContainingAuthorities(null, "andy3", true).size());
|
||||||
|
assertEquals(3, pubAuthorityService.getContainingAuthorities(null, "andy3", false).size());
|
||||||
|
assertEquals(1, pubAuthorityService.getContainingAuthorities(null, "andy4", true).size());
|
||||||
|
assertEquals(4, pubAuthorityService.getContainingAuthorities(null, "andy4", false).size());
|
||||||
|
assertEquals(2, pubAuthorityService.getContainingAuthorities(null, "andy5", true).size());
|
||||||
|
assertEquals(6, pubAuthorityService.getContainingAuthorities(null, "andy5", false).size());
|
||||||
|
assertEquals(1, pubAuthorityService.getContainingAuthorities(null, "andy6", true).size());
|
||||||
|
assertEquals(4, pubAuthorityService.getContainingAuthorities(null, "andy6", false).size());
|
||||||
|
|
||||||
|
assertEquals(5, pubAuthorityService.getContainingAuthorities(AuthorityType.GROUP, "andy1", true).size());
|
||||||
|
assertEquals(6, pubAuthorityService.getContainingAuthorities(AuthorityType.GROUP, "andy1", false).size());
|
||||||
|
assertEquals(1, pubAuthorityService.getContainingAuthorities(AuthorityType.GROUP, "andy2", true).size());
|
||||||
|
assertEquals(2, pubAuthorityService.getContainingAuthorities(AuthorityType.GROUP, "andy2", false).size());
|
||||||
|
assertEquals(1, pubAuthorityService.getContainingAuthorities(AuthorityType.GROUP, "andy3", true).size());
|
||||||
|
assertEquals(3, pubAuthorityService.getContainingAuthorities(AuthorityType.GROUP, "andy3", false).size());
|
||||||
|
assertEquals(1, pubAuthorityService.getContainingAuthorities(AuthorityType.GROUP, "andy4", true).size());
|
||||||
|
assertEquals(4, pubAuthorityService.getContainingAuthorities(AuthorityType.GROUP, "andy4", false).size());
|
||||||
|
assertEquals(2, pubAuthorityService.getContainingAuthorities(AuthorityType.GROUP, "andy5", true).size());
|
||||||
|
assertEquals(6, pubAuthorityService.getContainingAuthorities(AuthorityType.GROUP, "andy5", false).size());
|
||||||
|
assertEquals(1, pubAuthorityService.getContainingAuthorities(AuthorityType.GROUP, "andy6", true).size());
|
||||||
|
assertEquals(4, pubAuthorityService.getContainingAuthorities(AuthorityType.GROUP, "andy6", false).size());
|
||||||
|
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(AuthorityType.USER, "andy1", true).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(AuthorityType.USER, "andy1", false).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(AuthorityType.USER, "andy2", true).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(AuthorityType.USER, "andy2", false).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(AuthorityType.USER, "andy3", true).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(AuthorityType.USER, "andy3", false).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(AuthorityType.USER, "andy4", true).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(AuthorityType.USER, "andy4", false).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(AuthorityType.USER, "andy5", true).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(AuthorityType.USER, "andy5", false).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(AuthorityType.USER, "andy6", true).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getContainingAuthorities(AuthorityType.USER, "andy6", false).size());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test toknisation of group members
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void test_AR_1517__AND__AR_1411()
|
||||||
|
{
|
||||||
|
personService.getPerson("1234");
|
||||||
|
assertTrue(personService.personExists("1234"));
|
||||||
|
personService.getPerson("Loon");
|
||||||
|
assertTrue(personService.personExists("Loon"));
|
||||||
|
personService.getPerson("andy");
|
||||||
|
assertTrue(personService.personExists("andy"));
|
||||||
|
personService.createPerson(createDefaultProperties("Novalike", "Nova", "Like", "Nove@Like", "Sun", null));
|
||||||
|
assertTrue(personService.personExists("Novalike"));
|
||||||
|
personService.getPerson("1andy");
|
||||||
|
assertTrue(personService.personExists("1andy"));
|
||||||
|
personService.getPerson("andy2");
|
||||||
|
assertTrue(personService.personExists("andy2"));
|
||||||
|
personService.getPerson("an3dy");
|
||||||
|
assertTrue(personService.personExists("an3dy"));
|
||||||
|
|
||||||
|
|
||||||
|
assertEquals(0, pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).size());
|
||||||
|
assertEquals(0, pubAuthorityService.getAllRootAuthorities(AuthorityType.GROUP).size());
|
||||||
|
String auth1 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "one");
|
||||||
|
pubAuthorityService.addAuthority(auth1, "1234");
|
||||||
|
String auth2 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "two");
|
||||||
|
pubAuthorityService.addAuthority(auth2, "andy");
|
||||||
|
String auth3 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "three");
|
||||||
|
pubAuthorityService.addAuthority(auth3, "Novalike");
|
||||||
|
String auth4 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "four");
|
||||||
|
pubAuthorityService.addAuthority(auth4, "1andy");
|
||||||
|
String auth5 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "five");
|
||||||
|
pubAuthorityService.addAuthority(auth5, "andy2");
|
||||||
|
String auth6 = pubAuthorityService.createAuthority(AuthorityType.GROUP, null, "six");
|
||||||
|
pubAuthorityService.addAuthority(auth6, "an3dy");
|
||||||
|
|
||||||
|
|
||||||
|
assertEquals(1, pubAuthorityService.getContainedAuthorities(null, auth1, true).size());
|
||||||
|
assertTrue(pubAuthorityService.getContainedAuthorities(null, auth1, true).contains("1234"));
|
||||||
|
assertEquals(1, pubAuthorityService.getContainedAuthorities(null, auth2, true).size());
|
||||||
|
assertTrue(pubAuthorityService.getContainedAuthorities(null, auth2, true).contains("andy"));
|
||||||
|
assertEquals(1, pubAuthorityService.getContainedAuthorities(null, auth3, true).size());
|
||||||
|
assertTrue(pubAuthorityService.getContainedAuthorities(null, auth3, true).contains("Novalike"));
|
||||||
|
assertEquals(1, pubAuthorityService.getContainedAuthorities(null, auth4, true).size());
|
||||||
|
assertTrue(pubAuthorityService.getContainedAuthorities(null, auth4, true).contains("1andy"));
|
||||||
|
assertEquals(1, pubAuthorityService.getContainedAuthorities(null, auth5, true).size());
|
||||||
|
assertTrue(pubAuthorityService.getContainedAuthorities(null, auth5, true).contains("andy2"));
|
||||||
|
assertEquals(1, pubAuthorityService.getContainedAuthorities(null, auth6, true).size());
|
||||||
|
assertTrue(pubAuthorityService.getContainedAuthorities(null, auth6, true).contains("an3dy"));
|
||||||
|
|
||||||
|
assertEquals(1, pubAuthorityService.getContainingAuthorities(null, "1234", false).size());
|
||||||
|
assertTrue(pubAuthorityService.getContainingAuthorities(null, "1234", false).contains(auth1));
|
||||||
|
assertEquals(1, pubAuthorityService.getContainingAuthorities(null, "andy", false).size());
|
||||||
|
assertTrue(pubAuthorityService.getContainingAuthorities(null, "andy", false).contains(auth2));
|
||||||
|
assertEquals(1, pubAuthorityService.getContainingAuthorities(null, "Novalike", false).size());
|
||||||
|
assertTrue(pubAuthorityService.getContainingAuthorities(null, "Novalike", false).contains(auth3));
|
||||||
|
assertEquals(1, pubAuthorityService.getContainingAuthorities(null, "1andy", false).size());
|
||||||
|
assertTrue(pubAuthorityService.getContainingAuthorities(null, "1andy", false).contains(auth4));
|
||||||
|
assertEquals(1, pubAuthorityService.getContainingAuthorities(null, "andy2", false).size());
|
||||||
|
assertTrue(pubAuthorityService.getContainingAuthorities(null, "andy2", false).contains(auth5));
|
||||||
|
assertEquals(1, pubAuthorityService.getContainingAuthorities(null, "an3dy", false).size());
|
||||||
|
assertTrue(pubAuthorityService.getContainingAuthorities(null, "an3dy", false).contains(auth6));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<QName, Serializable> createDefaultProperties(String userName, String firstName, String lastName,
|
||||||
|
String email, String orgId, NodeRef home)
|
||||||
|
{
|
||||||
|
HashMap<QName, Serializable> properties = new HashMap<QName, Serializable>();
|
||||||
|
properties.put(ContentModel.PROP_USERNAME, userName);
|
||||||
|
properties.put(ContentModel.PROP_HOMEFOLDER, home);
|
||||||
|
properties.put(ContentModel.PROP_FIRSTNAME, firstName);
|
||||||
|
properties.put(ContentModel.PROP_LASTNAME, lastName);
|
||||||
|
properties.put(ContentModel.PROP_EMAIL, email);
|
||||||
|
properties.put(ContentModel.PROP_ORGID, orgId);
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user