mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Taught AVM to be aware of the current user for tracking creator,
modifier, etc. AVM nodes can have ACLs. Not used for anything yet. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3657 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -973,7 +973,7 @@
|
||||
|
||||
<!-- The AVMService -->
|
||||
|
||||
<bean id="AVMService" class="org.alfresco.repo.avm.AVMServiceImpl" init-method="init">
|
||||
<bean id="AVMService" class="org.alfresco.repo.avm.AVMServiceImpl">
|
||||
<property name="retryingTransaction">
|
||||
<ref bean="retryingTransaction"/>
|
||||
</property>
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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();
|
||||
}
|
@@ -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;
|
||||
|
||||
@@ -56,6 +57,11 @@ abstract class AVMNodeImpl implements AVMNode, Serializable
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -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);
|
||||
|
@@ -41,6 +41,9 @@
|
||||
<property name="accessDate" type="long" not-null="true"/>
|
||||
</component>
|
||||
<property name="isRoot" column="is_root" type="boolean"/>
|
||||
<!-- ACL -->
|
||||
<many-to-one name="acl" column="acl_id"
|
||||
class="org.alfresco.repo.domain.hibernate.DbAccessControlListImpl"/>
|
||||
<!-- Directories, two flavors. -->
|
||||
<subclass name="DirectoryNodeImpl"
|
||||
proxy="DirectoryNode"
|
||||
|
Reference in New Issue
Block a user