Merged V2.2 to HEAD

7700: Added store level ACLs.
   7705: Merged V2.1 to V2.2
      7701: Fixes a number of problems with FS deployment. Should work on windows now.
   7712: AWC-1473: Fixed rendering of sidebar in Safari
   7718: Merged V2.1 to V2.2
      7704: Fix for HSQL column name clash - NEXT is reserved, so now NEXT_ID
   7719: Build fix after Qname changes
   7730: Build fix for email group.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8446 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley 2008-03-07 00:57:50 +00:00
parent 5aa886087b
commit bccc560c44
10 changed files with 443 additions and 370 deletions

View File

@ -369,7 +369,7 @@ public class AVMRepository
{
throw new AVMWrongTypeException("Not a directory.");
}
if (!can(node, PermissionService.CREATE_CHILDREN))
if (!can(null, node, PermissionService.CREATE_CHILDREN))
{
throw new AccessDeniedException("Not allowed to write in: " + parent);
}
@ -553,7 +553,7 @@ public class AVMRepository
throw new AVMNotFoundException("Path not found.");
}
DirectoryNode dirNode = (DirectoryNode)dPath.getCurrentNode();
if (!can(dirNode, PermissionService.ADD_CHILDREN))
if (!can(dstRepo, dirNode, PermissionService.ADD_CHILDREN))
{
throw new AccessDeniedException("Not permitted to add children: " + dstPath);
}
@ -735,7 +735,7 @@ public class AVMRepository
throw new AVMNotFoundException("Path not found.");
}
srcDir = (DirectoryNode)sPath.getCurrentNode();
if (!can(srcDir, PermissionService.DELETE_CHILDREN) || !can(srcDir, PermissionService.ADD_CHILDREN))
if (!can(srcRepo, srcDir, PermissionService.DELETE_CHILDREN) || !can(srcRepo, srcDir, PermissionService.ADD_CHILDREN))
{
throw new AccessDeniedException("Not allowed to read or write: " + srcPath);
}
@ -766,7 +766,7 @@ public class AVMRepository
throw new AVMNotFoundException("Path not found.");
}
DirectoryNode dstDir = (DirectoryNode)dPath.getCurrentNode();
if (!can(dstDir, PermissionService.ADD_CHILDREN))
if (!can(dstRepo, dstDir, PermissionService.ADD_CHILDREN))
{
throw new AccessDeniedException("Not allowed to write: " + dstPath);
}
@ -981,7 +981,7 @@ public class AVMRepository
fLookupCache.onDelete(name);
AVMNode root = store.getRoot();
// TODO Probably a special PermissionService.PURGE is needed.
if (!can(root, PermissionService.DELETE_CHILDREN))
if (!can(store, root, PermissionService.DELETE_CHILDREN))
{
throw new AccessDeniedException("Not allowed to purge: " + name);
}
@ -1061,7 +1061,7 @@ public class AVMRepository
{
throw new AVMWrongTypeException(desc + " is not a File.");
}
if (!can(node, PermissionService.READ_CONTENT))
if (!can(null, node, PermissionService.READ_CONTENT))
{
throw new AccessDeniedException("Not allowed to read content: " + desc);
}
@ -1152,7 +1152,7 @@ public class AVMRepository
{
throw new AVMBadArgumentException("Invalid Node.");
}
if (!can(node, PermissionService.READ_CHILDREN))
if (!can(null, node, PermissionService.READ_CHILDREN))
{
throw new AccessDeniedException("Not allowed to read children: " + dir);
}
@ -1190,7 +1190,7 @@ public class AVMRepository
{
throw new AVMWrongTypeException("Not a directory.");
}
if (!can(node, PermissionService.READ_CHILDREN))
if (!can(null, node, PermissionService.READ_CHILDREN))
{
throw new AccessDeniedException("Not allowed to read children: " + dir);
}
@ -1488,7 +1488,7 @@ public class AVMRepository
throw new AVMWrongTypeException("Not a directory.");
}
DirectoryNode dirNode = (DirectoryNode)node;
if (!can(dirNode, PermissionService.READ_CHILDREN))
if (!can(null, dirNode, PermissionService.READ_CHILDREN))
{
throw new AccessDeniedException("Not allowed to read children: " + dir);
}
@ -1595,7 +1595,7 @@ public class AVMRepository
*/
private void recursiveGetVersionPaths(AVMNode node, List<String> components, List<String> paths, DirectoryNode root, String storeName)
{
if (!can(node, PermissionService.READ_CHILDREN))
if (!can(null, node, PermissionService.READ_CHILDREN))
{
return;
}
@ -1655,7 +1655,7 @@ public class AVMRepository
private void recursiveGetPaths(AVMNode node, List<String> components,
List<Pair<Integer, String>> paths)
{
if (!can(node, PermissionService.READ_CHILDREN))
if (!can(null, node, PermissionService.READ_CHILDREN))
{
return;
}
@ -1695,7 +1695,7 @@ public class AVMRepository
*/
private Pair<Integer, String> recursiveGetAPath(AVMNode node, List<String> components)
{
if (!can(node, PermissionService.READ_CHILDREN))
if (!can(null, node, PermissionService.READ_CHILDREN))
{
return null;
}
@ -1753,7 +1753,7 @@ public class AVMRepository
private void recursiveGetHeadPaths(AVMNode node, List<String> components,
List<Pair<Integer, String>> paths)
{
if (!can(node, PermissionService.READ_CHILDREN))
if (!can(null, node, PermissionService.READ_CHILDREN))
{
return;
}
@ -1792,7 +1792,7 @@ public class AVMRepository
List<Pair<Integer, String>> paths, DirectoryNode root,
String storeName)
{
if (!can(node, PermissionService.READ_CHILDREN))
if (!can(null, node, PermissionService.READ_CHILDREN))
{
return;
}
@ -1895,7 +1895,7 @@ public class AVMRepository
{
throw new AVMNotFoundException("Path not found.");
}
if (!can(lookup.getCurrentNode(), PermissionService.READ_PROPERTIES))
if (!can(store, lookup.getCurrentNode(), PermissionService.READ_PROPERTIES))
{
throw new AccessDeniedException("Not allowed to read properties: " + path);
}
@ -2036,7 +2036,7 @@ public class AVMRepository
{
throw new AVMNotFoundException("Not found.");
}
if (!can(node, PermissionService.READ_PROPERTIES))
if (!can(null, node, PermissionService.READ_PROPERTIES))
{
throw new AccessDeniedException("Not allowed to read properties: " + desc);
}
@ -2052,7 +2052,7 @@ public class AVMRepository
{
break;
}
if (!can(node, PermissionService.READ_PROPERTIES))
if (!can(null, node, PermissionService.READ_PROPERTIES))
{
break;
}
@ -2436,11 +2436,11 @@ public class AVMRepository
{
throw new AVMNotFoundException("Node not found.");
}
if (!can(lNode, PermissionService.READ_PROPERTIES))
if (!can(null, lNode, PermissionService.READ_PROPERTIES))
{
throw new AccessDeniedException("Not allowed to read properties: " + left);
}
if (!can(rNode, PermissionService.READ_PROPERTIES))
if (!can(null, rNode, PermissionService.READ_PROPERTIES))
{
throw new AccessDeniedException("Not allowed to read properties: " + right);
}
@ -2829,7 +2829,7 @@ public class AVMRepository
{
throw new AVMException("Directory has not already been copied.");
}
if (!can(dir, PermissionService.ADD_CHILDREN))
if (!can(null, dir, PermissionService.ADD_CHILDREN))
{
throw new AccessDeniedException("Not allowed to write: " + parent);
}
@ -2866,7 +2866,7 @@ public class AVMRepository
{
throw new AVMWrongTypeException("Not a Layered Directory.");
}
if (!can(node, PermissionService.DELETE_CHILDREN))
if (!can(store, node, PermissionService.DELETE_CHILDREN))
{
throw new AccessDeniedException("Not allowed to write in: " + path);
}
@ -3083,7 +3083,7 @@ public class AVMRepository
private void recursiveGetStoreVersionPaths(String storeName, AVMNode node, int version, List<String> components,
List<String> paths)
{
if (!can(node, PermissionService.READ))
if (!can(null, node, PermissionService.READ))
{
return;
}
@ -3116,7 +3116,7 @@ public class AVMRepository
{
throw new AVMNotFoundException("Node not found: " + desc);
}
if (!can(node, PermissionService.READ_PROPERTIES))
if (!can(null, node, PermissionService.READ_PROPERTIES))
{
throw new AccessDeniedException("Not allowed to read properties: " + desc);
}
@ -3133,7 +3133,7 @@ public class AVMRepository
{
throw new AVMNotFoundException("Node not found: " + desc);
}
if (!can(node, PermissionService.READ_CONTENT))
if (!can(null, node, PermissionService.READ_CONTENT))
{
throw new AccessDeniedException("Not allowed to read: " + desc);
}
@ -3152,7 +3152,7 @@ public class AVMRepository
{
throw new AVMNotFoundException("Node not found: " + desc);
}
if (!can(node, PermissionService.READ_PROPERTIES))
if (!can(null, node, PermissionService.READ_PROPERTIES))
{
throw new AccessDeniedException("Not allowed to read properties: " + desc);
}
@ -3164,12 +3164,13 @@ public class AVMRepository
/**
* Evaluate permission on a node. I've got a bad feeling about this...
*
* @param store
* @param node
* @param permission
*
* @return
*/
public boolean can(AVMNode node, String permission)
public boolean can(AVMStore store, AVMNode node, String permission)
{
DbAccessControlList acl = node.getAcl();
@ -3223,7 +3224,46 @@ public class AVMRepository
{
aclId = acl.getId();
}
if (store != null)
{
DbAccessControlList storeAcl = store.getStoreAcl();
if (storeAcl != null)
{
Long storeAclID = storeAcl.getId();
context.getAdditionalContext().put("STORE_ACL_ID", storeAclID);
}
}
return fPermissionService.hasPermission(aclId, context, permission)
== AccessStatus.ALLOWED;
}
/**
* Set the acl on a store.
* @param storeName
* @param acl
*/
public void setStoreAcl(String storeName, DbAccessControlList acl)
{
AVMStore store = getAVMStoreByName(storeName);
if (store == null)
{
throw new AVMNotFoundException("Store not found: " + storeName);
}
store.setStoreAcl(acl);
}
/**
* Get the ACL on a store.
* @param storeName
* @return
*/
public DbAccessControlList getStoreAcl(String storeName)
{
AVMStore store = getAVMStoreByName(storeName);
if (store == null)
{
throw new AVMNotFoundException("Store not found: " + storeName);
}
return store.getStoreAcl();
}
}

View File

@ -328,7 +328,7 @@ public class AVMServicePermissionsTest extends TestCase
runAs(user);
AVMNodeDescriptor desc = avmService.lookup(-1, path);
AVMNode node = avmNodeDAO.getByID(desc.getId());
boolean can = AVMRepository.GetInstance().can(node, permission);
boolean can = AVMRepository.GetInstance().can(null, node, permission);
return allowed ? can : !can;
}
finally
@ -345,11 +345,11 @@ public class AVMServicePermissionsTest extends TestCase
runAs(user);
AVMNodeDescriptor desc = avmService.lookup(-1, path);
AVMNode node = avmNodeDAO.getByID(desc.getId());
boolean can = AVMRepository.GetInstance().can(node, permission);
boolean can = AVMRepository.GetInstance().can(null, node, permission);
long start = System.nanoTime();
for(int i = 0; i < count; i++)
{
can = AVMRepository.GetInstance().can(node, permission);
can = AVMRepository.GetInstance().can(null, node, permission);
}
long end = System.nanoTime();
System.out.println("Can in "+((end-start)/1.0e9f));

View File

@ -70,6 +70,18 @@ public interface AVMStore
*/
public void setNewRoot(DirectoryNode root);
/**
* Get the Acl associated with this store.
* @return
*/
public DbAccessControlList getStoreAcl();
/**
* Set the acl on this store.
* @param acl
*/
public void setStoreAcl(DbAccessControlList acl);
/**
* Snapshots this store. This sets all nodes in the
* the store to the should be copied state, and creates

View File

@ -101,6 +101,11 @@ public class AVMStoreImpl implements AVMStore, Serializable
*/
private long fVers;
/**
* Acl for this store.
*/
private DbAccessControlList fACL;
/**
* The AVMRepository.
*/
@ -337,7 +342,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found.");
}
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
if (!fAVMRepository.can(dir, PermissionService.ADD_CHILDREN))
if (!fAVMRepository.can(this, dir, PermissionService.ADD_CHILDREN))
{
throw new AccessDeniedException("Not allowed to write: " + path);
}
@ -454,7 +459,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found.");
}
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
if (!fAVMRepository.can(dir, PermissionService.ADD_CHILDREN))
if (!fAVMRepository.can(this, dir, PermissionService.ADD_CHILDREN))
{
throw new AccessDeniedException("Not allowed to write: " + path);
}
@ -496,7 +501,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found.");
}
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
if (!fAVMRepository.can(dir, PermissionService.ADD_CHILDREN))
if (!fAVMRepository.can(this, dir, PermissionService.ADD_CHILDREN))
{
throw new AccessDeniedException("Not allowed to write: " + path);
}
@ -563,7 +568,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + dstPath + " not found.");
}
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
if (!fAVMRepository.can(dir, PermissionService.ADD_CHILDREN))
if (!fAVMRepository.can(this, dir, PermissionService.ADD_CHILDREN))
{
throw new AccessDeniedException("Not allowed to write: " + dstPath);
}
@ -645,7 +650,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found.");
}
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
if (!fAVMRepository.can(dir, PermissionService.READ_CHILDREN))
if (!fAVMRepository.can(this, dir, PermissionService.READ_CHILDREN))
{
throw new AccessDeniedException("Not allowed to read: " + path);
}
@ -668,7 +673,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found.");
}
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
if (!fAVMRepository.can(dir, PermissionService.READ_CHILDREN))
if (!fAVMRepository.can(this, dir, PermissionService.READ_CHILDREN))
{
throw new AccessDeniedException("Not allowed to read: " + path);
}
@ -715,7 +720,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found.");
}
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
if (!fAVMRepository.can(dir, PermissionService.READ_CHILDREN))
if (!fAVMRepository.can(this, dir, PermissionService.READ_CHILDREN))
{
throw new AccessDeniedException("Not allowed to read: " + path);
}
@ -747,7 +752,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found.");
}
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
if (!fAVMRepository.can(dir, PermissionService.DELETE_CHILDREN))
if (!fAVMRepository.can(this, dir, PermissionService.DELETE_CHILDREN))
{
throw new AVMNotFoundException("Not allowed to write: " + path);
}
@ -776,7 +781,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
{
throw new AVMWrongTypeException("Not a layered directory: " + dirPath);
}
if (!fAVMRepository.can(node, PermissionService.DELETE_CHILDREN))
if (!fAVMRepository.can(this, node, PermissionService.DELETE_CHILDREN))
{
throw new AccessDeniedException("Not allowed to write: " + dirPath);
}
@ -875,7 +880,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
{
root = AVMDAOs.Instance().fAVMNodeDAO.getAVMStoreRoot(this, version);
}
if (!fAVMRepository.can(root, PermissionService.READ_CHILDREN))
if (!fAVMRepository.can(this, root, PermissionService.READ_CHILDREN))
{
throw new AccessDeniedException("Not allowed to read: " + fName + "@" + version);
}
@ -924,7 +929,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
return null;
}
AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.READ_PROPERTIES))
if (!fAVMRepository.can(this, node, PermissionService.READ_PROPERTIES))
{
throw new AccessDeniedException("Not allowed to read: " + path);
}
@ -957,7 +962,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
{
throw new AVMException("Not in a layered context: " + path);
}
if (!fAVMRepository.can(dir, PermissionService.WRITE_PROPERTIES))
if (!fAVMRepository.can(this, dir, PermissionService.WRITE_PROPERTIES))
{
throw new AccessDeniedException("Not allowed to write: " + path);
}
@ -982,7 +987,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
{
throw new AVMException("Not in a layered context: " + path);
}
if (!fAVMRepository.can(dir, PermissionService.WRITE_PROPERTIES))
if (!fAVMRepository.can(this, dir, PermissionService.WRITE_PROPERTIES))
{
throw new AccessDeniedException("Not allowed to write: " + path);
}
@ -1008,6 +1013,19 @@ public class AVMStoreImpl implements AVMStore, Serializable
return fName;
}
/* (non-Javadoc)
* @see org.alfresco.repo.avm.AVMStore#getAcl()
*/
public DbAccessControlList getStoreAcl()
{
return fACL;
}
public void setStoreAcl(DbAccessControlList acl)
{
fACL = acl;
}
/**
* Set the next version id.
* @param nextVersionID
@ -1117,7 +1135,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
}
AVMDAOs.Instance().fVersionLayeredNodeEntryDAO.delete(vRoot);
AVMNode root = vRoot.getRoot();
if (!fAVMRepository.can(root, PermissionService.DELETE_CHILDREN))
if (!fAVMRepository.can(null, root, PermissionService.DELETE_CHILDREN))
{
throw new AccessDeniedException("Not allowed to purge: " + fName + "@" + version);
}
@ -1164,7 +1182,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
{
throw new AVMWrongTypeException("Not a LayeredDirectoryNode.");
}
if (!fAVMRepository.can(node, PermissionService.WRITE_PROPERTIES))
if (!fAVMRepository.can(this, node, PermissionService.WRITE_PROPERTIES))
{
throw new AccessDeniedException("Not allowed to write: " + path);
}
@ -1187,7 +1205,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found.");
}
AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.WRITE_PROPERTIES))
if (!fAVMRepository.can(this, node, PermissionService.WRITE_PROPERTIES))
{
throw new AccessDeniedException("Not allowed to write: " + path);
}
@ -1210,7 +1228,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found.");
}
AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.WRITE_PROPERTIES))
if (!fAVMRepository.can(this, node, PermissionService.WRITE_PROPERTIES))
{
throw new AccessDeniedException("Not allowed to write: " + path);
}
@ -1244,7 +1262,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found.");
}
AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.READ_PROPERTIES))
if (!fAVMRepository.can(this, node, PermissionService.READ_PROPERTIES))
{
throw new AccessDeniedException("Not allowed to read: " + path);
}
@ -1277,7 +1295,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found.");
}
AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.READ_PROPERTIES))
if (!fAVMRepository.can(this, node, PermissionService.READ_PROPERTIES))
{
throw new AccessDeniedException("Not allowed to read: " + path);
}
@ -1302,7 +1320,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found.");
}
AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.WRITE_PROPERTIES))
if (!fAVMRepository.can(this, node, PermissionService.WRITE_PROPERTIES))
{
throw new AccessDeniedException("Not allowed to write: " + path);
}
@ -1332,7 +1350,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found.");
}
AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.WRITE_PROPERTIES))
if (!fAVMRepository.can(this, node, PermissionService.WRITE_PROPERTIES))
{
throw new AccessDeniedException("Not allowed to write: " + path);
}
@ -1425,7 +1443,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
{
throw new AVMWrongTypeException("File Expected.");
}
if (!fAVMRepository.can(node, PermissionService.READ_CONTENT))
if (!fAVMRepository.can(this, node, PermissionService.READ_CONTENT))
{
throw new AccessDeniedException("Not allowed to read: " + path);
}
@ -1452,7 +1470,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
{
throw new AVMWrongTypeException("File Expected.");
}
if (!fAVMRepository.can(node, PermissionService.WRITE_CONTENT))
if (!fAVMRepository.can(this, node, PermissionService.WRITE_CONTENT))
{
throw new AccessDeniedException("Not allowed to write content: " + path);
}
@ -1500,7 +1518,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path not found: " + path);
}
AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.WRITE_PROPERTIES))
if (!fAVMRepository.can(this, node, PermissionService.WRITE_PROPERTIES))
{
throw new AccessDeniedException("Not allowed to write properties: " + path);
}
@ -1521,7 +1539,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found.");
}
AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.WRITE_PROPERTIES))
if (!fAVMRepository.can(this, node, PermissionService.WRITE_PROPERTIES))
{
throw new AccessDeniedException("Not allowed to write: " + path);
}
@ -1547,7 +1565,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found.");
}
AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.READ_PROPERTIES))
if (!fAVMRepository.can(this, node, PermissionService.READ_PROPERTIES))
{
throw new AccessDeniedException("Not allowed to read properties: " + path);
}
@ -1570,7 +1588,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found.");
}
AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.WRITE_PROPERTIES))
if (!fAVMRepository.can(this, node, PermissionService.WRITE_PROPERTIES))
{
throw new AccessDeniedException("Not allowed to write properties: " + path);
}
@ -1607,7 +1625,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found.");
}
AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.READ_PROPERTIES))
if (!fAVMRepository.can(this, node, PermissionService.READ_PROPERTIES))
{
throw new AccessDeniedException("Not allowed to read properties: " + path);
}
@ -1637,7 +1655,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found.");
}
AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.CHANGE_PERMISSIONS))
if (!fAVMRepository.can(this, node, PermissionService.CHANGE_PERMISSIONS))
{
throw new AccessDeniedException("Not allowed to change permissions: " + path);
}
@ -1658,7 +1676,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
{
throw new AVMNotFoundException("Path " + path + " not found.");
}
if (!fAVMRepository.can(lPath.getCurrentNode(), PermissionService.READ_PERMISSIONS))
if (!fAVMRepository.can(this, lPath.getCurrentNode(), PermissionService.READ_PERMISSIONS))
{
throw new AccessDeniedException("Not allowed to read permissions: " + path + " in "+getName());
}
@ -1679,7 +1697,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + parentPath + " not found.");
}
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
if (!fAVMRepository.can(dir, PermissionService.ADD_CHILDREN))
if (!fAVMRepository.can(null, dir, PermissionService.ADD_CHILDREN))
{
throw new AccessDeniedException("Not allowed to add children: " + parentPath);
}
@ -1702,8 +1720,8 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path " + path + " not found.");
}
DirectoryNode dir = (DirectoryNode)lPath.getCurrentNode();
if (!fAVMRepository.can(dir, PermissionService.DELETE_CHILDREN) ||
!fAVMRepository.can(dir, PermissionService.ADD_CHILDREN))
if (!fAVMRepository.can(null, dir, PermissionService.DELETE_CHILDREN) ||
!fAVMRepository.can(null, dir, PermissionService.ADD_CHILDREN))
{
throw new AccessDeniedException("Not allowed to revert: " + path);
}
@ -1743,7 +1761,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path not found: " + path);
}
AVMNode node = lPath.getCurrentNode();
if (!fAVMRepository.can(node, PermissionService.WRITE_PROPERTIES))
if (!fAVMRepository.can(this, node, PermissionService.WRITE_PROPERTIES))
{
throw new AccessDeniedException("Not allowed to write properties: " + path);
}
@ -1765,7 +1783,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
{
throw new AVMWrongTypeException("Not a File: " + path);
}
if (!fAVMRepository.can(node, PermissionService.WRITE_PROPERTIES))
if (!fAVMRepository.can(this, node, PermissionService.WRITE_PROPERTIES))
{
throw new AccessDeniedException("Not allowed to write properties: " + path);
}
@ -1788,7 +1806,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
{
throw new AVMWrongTypeException("Not a File: " + path);
}
if (!fAVMRepository.can(node, PermissionService.WRITE_PROPERTIES))
if (!fAVMRepository.can(this, node, PermissionService.WRITE_PROPERTIES))
{
throw new AccessDeniedException("Not allowed to write properties: " + path);
}

View File

@ -443,7 +443,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
if (entry.getValue().getType() == AVMNodeType.LAYERED_DIRECTORY ||
entry.getValue().getType() == AVMNodeType.PLAIN_DIRECTORY)
{
if (!AVMRepository.GetInstance().can(entry.getValue(), PermissionService.READ_CHILDREN))
if (!AVMRepository.GetInstance().can(lookup.getAVMStore(), entry.getValue(), PermissionService.READ_CHILDREN))
{
continue;
}
@ -457,7 +457,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
if (entry.getChild().getType() == AVMNodeType.LAYERED_DIRECTORY ||
entry.getChild().getType() == AVMNodeType.PLAIN_DIRECTORY)
{
if (!AVMRepository.GetInstance().can(entry.getChild(), PermissionService.READ_CHILDREN))
if (!AVMRepository.GetInstance().can(lPath.getAVMStore(), entry.getChild(), PermissionService.READ_CHILDREN))
{
continue;
}
@ -489,7 +489,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
if (entry.getChild().getType() == AVMNodeType.LAYERED_DIRECTORY ||
entry.getChild().getType() == AVMNodeType.PLAIN_DIRECTORY)
{
if (!AVMRepository.GetInstance().can(entry.getChild(), PermissionService.READ_CHILDREN))
if (!AVMRepository.GetInstance().can(lPath != null ? lPath.getAVMStore() : null, entry.getChild(), PermissionService.READ_CHILDREN))
{
continue;
}
@ -521,7 +521,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
if (childNode.getType() == AVMNodeType.LAYERED_DIRECTORY ||
childNode.getType() == AVMNodeType.PLAIN_DIRECTORY)
{
if (!AVMRepository.GetInstance().can(childNode, PermissionService.READ_CHILDREN))
if (!AVMRepository.GetInstance().can(null, childNode, PermissionService.READ_CHILDREN))
{
continue;
}
@ -565,7 +565,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
if (entry.getValue().getType() == AVMNodeType.LAYERED_DIRECTORY ||
entry.getValue().getType() == AVMNodeType.PLAIN_DIRECTORY)
{
if (!AVMRepository.GetInstance().can(entry.getValue(), PermissionService.READ_CHILDREN))
if (!AVMRepository.GetInstance().can(null, entry.getValue(), PermissionService.READ_CHILDREN))
{
continue;
}
@ -583,7 +583,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
if (child.getChild().getType() == AVMNodeType.LAYERED_DIRECTORY ||
child.getChild().getType() == AVMNodeType.PLAIN_DIRECTORY)
{
if (!AVMRepository.GetInstance().can(child.getChild(), PermissionService.READ_CHILDREN))
if (!AVMRepository.GetInstance().can(null, child.getChild(), PermissionService.READ_CHILDREN))
{
continue;
}

View File

@ -132,7 +132,7 @@ public class LookupCache
// before the end.
for (int i = 0; i < path.size() - 1; i++)
{
if (!AVMRepository.GetInstance().can(dir, PermissionService.READ_CHILDREN))
if (!AVMRepository.GetInstance().can(null, dir, PermissionService.READ_CHILDREN))
{
throw new AccessDeniedException("Not allowed to read children: " + path.get(i));
}
@ -151,7 +151,7 @@ public class LookupCache
dir = (DirectoryNode)result.getCurrentNode();
}
// Now look up the last element.
if (!AVMRepository.GetInstance().can(dir, PermissionService.READ_CHILDREN))
if (!AVMRepository.GetInstance().can(null, dir, PermissionService.READ_CHILDREN))
{
throw new AccessDeniedException("Not allowed to read children: " + path.get(path.size() - 1));
}

View File

@ -116,7 +116,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
if (child.getChild().getType() == AVMNodeType.LAYERED_DIRECTORY ||
child.getChild().getType() == AVMNodeType.PLAIN_DIRECTORY)
{
if (!AVMRepository.GetInstance().can(child.getChild(), PermissionService.READ_CHILDREN))
if (!AVMRepository.GetInstance().can(lPath.getAVMStore(), child.getChild(), PermissionService.READ_CHILDREN))
{
continue;
}
@ -170,7 +170,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
if (child.getChild().getType() == AVMNodeType.LAYERED_DIRECTORY ||
child.getChild().getType() == AVMNodeType.PLAIN_DIRECTORY)
{
if (!AVMRepository.GetInstance().can(child.getChild(), PermissionService.READ_CHILDREN))
if (!AVMRepository.GetInstance().can(null, child.getChild(), PermissionService.READ_CHILDREN))
{
continue;
}

View File

@ -140,6 +140,9 @@
<many-to-one name="root" class="DirectoryNodeImpl"
column="current_root_id" cascade="save-update" foreign-key="fk_avm_s_root">
</many-to-one>
<!-- ACL -->
<many-to-one name="storeAcl" column="acl_id" foreign-key="fk_avm_s_acl" cascade="none"
class="org.alfresco.repo.domain.hibernate.DbAccessControlListImpl"/>
</class>
<class name="AVMStorePropertyImpl" proxy="AVMStoreProperty" table="avm_store_properties">
<id name="id" column="id" type="long">
@ -257,7 +260,7 @@
<class name="IssuerIDImpl" proxy="IssuerID" table="avm_issuer_ids" optimistic-lock="version" lazy="false">
<id name="issuer" type="string" length="32" column="issuer"/>
<version name="version" column="version" type="long"/>
<property name="next" type="long" column="next" not-null="true"/>
<property name="next" type="long" column="next_id" not-null="true"/>
</class>
<query name="ChildEntry.DeleteByParent">
<![CDATA[

View File

@ -192,16 +192,16 @@ public class ADMLuceneCategoryTest extends TestCase
catRBase = nodeService.createNode(catRoot, ContentModel.ASSOC_CATEGORIES, QName.createQName(TEST_NAMESPACE, "Region"), ContentModel.TYPE_CATEGORY).getChildRef();
catRBase = nodeService.createNode(catRoot, ContentModel.ASSOC_CATEGORIES, QName.createQName(TEST_NAMESPACE, "region"), ContentModel.TYPE_CATEGORY).getChildRef();
catROne = nodeService.createNode(catRBase, ContentModel.ASSOC_SUBCATEGORIES, QName.createQName(TEST_NAMESPACE, "Europe"), ContentModel.TYPE_CATEGORY).getChildRef();
catRTwo = nodeService.createNode(catRBase, ContentModel.ASSOC_SUBCATEGORIES, QName.createQName(TEST_NAMESPACE, "RestOfWorld"), ContentModel.TYPE_CATEGORY).getChildRef();
catRThree = nodeService.createNode(catRTwo, ContentModel.ASSOC_SUBCATEGORIES, QName.createQName(TEST_NAMESPACE, "US"), ContentModel.TYPE_CATEGORY).getChildRef();
nodeService.addChild(catRoot, catRBase, ContentModel.ASSOC_CATEGORIES, QName.createQName(TEST_NAMESPACE, "InvestmentRegion"));
nodeService.addChild(catRoot, catRBase, ContentModel.ASSOC_CATEGORIES, QName.createQName(TEST_NAMESPACE, "MarketingRegion"));
nodeService.addChild(catRoot, catRBase, ContentModel.ASSOC_CATEGORIES, QName.createQName(TEST_NAMESPACE, "investmentRegion"));
nodeService.addChild(catRoot, catRBase, ContentModel.ASSOC_CATEGORIES, QName.createQName(TEST_NAMESPACE, "marketingRegion"));
catACBase = nodeService.createNode(catRoot, ContentModel.ASSOC_CATEGORIES, QName.createQName(TEST_NAMESPACE, "AssetClass"), ContentModel.TYPE_CATEGORY).getChildRef();
catACBase = nodeService.createNode(catRoot, ContentModel.ASSOC_CATEGORIES, QName.createQName(TEST_NAMESPACE, "assetClass"), ContentModel.TYPE_CATEGORY).getChildRef();
catACOne = nodeService.createNode(catACBase, ContentModel.ASSOC_SUBCATEGORIES, QName.createQName(TEST_NAMESPACE, "Fixed"), ContentModel.TYPE_CATEGORY).getChildRef();
catACTwo = nodeService.createNode(catACBase, ContentModel.ASSOC_SUBCATEGORIES, QName.createQName(TEST_NAMESPACE, "Equity"), ContentModel.TYPE_CATEGORY).getChildRef();
catACThree = nodeService.createNode(catACTwo, ContentModel.ASSOC_SUBCATEGORIES, QName.createQName(TEST_NAMESPACE, "SpecialEquity"), ContentModel.TYPE_CATEGORY).getChildRef();
@ -277,7 +277,7 @@ public class ADMLuceneCategoryTest extends TestCase
model.createImport(NamespaceService.DICTIONARY_MODEL_1_0_URI, NamespaceService.DICTIONARY_MODEL_PREFIX);
model.createImport(NamespaceService.CONTENT_MODEL_1_0_URI, NamespaceService.CONTENT_MODEL_PREFIX);
regionCategorisationQName = QName.createQName(TEST_NAMESPACE, "Region");
regionCategorisationQName = QName.createQName(TEST_NAMESPACE, "region");
M2Aspect generalCategorisation = model.createAspect("test:" + regionCategorisationQName.getLocalName());
generalCategorisation.setParentName("cm:" + ContentModel.ASPECT_CLASSIFIABLE.getLocalName());
M2Property genCatProp = generalCategorisation.createProperty("test:region");
@ -289,7 +289,7 @@ public class ADMLuceneCategoryTest extends TestCase
genCatProp.setTokenisedInIndex(false);
genCatProp.setType("d:" + DataTypeDefinition.CATEGORY.getLocalName());
assetClassCategorisationQName = QName.createQName(TEST_NAMESPACE, "AssetClass");
assetClassCategorisationQName = QName.createQName(TEST_NAMESPACE, "assetClass");
M2Aspect assetClassCategorisation = model.createAspect("test:" + assetClassCategorisationQName.getLocalName());
assetClassCategorisation.setParentName("cm:" + ContentModel.ASPECT_CLASSIFIABLE.getLocalName());
M2Property acProp = assetClassCategorisation.createProperty("test:assetClass");
@ -301,7 +301,7 @@ public class ADMLuceneCategoryTest extends TestCase
acProp.setTokenisedInIndex(false);
acProp.setType("d:" + DataTypeDefinition.CATEGORY.getLocalName());
investmentRegionCategorisationQName = QName.createQName(TEST_NAMESPACE, "InvestmentRegion");
investmentRegionCategorisationQName = QName.createQName(TEST_NAMESPACE, "investmentRegion");
M2Aspect investmentRegionCategorisation = model.createAspect("test:" + investmentRegionCategorisationQName.getLocalName());
investmentRegionCategorisation.setParentName("cm:" + ContentModel.ASPECT_CLASSIFIABLE.getLocalName());
M2Property irProp = investmentRegionCategorisation.createProperty("test:investmentRegion");
@ -313,7 +313,7 @@ public class ADMLuceneCategoryTest extends TestCase
irProp.setTokenisedInIndex(false);
irProp.setType("d:" + DataTypeDefinition.CATEGORY.getLocalName());
marketingRegionCategorisationQName = QName.createQName(TEST_NAMESPACE, "MarketingRegion");
marketingRegionCategorisationQName = QName.createQName(TEST_NAMESPACE, "marketingRegion");
M2Aspect marketingRegionCategorisation = model.createAspect("test:" + marketingRegionCategorisationQName.getLocalName());
marketingRegionCategorisation.setParentName("cm:" + ContentModel.ASPECT_CLASSIFIABLE.getLocalName());
M2Property mrProp = marketingRegionCategorisation.createProperty("test:marketingRegion");
@ -388,7 +388,7 @@ public class ADMLuceneCategoryTest extends TestCase
searcher.setNamespacePrefixResolver(getNamespacePrefixReolsver(""));
ResultSet results;
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"//*\" AND (PATH:\"/test:AssetClass/test:Equity/member\" PATH:\"/test:MarketingRegion/member\")", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"//*\" AND (PATH:\"/test:assetClass/test:Equity/member\" PATH:\"/test:marketingRegion/member\")", null, null);
//printPaths(results);
assertEquals(9, results.length());
results.close();
@ -415,13 +415,13 @@ public class ADMLuceneCategoryTest extends TestCase
searcher.setNamespacePrefixResolver(getNamespacePrefixReolsver(""));
ResultSet results;
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:MarketingRegion\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:marketingRegion\"", null, null);
//printPaths(results);
assertEquals(1, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:MarketingRegion//member\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:marketingRegion//member\"", null, null);
//printPaths(results);
assertEquals(6, results.length());
results.close();
@ -438,72 +438,72 @@ public class ADMLuceneCategoryTest extends TestCase
assertEquals(1, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/cm:categoryContainer/cm:categoryRoot/test:AssetClass\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/cm:categoryContainer/cm:categoryRoot/test:assetClass\"", null, null);
assertEquals(1, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/cm:categoryContainer/cm:categoryRoot/test:AssetClass/member\" ", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/cm:categoryContainer/cm:categoryRoot/test:assetClass/member\" ", null, null);
assertEquals(1, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/cm:categoryContainer/cm:categoryRoot/test:AssetClass/test:Fixed\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/cm:categoryContainer/cm:categoryRoot/test:assetClass/test:Fixed\"", null, null);
assertEquals(1, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/cm:categoryContainer/cm:categoryRoot/test:AssetClass/test:Equity\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/cm:categoryContainer/cm:categoryRoot/test:assetClass/test:Equity\"", null, null);
assertEquals(1, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:AssetClass\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:assetClass\"", null, null);
assertEquals(1, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:AssetClass/test:Fixed\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:assetClass/test:Fixed\"", null, null);
assertEquals(1, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:AssetClass/test:Equity\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:assetClass/test:Equity\"", null, null);
assertEquals(1, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:AssetClass/test:*\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:assetClass/test:*\"", null, null);
assertEquals(2, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:AssetClass//test:*\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:assetClass//test:*\"", null, null);
assertEquals(3, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:AssetClass/test:Fixed/member\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:assetClass/test:Fixed/member\"", null, null);
//printPaths(results);
assertEquals(8, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:AssetClass/test:Equity/member\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:assetClass/test:Equity/member\"", null, null);
//printPaths(results);
assertEquals(8, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:AssetClass/test:Equity/test:SpecialEquity/member//.\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:assetClass/test:Equity/test:SpecialEquity/member//.\"", null, null);
assertEquals(1, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:AssetClass/test:Equity/test:SpecialEquity/member//*\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:assetClass/test:Equity/test:SpecialEquity/member//*\"", null, null);
assertEquals(0, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:AssetClass/test:Equity/test:SpecialEquity/member\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:assetClass/test:Equity/test:SpecialEquity/member\"", null, null);
assertEquals(1, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "+PATH:\"/test:AssetClass/test:Equity/member\" AND +PATH:\"/test:AssetClass/test:Fixed/member\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "+PATH:\"/test:assetClass/test:Equity/member\" AND +PATH:\"/test:assetClass/test:Fixed/member\"", null, null);
//printPaths(results);
assertEquals(3, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:AssetClass/test:Equity/member\" PATH:\"/test:AssetClass/test:Fixed/member\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:assetClass/test:Equity/member\" PATH:\"/test:assetClass/test:Fixed/member\"", null, null);
//printPaths(results);
assertEquals(13, results.length());
results.close();
@ -512,52 +512,52 @@ public class ADMLuceneCategoryTest extends TestCase
assertEquals(4, nodeService.getChildAssocs(catRoot).size());
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:Region\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:region\"", null, null);
//printPaths(results);
assertEquals(1, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:Region/member\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:region/member\"", null, null);
//printPaths(results);
assertEquals(1, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:Region/test:Europe/member\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:region/test:Europe/member\"", null, null);
//printPaths(results);
assertEquals(2, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:Region/test:RestOfWorld/member\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:region/test:RestOfWorld/member\"", null, null);
//printPaths(results);
assertEquals(2, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:Region//member\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:region//member\"", null, null);
//printPaths(results);
assertEquals(5, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:InvestmentRegion//member\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:investmentRegion//member\"", null, null);
//printPaths(results);
assertEquals(5, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:MarketingRegion//member\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:marketingRegion//member\"", null, null);
//printPaths(results);
assertEquals(6, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "+PATH:\"/test:AssetClass/test:Fixed/member\" AND +PATH:\"/test:Region/test:Europe/member\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "+PATH:\"/test:assetClass/test:Fixed/member\" AND +PATH:\"/test:region/test:Europe/member\"", null, null);
//printPaths(results);
assertEquals(2, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "+PATH:\"/cm:categoryContainer/cm:categoryRoot/test:AssetClass/test:Fixed/member\" AND +PATH:\"/cm:categoryContainer/cm:categoryRoot/test:Region/test:Europe/member\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "+PATH:\"/cm:categoryContainer/cm:categoryRoot/test:assetClass/test:Fixed/member\" AND +PATH:\"/cm:categoryContainer/cm:categoryRoot/test:region/test:Europe/member\"", null, null);
//printPaths(results);
assertEquals(2, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:AssetClass/test:Equity/member\" PATH:\"/test:MarketingRegion/member\"", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/test:assetClass/test:Equity/member\" PATH:\"/test:marketingRegion/member\"", null, null);
//printPaths(results);
assertEquals(9, results.length());
results.close();
@ -585,11 +585,11 @@ public class ADMLuceneCategoryTest extends TestCase
ResultSet
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/cm:categoryContainer/cm:categoryRoot/test:AssetClass/*\" ", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/cm:categoryContainer/cm:categoryRoot/test:assetClass/*\" ", null, null);
assertEquals(3, results.length());
results.close();
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/cm:categoryContainer/cm:categoryRoot/test:AssetClass/member\" ", null, null);
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "PATH:\"/cm:categoryContainer/cm:categoryRoot/test:assetClass/member\" ", null, null);
assertEquals(1, results.length());
results.close();
@ -629,7 +629,7 @@ public class ADMLuceneCategoryTest extends TestCase
assertEquals(2, result.size());
result = impl.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass"), CategoryService.Depth.IMMEDIATE);
result = impl.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass"), CategoryService.Depth.IMMEDIATE);
assertEquals(2, result.size());
@ -666,42 +666,42 @@ public class ADMLuceneCategoryTest extends TestCase
assertEquals(3, categoryService.getChildren(catACBase , CategoryService.Mode.SUB_CATEGORIES, CategoryService.Depth.ANY).size());
assertEquals(17, categoryService.getChildren(catACBase , CategoryService.Mode.ALL, CategoryService.Depth.ANY).size());
assertEquals(2, categoryService.getClassifications(rootNodeRef.getStoreRef()).size());
assertEquals(2, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass"), CategoryService.Depth.IMMEDIATE).size());
assertEquals(3, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass"), CategoryService.Depth.ANY).size());
assertEquals(2, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass"), CategoryService.Depth.IMMEDIATE).size());
assertEquals(3, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass"), CategoryService.Depth.ANY).size());
assertEquals(7, categoryService.getClassificationAspects().size());
assertEquals(2, categoryService.getRootCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass")).size());
assertEquals(2, categoryService.getRootCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass")).size());
NodeRef newRoot = categoryService.createRootCategory(rootNodeRef.getStoreRef(),QName.createQName(TEST_NAMESPACE, "AssetClass"), "Fruit");
NodeRef newRoot = categoryService.createRootCategory(rootNodeRef.getStoreRef(),QName.createQName(TEST_NAMESPACE, "assetClass"), "Fruit");
tx.commit();
tx = transactionService.getUserTransaction();
tx.begin();
assertEquals(3, categoryService.getRootCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass")).size());
assertEquals(3, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass"), CategoryService.Depth.IMMEDIATE).size());
assertEquals(4, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass"), CategoryService.Depth.ANY).size());
assertEquals(3, categoryService.getRootCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass")).size());
assertEquals(3, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass"), CategoryService.Depth.IMMEDIATE).size());
assertEquals(4, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass"), CategoryService.Depth.ANY).size());
NodeRef newCat = categoryService.createCategory(newRoot, "Banana");
tx.commit();
tx = transactionService.getUserTransaction();
tx.begin();
assertEquals(3, categoryService.getRootCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass")).size());
assertEquals(3, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass"), CategoryService.Depth.IMMEDIATE).size());
assertEquals(5, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass"), CategoryService.Depth.ANY).size());
assertEquals(3, categoryService.getRootCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass")).size());
assertEquals(3, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass"), CategoryService.Depth.IMMEDIATE).size());
assertEquals(5, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass"), CategoryService.Depth.ANY).size());
categoryService.deleteCategory(newCat);
tx.commit();
tx = transactionService.getUserTransaction();
tx.begin();
assertEquals(3, categoryService.getRootCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass")).size());
assertEquals(3, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass"), CategoryService.Depth.IMMEDIATE).size());
assertEquals(4, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass"), CategoryService.Depth.ANY).size());
assertEquals(3, categoryService.getRootCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass")).size());
assertEquals(3, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass"), CategoryService.Depth.IMMEDIATE).size());
assertEquals(4, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass"), CategoryService.Depth.ANY).size());
categoryService.deleteCategory(newRoot);
tx.commit();
tx = transactionService.getUserTransaction();
tx.begin();
assertEquals(2, categoryService.getRootCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass")).size());
assertEquals(2, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass"), CategoryService.Depth.IMMEDIATE).size());
assertEquals(3, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "AssetClass"), CategoryService.Depth.ANY).size());
assertEquals(2, categoryService.getRootCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass")).size());
assertEquals(2, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass"), CategoryService.Depth.IMMEDIATE).size());
assertEquals(3, categoryService.getCategories(rootNodeRef.getStoreRef(), QName.createQName(TEST_NAMESPACE, "assetClass"), CategoryService.Depth.ANY).size());
tx.rollback();

View File

@ -128,12 +128,12 @@ public class AuthorityServiceTest extends TestCase
authenticationComponent.setCurrentUser("admin");
assertTrue(authorityService.hasAdminAuthority());
assertTrue(pubAuthorityService.hasAdminAuthority());
// assertEquals(2, authorityService.getAuthorities().size());
assertEquals(3, authorityService.getAuthorities().size());
authenticationComponent.setCurrentUser("administrator");
assertTrue(authorityService.hasAdminAuthority());
assertTrue(pubAuthorityService.hasAdminAuthority());
// assertEquals(2, authorityService.getAuthorities().size());
assertEquals(2, authorityService.getAuthorities().size());
}
public void testAuthorities()