mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM: Fix up "Access Denied" issues when sending record reject notification email
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@46459 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -61,7 +61,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<table cellpadding="2" cellspacing="0" border="0">
|
<table cellpadding="2" cellspacing="0" border="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td><b>${args.record.properties["rma:identifier"]!} ${args.record.name}</b></td>
|
<td><b>${args.recordId} ${args.recordName}</b></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Click on this link to view the record:</td>
|
<td>Click on this link to view the record:</td>
|
||||||
|
@@ -26,6 +26,7 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
|
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
|
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
|
||||||
@@ -309,7 +310,7 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
|
|||||||
*
|
*
|
||||||
* @param record rejected record
|
* @param record rejected record
|
||||||
*/
|
*/
|
||||||
public void recordRejectedEmailNotification(NodeRef record)
|
public void recordRejectedEmailNotification(NodeRef record, String recordId)
|
||||||
{
|
{
|
||||||
ParameterCheck.mandatory("record", record);
|
ParameterCheck.mandatory("record", record);
|
||||||
|
|
||||||
@@ -320,14 +321,17 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
|
|||||||
String rejectReason = (String) nodeService.getProperty(record, PROP_RECORD_REJECTION_REASON);
|
String rejectReason = (String) nodeService.getProperty(record, PROP_RECORD_REJECTION_REASON);
|
||||||
String rejectedPerson = (String) nodeService.getProperty(record, PROP_RECORD_REJECTION_USER_ID);
|
String rejectedPerson = (String) nodeService.getProperty(record, PROP_RECORD_REJECTION_USER_ID);
|
||||||
Date rejectDate = (Date) nodeService.getProperty(record, PROP_RECORD_REJECTION_DATE);
|
Date rejectDate = (Date) nodeService.getProperty(record, PROP_RECORD_REJECTION_DATE);
|
||||||
|
String recordName = (String) nodeService.getProperty(record, ContentModel.PROP_NAME);
|
||||||
|
|
||||||
Map<String, Serializable> args = new HashMap<String, Serializable>(6);
|
Map<String, Serializable> args = new HashMap<String, Serializable>(8);
|
||||||
args.put("record", record);
|
args.put("record", record);
|
||||||
args.put("site", site);
|
args.put("site", site);
|
||||||
args.put("recordCreator", recordCreator);
|
args.put("recordCreator", recordCreator);
|
||||||
args.put("rejectReason", rejectReason);
|
args.put("rejectReason", rejectReason);
|
||||||
args.put("rejectedPerson", rejectedPerson);
|
args.put("rejectedPerson", rejectedPerson);
|
||||||
args.put("rejectDate", rejectDate);
|
args.put("rejectDate", rejectDate);
|
||||||
|
args.put("recordId", recordId);
|
||||||
|
args.put("recordName", recordName);
|
||||||
|
|
||||||
NotificationContext notificationContext = new NotificationContext();
|
NotificationContext notificationContext = new NotificationContext();
|
||||||
notificationContext.setAsyncNotification(true);
|
notificationContext.setAsyncNotification(true);
|
||||||
|
@@ -21,7 +21,6 @@ package org.alfresco.module.org_alfresco_module_rm.record;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -41,9 +40,9 @@ import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagement
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService;
|
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordServiceImpl;
|
import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordServiceImpl;
|
||||||
import org.alfresco.repo.node.NodeServicePolicies;
|
import org.alfresco.repo.node.NodeServicePolicies;
|
||||||
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
|
||||||
import org.alfresco.repo.policy.JavaBehaviour;
|
import org.alfresco.repo.policy.JavaBehaviour;
|
||||||
import org.alfresco.repo.policy.PolicyComponent;
|
import org.alfresco.repo.policy.PolicyComponent;
|
||||||
|
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||||
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
||||||
@@ -368,8 +367,11 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
nodeService.addChild(parentAssoc.getParentRef(), nodeRef, parentAssoc.getTypeQName(), parentAssoc.getQName());
|
nodeService.addChild(parentAssoc.getParentRef(), nodeRef, parentAssoc.getTypeQName(), parentAssoc.getQName());
|
||||||
|
|
||||||
// set the extended security
|
// set the extended security
|
||||||
extendedSecurityService.addExtendedSecurity(nodeRef, readers, writers);
|
Set<String> combinedWriters = new HashSet<String>(writers);
|
||||||
extendedSecurityService.addExtendedSecurity(nodeRef, null, Collections.singleton(owner));
|
combinedWriters.add(owner);
|
||||||
|
combinedWriters.add(AuthenticationUtil.getFullyAuthenticatedUser());
|
||||||
|
|
||||||
|
extendedSecurityService.addExtendedSecurity(nodeRef, readers, combinedWriters);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@@ -521,6 +523,9 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
@Override
|
@Override
|
||||||
public Void doWork() throws Exception
|
public Void doWork() throws Exception
|
||||||
{
|
{
|
||||||
|
// take note of the record id
|
||||||
|
String recordId = (String)nodeService.getProperty(nodeRef, PROP_IDENTIFIER);
|
||||||
|
|
||||||
// first remove the secondary link association
|
// first remove the secondary link association
|
||||||
NodeRef originatingLocation = (NodeRef) nodeService.getProperty(nodeRef, PROP_RECORD_ORIGINATING_LOCATION);
|
NodeRef originatingLocation = (NodeRef) nodeService.getProperty(nodeRef, PROP_RECORD_ORIGINATING_LOCATION);
|
||||||
List<ChildAssociationRef> parentAssocs = nodeService.getParentAssocs(nodeRef);
|
List<ChildAssociationRef> parentAssocs = nodeService.getParentAssocs(nodeRef);
|
||||||
@@ -565,7 +570,7 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
ownableService.setOwner(nodeRef, documentOwner);
|
ownableService.setOwner(nodeRef, documentOwner);
|
||||||
|
|
||||||
// send an email to the record creator
|
// send an email to the record creator
|
||||||
notificationHelper.recordRejectedEmailNotification(nodeRef);
|
notificationHelper.recordRejectedEmailNotification(nodeRef, recordId);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user