Revert "[MNT-23264] script execution error (#2900)" (#2912)

This reverts commit 58bad96724.
This commit is contained in:
Manish Kumar
2024-09-13 11:21:41 +05:30
committed by GitHub
parent a18861a4f6
commit 8a731dce40

View File

@@ -46,8 +46,6 @@ import org.alfresco.service.cmr.repository.ScriptLocation;
import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.security.PersonService; import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.util.UrlUtil; import org.alfresco.util.UrlUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Action to execute a JavaScript. The script has access to the default model. * Action to execute a JavaScript. The script has access to the default model.
@@ -58,10 +56,8 @@ import org.slf4j.LoggerFactory;
*/ */
public class ScriptActionExecuter extends ActionExecuterAbstractBase public class ScriptActionExecuter extends ActionExecuterAbstractBase
{ {
private static final Logger LOGGER = LoggerFactory.getLogger(ScriptActionExecuter.class);
public static final String NAME = "script"; public static final String NAME = "script";
public static final String PARAM_SCRIPTREF = "script-ref"; public static final String PARAM_SCRIPTREF = "script-ref";
private static final String SYSTEM_USER = "System";
private ServiceRegistry serviceRegistry; private ServiceRegistry serviceRegistry;
private SysAdminParams sysAdminParams; private SysAdminParams sysAdminParams;
@@ -156,11 +152,6 @@ public class ScriptActionExecuter extends ActionExecuterAbstractBase
{ {
// get the references we need to build the default scripting data-model // get the references we need to build the default scripting data-model
String userName = this.serviceRegistry.getAuthenticationService().getCurrentUserName(); String userName = this.serviceRegistry.getAuthenticationService().getCurrentUserName();
if (SYSTEM_USER.equals(userName))
{
LOGGER.info("Skipping Script Execution for the System user.");
return;
}
NodeRef personRef = this.personService.getPerson(userName); NodeRef personRef = this.personService.getPerson(userName);
NodeRef homeSpaceRef = (NodeRef)nodeService.getProperty(personRef, ContentModel.PROP_HOMEFOLDER); NodeRef homeSpaceRef = (NodeRef)nodeService.getProperty(personRef, ContentModel.PROP_HOMEFOLDER);