Skip to content

Commit

Permalink
NXP-7878: allow storing 'system' contributor for 'documentCreated' event
Browse files Browse the repository at this point in the history
  • Loading branch information
troger committed Feb 29, 2012
1 parent eb25f31 commit 5d52a06
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

package org.nuxeo.ecm.platform.dublincore.service;

import static org.nuxeo.ecm.core.api.event.DocumentEventTypes.DOCUMENT_CREATED;
import static org.nuxeo.ecm.core.api.security.SecurityConstants.SYSTEM_USERNAME;

import java.security.Principal;
Expand All @@ -27,9 +28,7 @@
import org.nuxeo.ecm.core.api.ClientException;
import org.nuxeo.ecm.core.api.ClientRuntimeException;
import org.nuxeo.ecm.core.api.DocumentModel;
import org.nuxeo.ecm.core.api.NuxeoPrincipal;
import org.nuxeo.ecm.core.api.SystemPrincipal;
import org.nuxeo.ecm.core.api.security.SecurityConstants;
import org.nuxeo.ecm.core.event.Event;
import org.nuxeo.ecm.core.schema.SchemaManager;
import org.nuxeo.runtime.api.Framework;
Expand Down Expand Up @@ -82,8 +81,8 @@ public void addContributor(DocumentModel doc, Event event) {
if (principal instanceof SystemPrincipal) {
SystemPrincipal nxp = (SystemPrincipal) principal;
String originatingUser = nxp.getOriginatingUser();
if (originatingUser == null
|| SYSTEM_USERNAME.equals(originatingUser)) {
if ((originatingUser == null || SYSTEM_USERNAME.equals(originatingUser))
&& !DOCUMENT_CREATED.equals(event.getName())) {
return;
} else {
principalName = originatingUser;
Expand Down

0 comments on commit 5d52a06

Please sign in to comment.