*
* @throws Exception
*/
public void testAclImportDocumentView() throws Exception
{
AccessManager accessManager = ((SessionImpl)root.getSession()).getAccessManager();
NodeImpl testRoot = (NodeImpl)root.addNode("TestRoot", "exo:article");
testRoot.addMixin("exo:owneable");
testRoot.addMixin("exo:privilegeable");
testRoot.setProperty("exo:title", "test");
session.save();
assertTrue(accessManager.hasPermission(testRoot.getACL(), PermissionType.SET_PROPERTY, new Identity("exo")));
testRoot.setPermission(testRoot.getSession().getUserID(), PermissionType.ALL);
testRoot.setPermission("exo", new String[]{PermissionType.SET_PROPERTY});
testRoot.removePermission(SystemIdentity.ANY);
session.save();
assertTrue(accessManager.hasPermission(testRoot.getACL(), PermissionType.SET_PROPERTY, new Identity("exo")));
assertFalse(accessManager.hasPermission(testRoot.getACL(), PermissionType.READ, new Identity("exo")));
File tmp = File.createTempFile("testAclImpormt", "tmp");
tmp.deleteOnExit();
serialize(testRoot, false, true, tmp);
testRoot.remove();
session.save();
NodeImpl importRoot = (NodeImpl)root.addNode("ImportRoot");
deserialize(importRoot, XmlSaveType.SESSION, true, ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING,
new BufferedInputStream(new FileInputStream(tmp)));
session.save();
Node n1 = importRoot.getNode("TestRoot");
assertTrue("Wrong ACL", accessManager.hasPermission(((NodeImpl)n1).getACL(), PermissionType.SET_PROPERTY,
new Identity("exo")));
assertFalse("Wrong ACL", accessManager.hasPermission(((NodeImpl)n1).getACL(), PermissionType.READ, new Identity(
"exo")));
importRoot.remove();
session.save();
}