RM-1484 (User with Close Folders capability can't close the folder)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@71004 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2014-05-19 16:20:39 +00:00
parent c1d9a7a7ea
commit d479988de0

View File

@@ -32,6 +32,8 @@ import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.NamespaceService;
@@ -277,7 +279,7 @@ public class RecordFolderServiceImpl extends ServiceBaseImpl
{
ParameterCheck.mandatory("nodeRef", nodeRef);
if (recordService.isRecord(nodeRef))
if (isRecord(nodeRef))
{
ChildAssociationRef assocRef = nodeService.getPrimaryParent(nodeRef);
if (assocRef != null)
@@ -290,7 +292,18 @@ public class RecordFolderServiceImpl extends ServiceBaseImpl
{
if (!isRecordFolderClosed(nodeRef))
{
nodeService.setProperty(nodeRef, PROP_IS_CLOSED, true);
final NodeRef folderNodeRef = nodeRef;
// do the work of creating the record as the system user
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
{
@Override
public Void doWork() throws Exception
{
nodeService.setProperty(folderNodeRef, PROP_IS_CLOSED, true);
return null;
}
});
}
}
else