Merge V1.4 to HEAD

- Ignored Enterprise-specific changes
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@3701 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@3703 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@3704 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@3705 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@3707 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@3876 .
   svn revert root\projects\web-client\source\web\jsp\admin\admin-console.jsp


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3879 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2006-09-21 23:35:51 +00:00
parent 89f39cd176
commit d2bce74f0b
103 changed files with 3569 additions and 1172 deletions

View File

@@ -23,6 +23,7 @@ import java.net.UnknownHostException;
import java.util.Date;
import java.util.List;
import org.alfresco.repo.audit.model.TrueFalseUnset;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
import org.alfresco.service.Auditable;
@@ -123,13 +124,26 @@ public class AuditComponentImpl implements AuditComponent
{
if ((auditFlag.get() == null) || (!auditFlag.get().booleanValue()))
{
boolean auditInternal = (auditModel.getAuditInternalServiceMethods(mi) == TrueFalseUnset.TRUE);
try
{
auditFlag.set(Boolean.TRUE);
Method method = mi.getMethod();
String methodName = method.getName();
String serviceName = publicServiceIdentifier.getPublicServiceName(mi);
if (!auditInternal)
{
auditFlag.set(Boolean.TRUE);
}
else
{
if (s_logger.isDebugEnabled())
{
s_logger.debug("Auditing internal service use for - " + serviceName + "." + methodName);
}
}
if (method.isAnnotationPresent(Auditable.class))
{
@@ -170,7 +184,10 @@ public class AuditComponentImpl implements AuditComponent
}
finally
{
auditFlag.set(Boolean.FALSE);
if (!auditInternal)
{
auditFlag.set(Boolean.FALSE);
}
}
}
else
@@ -272,7 +289,7 @@ public class AuditComponentImpl implements AuditComponent
}
else if (returnObject instanceof StoreRef)
{
auditInfo.setKeyStore((StoreRef)returnObject);
auditInfo.setKeyStore((StoreRef) returnObject);
}
}
}

View File

@@ -16,6 +16,7 @@
*/
package org.alfresco.repo.audit;
import org.alfresco.repo.audit.model.TrueFalseUnset;
import org.aopalliance.intercept.MethodInvocation;
public interface MethodAuditModel
@@ -54,4 +55,11 @@ public interface MethodAuditModel
* @return
*/
public RecordOptions getAuditRecordOptions(MethodInvocation mi);
/**
* Should internal service class be logged.
*
* @return
*/
public TrueFalseUnset getAuditInternalServiceMethods(MethodInvocation mi);
}

View File

@@ -67,7 +67,7 @@
<!-- Date is used as the key for look up -->
<property name="date" column="date" type="date" index="adt_date_idx" not-null="true"/>
<property name="date" column="date_only" type="date" index="adt_date_idx" not-null="true"/>
<property name="dayOfYear" column="day_of_year" type="integer" index="adt_doy_idx" not-null="true"/>
<property name="dayOfMonth" column="day_of_month" type="integer" index="adt_dom_idx" not-null="true"/>
<property name="dayOfWeek" column="day_of_week" type="integer" index="adt_dow_idx" not-null="true"/>
@@ -135,24 +135,34 @@
<query name="audit.GetAuditSourceByApplication">
select
audit_store
audit_store_byid
from
org.alfresco.repo.audit.hibernate.AuditSourceImpl as audit_store_byid
where
audit_store_byid =
(select max(audit_store.id)
from
org.alfresco.repo.audit.hibernate.AuditSourceImpl as audit_store
where
audit_store.application = :application and
audit_store.service is null and
audit_store.method is null
audit_store.method is null)
</query>
<query name="audit.GetAuditSourceByApplicationServiceMethod">
select
audit_store
audit_store_byid
from
org.alfresco.repo.audit.hibernate.AuditSourceImpl as audit_store_byid
where
audit_store_byid =
(select max(audit_store.id)
from
org.alfresco.repo.audit.hibernate.AuditSourceImpl as audit_store
where
audit_store.application = :application and
audit_store.service = :service and
audit_store.method = :method
audit_store.method = :method)
</query>
<query name="audit.GetAuditTrailForNode">

View File

@@ -136,6 +136,49 @@ public abstract class AbstractAuditEntry
{
return recordOptions;
}
protected TrueFalseUnset getEffectiveAuditInternal()
{
TrueFalseUnset auditInternal;
if (checkEnabled() == TrueFalseUnset.TRUE)
{
auditInternal = getAuditInternalOrParentAuditInternal();
}
else
{
auditInternal = TrueFalseUnset.FALSE;
}
if(s_logger.isDebugEnabled())
{
s_logger.debug("... Effective audit internal is = "+auditInternal);
}
return auditInternal;
}
private TrueFalseUnset getAuditInternalOrParentAuditInternal()
{
TrueFalseUnset auditInternal = getAuditInternal();
if(s_logger.isDebugEnabled())
{
s_logger.debug("... ... audit internal is = "+auditInternal);
}
if (auditInternal == TrueFalseUnset.UNSET)
{
if (getParent() == null)
{
return TrueFalseUnset.UNSET;
}
else
{
return getParent().getAuditInternalOrParentAuditInternal();
}
}
else
{
return auditInternal;
}
}
protected AuditMode getEffectiveAuditMode()
{

View File

@@ -217,4 +217,23 @@ public class AuditEntry extends AbstractAuditEntry implements InitializingBean,
throw new UnsupportedOperationException();
}
public TrueFalseUnset getAuditInternalServiceMethods( MethodInvocation mi)
{
String serviceName = getPublicServiceIdentifier().getPublicServiceName(mi);
ServiceAuditEntry service = services.get(serviceName);
if(service != null)
{
return service.getAuditInternalServiceMethods( mi);
}
else
{
if(s_logger.isDebugEnabled())
{
s_logger.debug("No specific audit entry for service "+serviceName);
}
return getEffectiveAuditInternal();
}
}
}

View File

@@ -56,4 +56,13 @@ public class MethodAuditEntry extends AbstractNamedAuditEntry implements MethodA
throw new UnsupportedOperationException();
}
public TrueFalseUnset getAuditInternalServiceMethods(MethodInvocation mi)
{
if(s_logger.isDebugEnabled())
{
s_logger.debug("Evaluating if method is internally audited ..."+((ServiceAuditEntry)getParent()).getName()+"."+getName());
}
return getEffectiveAuditInternal();
}
}

View File

@@ -97,4 +97,22 @@ public class ServiceAuditEntry extends AbstractNamedAuditEntry implements Method
throw new UnsupportedOperationException();
}
public TrueFalseUnset getAuditInternalServiceMethods(MethodInvocation mi)
{
String methodName = mi.getMethod().getName();
MethodAuditEntry method = methods.get(methodName);
if (method != null)
{
return method.getAuditInternalServiceMethods(mi);
}
else
{
if(s_logger.isDebugEnabled())
{
s_logger.debug("Evaluating if service is internally audited (no specific setting) for "+getName()+"."+methodName);
}
return getEffectiveAuditInternal();
}
}
}