diff --git a/config/alfresco/authentication-services-context.xml b/config/alfresco/authentication-services-context.xml
index 46ebf00c5c..ee1e2de81b 100644
--- a/config/alfresco/authentication-services-context.xml
+++ b/config/alfresco/authentication-services-context.xml
@@ -306,6 +306,7 @@
+
diff --git a/source/java/org/alfresco/repo/security/person/PersonServiceImpl.java b/source/java/org/alfresco/repo/security/person/PersonServiceImpl.java
index 10a44b6fae..a74da296ac 100644
--- a/source/java/org/alfresco/repo/security/person/PersonServiceImpl.java
+++ b/source/java/org/alfresco/repo/security/person/PersonServiceImpl.java
@@ -22,6 +22,7 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
+import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
@@ -31,6 +32,8 @@ import java.util.Set;
import java.util.StringTokenizer;
import org.alfresco.error.AlfrescoRuntimeException;
+import org.alfresco.events.types.Event;
+import org.alfresco.events.types.UserManagementEvent;
import org.alfresco.model.ContentModel;
import org.alfresco.query.CannedQueryFactory;
import org.alfresco.query.CannedQueryResults;
@@ -40,6 +43,8 @@ import org.alfresco.repo.action.executer.MailActionExecuter;
import org.alfresco.repo.cache.SimpleCache;
import org.alfresco.repo.cache.TransactionalCache;
import org.alfresco.repo.domain.permissions.AclDAO;
+import org.alfresco.repo.events.EventPreparator;
+import org.alfresco.repo.events.EventPublisher;
import org.alfresco.repo.node.NodeServicePolicies;
import org.alfresco.repo.node.NodeServicePolicies.BeforeCreateNodePolicy;
import org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy;
@@ -148,6 +153,7 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
private String duplicateMode = LEAVE;
private boolean lastIsBest = true;
private boolean includeAutoCreated = false;
+ private EventPublisher eventPublisher;
private NamedObjectRegistry> cannedQueryRegistry;
@@ -972,7 +978,7 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
getPeopleContainer(),
ContentModel.ASSOC_CHILDREN,
getChildNameLower(userName), // Lowercase:
- ContentModel.TYPE_PERSON, properties).getChildRef();
+ ContentModel.TYPE_PERSON, properties).getChildRef();
}
finally
{
@@ -1752,6 +1758,8 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
{
makeHomeFolderAsSystem(childAssocRef);
}
+
+ reportEvent("user.create", this.nodeService.getProperties(personRef));
}
private QName getChildNameLower(String userName)
@@ -1982,6 +1990,28 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
throw new UnsupportedOperationException("The user name on a person can not be changed");
}
}
+
+ reportEvent("user.update", after);
+ }
+
+
+ private void reportEvent(String eventType, Map properties)
+ {
+ if(properties == null) return;
+
+ final String managedUsername = (String)properties.get(ContentModel.PROP_USERNAME);
+ final String managedFirstname = (String)properties.get(ContentModel.PROP_FIRSTNAME);
+ final String managedLastname = (String)properties.get(ContentModel.PROP_LASTNAME);
+ final String eventTType = eventType;
+
+ eventPublisher.publishEvent(new EventPreparator(){
+ @Override
+ public Event prepareEvent(String user, String networkId, String transactionId)
+ {
+ return new UserManagementEvent(eventTType , transactionId, networkId,new Date().getTime(),
+ user, managedUsername,managedFirstname,managedLastname);
+ }
+ });
}
/**
@@ -2141,4 +2171,11 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
return true;
}
+
+ public void setEventPublisher(EventPublisher eventPublisher)
+ {
+ this.eventPublisher = eventPublisher;
+ }
+
+
}
\ No newline at end of file