Merge branch 'feature/RM-3708_LDAP_startup_error' into 'master'

Feature/rm 3708 ldap startup error

RM-3708 - [LDAP] Exception "NodeRef may not be null for calls to NodeService" is thrown in logs

The error is thrown when the application tries to run the disposition jobs as "$\{audit.rm.runas\}". When the value is not present in any property file the value is not interpreted.

This only reproduces when using some authentication chains because the authentication service is not reliable to check if a person exists. Some implementations of it just return true (AuthenticationServiceImpl) and some of them, in the best case scenario, reach person service to make the check.

As a fix I replaced authentication service with person service.

See merge request !378
This commit is contained in:
Ana Bozianu
2016-08-02 15:38:21 +01:00
3 changed files with 9 additions and 11 deletions

View File

@@ -85,7 +85,7 @@
<property name="nodeService" ref="nodeService" /> <property name="nodeService" ref="nodeService" />
<property name="searchService" ref="searchService" /> <property name="searchService" ref="searchService" />
<property name="authenticationService" ref="authenticationService" /> <property name="personService" ref="personService" />
<property name="recordsManagementActionService" ref="recordsManagementActionService" /> <property name="recordsManagementActionService" ref="recordsManagementActionService" />
</bean> </bean>

View File

@@ -43,7 +43,7 @@ import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.search.ResultSet; import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.SearchService; import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.cmr.security.AuthenticationService; import org.alfresco.service.cmr.security.PersonService;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@@ -74,8 +74,8 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
/** search service */ /** search service */
private SearchService searchService; private SearchService searchService;
/** authenticationService service */ /** person service */
private AuthenticationService authenticationService; private PersonService personService;
/** /**
* List of disposition actions to automatically execute when eligible. * List of disposition actions to automatically execute when eligible.
@@ -241,13 +241,13 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
} }
} }
public AuthenticationService getAuthenticationService() public PersonService getPersonService()
{ {
return authenticationService; return personService;
} }
public void setAuthenticationService(AuthenticationService authenticationService) public void setPersonService(PersonService personService)
{ {
this.authenticationService = authenticationService; this.personService = personService;
} }
} }

View File

@@ -129,10 +129,8 @@ public class RecordsManagementJob implements Job
if (jobExecuter instanceof DispositionLifecycleJobExecuter) if (jobExecuter instanceof DispositionLifecycleJobExecuter)
{ {
String auditUser = (String) context.getJobDetail().getJobDataMap().get("runAuditAs"); String auditUser = (String) context.getJobDetail().getJobDataMap().get("runAuditAs");
if (((DispositionLifecycleJobExecuter) jobExecuter).getAuthenticationService() if (((DispositionLifecycleJobExecuter) jobExecuter).getPersonService().getPersonOrNull(auditUser) != null)
.authenticationExists(auditUser))
{ {
setRunAuditAs(auditUser); setRunAuditAs(auditUser);
} }
else else