mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
RM-5012 - revert policy fix and add record aspect on first event
This commit is contained in:
@@ -38,7 +38,6 @@
|
||||
|
||||
<bean id="writeContentPolicy" parent="basePolicy" class="org.alfresco.module.org_alfresco_module_rm.capability.policy.WriteContentPolicy">
|
||||
<property name="name" value="WriteContent"/>
|
||||
<property name="transactionalResourceHelper" ref="rm.transactionalResourceHelper" />
|
||||
</bean>
|
||||
|
||||
<bean id="declarePolicy" parent="basePolicy" class="org.alfresco.module.org_alfresco_module_rm.capability.policy.DeclarePolicy">
|
||||
|
@@ -27,46 +27,19 @@
|
||||
|
||||
package org.alfresco.module.org_alfresco_module_rm.capability.policy;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.record.RecordServiceImpl;
|
||||
import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
|
||||
import net.sf.acegisecurity.vote.AccessDecisionVoter;
|
||||
|
||||
public class WriteContentPolicy extends AbstractBasePolicy
|
||||
{
|
||||
protected TransactionalResourceHelper transactionalResourceHelper;
|
||||
|
||||
public void setTransactionalResourceHelper(TransactionalResourceHelper transactionalResourceHelper)
|
||||
{
|
||||
this.transactionalResourceHelper = transactionalResourceHelper;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public int evaluate(
|
||||
MethodInvocation invocation,
|
||||
Class[] params,
|
||||
ConfigAttributeDefinition cad)
|
||||
{
|
||||
try{
|
||||
NodeRef updatee = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent());
|
||||
Set<NodeRef> newRecords = transactionalResourceHelper.getSet(RecordServiceImpl.KEY_NEW_RECORDS);
|
||||
if(newRecords.contains(updatee))
|
||||
{
|
||||
return AccessDecisionVoter.ACCESS_GRANTED;
|
||||
}
|
||||
else
|
||||
{
|
||||
return getCapabilityService().getCapability("WriteContent").evaluate(updatee);
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -485,6 +485,7 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
||||
validateLinkConditions(nodeRef, parentNodeRef);
|
||||
}
|
||||
}
|
||||
nodeService.addAspect(nodeRef, RecordsManagementModel.ASPECT_RECORD, null);
|
||||
}
|
||||
}
|
||||
catch (RecordLinkRuntimeException e)
|
||||
|
Reference in New Issue
Block a user