APPS-322: [RM/AGS]User without permissions can create categories when Create full path option is checked in rule

This commit is contained in:
Raluca Munteanu
2020-11-06 11:21:26 +02:00
parent dc317b4265
commit e42a7fd9fb

View File

@@ -380,40 +380,26 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr
*/ */
private NodeRef createChild(final Action action, final NodeRef parent, final String childName, final boolean targetisUnfiledRecords, final boolean lastAsFolder) private NodeRef createChild(final Action action, final NodeRef parent, final String childName, final boolean targetisUnfiledRecords, final boolean lastAsFolder)
{ {
return AuthenticationUtil.runAsSystem(new RunAsWork<NodeRef>() // double check that the child hasn't been created by another thread
{ NodeRef child = getChild(parent, childName);
@Override if (child == null) {
public NodeRef doWork() if (targetisUnfiledRecords) {
{ // create unfiled folder
// double check that the child hasn't been created by another thread child = fileFolderService.create(parent, childName, RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER).getNodeRef();
NodeRef child = getChild(parent, childName); } else if (lastAsFolder) {
if (child == null) // create record folder
{ child = getRecordFolderService().createRecordFolder(parent, childName);
if (targetisUnfiledRecords) } else {
{ // ensure we are not trying to create a record category in a record folder
// create unfiled folder if (RecordsManagementModel.TYPE_RECORD_FOLDER.equals(getNodeService().getType(parent))) {
child = fileFolderService.create(parent, childName, RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER).getNodeRef(); throw new AlfrescoRuntimeException("Unable to execute " + action.getActionDefinitionName() + " action, because the destination path has a record category within a record folder.");
}
else if(lastAsFolder)
{
// create record folder
child = getRecordFolderService().createRecordFolder(parent, childName);
}
else
{
// ensure we are not trying to create a record categtory in a record folder
if(RecordsManagementModel.TYPE_RECORD_FOLDER.equals(getNodeService().getType(parent)))
{
throw new AlfrescoRuntimeException("Unable to execute " + action.getActionDefinitionName() + " action, because the destination path has a record category within a record folder.");
}
// create record category
child = filePlanService.createRecordCategory(parent, childName);
}
} }
return child;
// create record category
child = filePlanService.createRecordCategory(parent, childName);
} }
}); }
return child;
} }
/** /**