diff --git a/config/alfresco/public-services-context.xml b/config/alfresco/public-services-context.xml index 66b2aca4a2..f46ce74a31 100644 --- a/config/alfresco/public-services-context.xml +++ b/config/alfresco/public-services-context.xml @@ -973,7 +973,7 @@ - + diff --git a/source/java/org/alfresco/repo/avm/AVMContext.java b/source/java/org/alfresco/repo/avm/AVMContext.java index c36e949517..da23907dba 100644 --- a/source/java/org/alfresco/repo/avm/AVMContext.java +++ b/source/java/org/alfresco/repo/avm/AVMContext.java @@ -4,6 +4,7 @@ package org.alfresco.repo.avm; import org.alfresco.repo.content.ContentStore; +import org.alfresco.repo.security.authentication.AuthenticationComponent; import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.repository.ContentService; import org.alfresco.service.cmr.repository.MimetypeService; @@ -119,7 +120,7 @@ public class AVMContext implements ApplicationContextAware */ private NodeService fNodeService; - private AuthenticationService fAuthenticationService; + private AuthenticationComponent fAuthenticationComponent; /** * The application context. @@ -297,12 +298,12 @@ public class AVMContext implements ApplicationContextAware return fNodeService; } - public AuthenticationService getAuthenticationService() + public AuthenticationComponent getAuthenticationComponent() { - if (fAuthenticationService == null) + if (fAuthenticationComponent == null) { - fAuthenticationService = (AuthenticationService)fAppContext.getBean("AuthenticationService"); + fAuthenticationComponent = (AuthenticationComponent)fAppContext.getBean("authenticationComponent"); } - return fAuthenticationService; + return fAuthenticationComponent; } } diff --git a/source/java/org/alfresco/repo/avm/AVMNode.java b/source/java/org/alfresco/repo/avm/AVMNode.java index c3edd77a28..22fdd4b56e 100644 --- a/source/java/org/alfresco/repo/avm/AVMNode.java +++ b/source/java/org/alfresco/repo/avm/AVMNode.java @@ -18,6 +18,7 @@ package org.alfresco.repo.avm; import java.util.Map; +import org.alfresco.repo.domain.DbAccessControlList; import org.alfresco.repo.domain.PropertyValue; import org.alfresco.service.namespace.QName; @@ -171,4 +172,16 @@ interface AVMNode * Delete all properties from this node. */ public void deleteProperties(); + + /** + * Set an ACL on this node. + * @param acl The ACL to set. + */ + public void setAcl(DbAccessControlList acl); + + /** + * Get the ACL on this node. + * @return The ACL on this node. + */ + public DbAccessControlList getAcl(); } \ No newline at end of file diff --git a/source/java/org/alfresco/repo/avm/AVMNodeImpl.java b/source/java/org/alfresco/repo/avm/AVMNodeImpl.java index 2565c6e0d3..e7a6b7d6f6 100644 --- a/source/java/org/alfresco/repo/avm/AVMNodeImpl.java +++ b/source/java/org/alfresco/repo/avm/AVMNodeImpl.java @@ -22,6 +22,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.alfresco.repo.domain.DbAccessControlList; import org.alfresco.repo.domain.PropertyValue; import org.alfresco.service.namespace.QName; @@ -55,6 +56,11 @@ abstract class AVMNodeImpl implements AVMNode, Serializable * The rootness of this node. */ private boolean fIsRoot; + + /** + * The ACL on this node. + */ + private DbAccessControlList fACL; /** * Default constructor. @@ -75,9 +81,15 @@ abstract class AVMNodeImpl implements AVMNode, Serializable fVersionID = -1; fIsRoot = false; long time = System.currentTimeMillis(); - fBasicAttributes = new BasicAttributesImpl("britt", - "britt", - "britt", + String user = + AVMContext.fgInstance.getAuthenticationComponent().getCurrentUserName(); + if (user == null) + { + user = AVMContext.fgInstance.getAuthenticationComponent().getSystemUserName(); + } + fBasicAttributes = new BasicAttributesImpl(user, + user, + user, time, time, time); @@ -265,7 +277,14 @@ abstract class AVMNodeImpl implements AVMNode, Serializable */ public void updateModTime() { + String user = + AVMContext.fgInstance.getAuthenticationComponent().getCurrentUserName(); + if (user == null) + { + user = AVMContext.fgInstance.getAuthenticationComponent().getSystemUserName(); + } fBasicAttributes.setModDate(System.currentTimeMillis()); + fBasicAttributes.setLastModifier(user); } /** @@ -364,4 +383,22 @@ abstract class AVMNodeImpl implements AVMNode, Serializable { AVMContext.fgInstance.fAVMNodePropertyDAO.deleteAll(this); } + + /** + * Set the ACL on this node. + * @param acl The ACL to set. + */ + public void setAcl(DbAccessControlList acl) + { + fACL = acl; + } + + /** + * Get the ACL on this node. + * @return The ACL on this node. + */ + public DbAccessControlList getAcl() + { + return fACL; + } } diff --git a/source/java/org/alfresco/repo/avm/AVMServiceImpl.java b/source/java/org/alfresco/repo/avm/AVMServiceImpl.java index 3c3b5d6799..3da92ffec1 100644 --- a/source/java/org/alfresco/repo/avm/AVMServiceImpl.java +++ b/source/java/org/alfresco/repo/avm/AVMServiceImpl.java @@ -59,23 +59,6 @@ public class AVMServiceImpl implements AVMService { } - /** - * Final initialization of the service. Must be called only on a - * fully initialized instance. - */ - public void init() - { - try - { - createAVMStore("main"); - fgLogger.info("Created new main AVMStore"); - } - catch (AVMExistsException e) - { - fgLogger.info("AVMStore main already exists"); - } - } - /** * Set the Retrying Transaction wrapper. * @param txn diff --git a/source/java/org/alfresco/repo/avm/AVMServiceTestBase.java b/source/java/org/alfresco/repo/avm/AVMServiceTestBase.java index 6a717b27f6..16f2c70a47 100644 --- a/source/java/org/alfresco/repo/avm/AVMServiceTestBase.java +++ b/source/java/org/alfresco/repo/avm/AVMServiceTestBase.java @@ -19,7 +19,6 @@ package org.alfresco.repo.avm; import java.io.IOException; import java.io.PrintStream; -import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -69,6 +68,7 @@ public class AVMServiceTestBase extends TestCase fService = (AVMService)fContext.getBean("AVMService"); fReaper = (OrphanReaper)fContext.getBean("orphanReaper"); } + fService.createAVMStore("main"); fStartTime = System.currentTimeMillis(); } @@ -86,7 +86,6 @@ public class AVMServiceTestBase extends TestCase { fService.purgeAVMStore(desc.getName()); } - fService.createAVMStore("main"); // fContext.close(); // File alfData = new File("alf_data"); // File target = new File("alf_data" + now); diff --git a/source/java/org/alfresco/repo/avm/hibernate/AVM.hbm.xml b/source/java/org/alfresco/repo/avm/hibernate/AVM.hbm.xml index 9eda568cf3..28c6016a34 100644 --- a/source/java/org/alfresco/repo/avm/hibernate/AVM.hbm.xml +++ b/source/java/org/alfresco/repo/avm/hibernate/AVM.hbm.xml @@ -41,6 +41,9 @@ + +