Problem whith Privilege 'AddChildren' is not granted

Hi,

I created one document the type (MissionNotification in Studio) with Extends = Document and Category = Miscellaneous, this document will be created when the other Document change the life cycle.

For this, I created an EventHandler with the code below :

public void process ( DocumentModel doc , CoreSession session ) throws ClientException {
    doc.getPathAsString ();
    DocumentModel notified session.createDocumentModel = ( " / default -domain " , doc.getTitle ( ) , " MissionNotification " ) ;
    notifi.setPropertyValue ( " dc: title " , doc.getTitle ( ) ) ;
    notifi.setPropertyValue ( " missionnotification : mission ," doc.getId ( ) ) ;
    Doc.getCurrentLifeCycleState String state = ( ) ;
    notifi.setPropertyValue ( " missionnotification : state " , state) ;
    notifi.setPropertyValue ( " missionnotification : fromState ",  Utils.getFromStateOfMission ( state) ) ;
    notifi.setPropertyValue ( " missionnotification : contributors ",  doc.getPropertyValue ( "dc : contributors "));
    notifi.setPropertyValue ( " missionnotification : responsible", doc.getPropertyValue ( " Mission : mission_responsible "));
    session.createDocument notification ( notification ) ;
    session.saveDocument notification ( notification ) ;
    session.save ( ) ;
}

When I try to create my ( document ) = session.createDocument notification ( notification ) ;

happens the following error :

ERROR [ http - 0.0.0.0 - bio - 8080 - exec - 4 ] [ org.nuxeo.ecm.core.event.impl.EventServiceImpl ] Error during sync listener execution missionNotification , transaction will not be rolled back since event.markRollBack ( ) was not called by the Listener org.nuxeo.ecm.core.api.DocumentSecurityException : Privilege ' addChildren ' is not granted to ' user1 ' at org.nuxeo.ecm.core.api.AbstractSession.checkPermission ( AbstractSession.java : 306 ) at org.nuxeo.ecm.core.api.AbstractSession.createDocument ( AbstractSession.java : 879 ) at org.br.ezute.event.MissionNotificationEventHandler.process ( MissionNotificationEventHandler.java : 58) at org.br.ezute.event.MissionNotificationEventHandler.handleEvent(MissionNotificationEventHandler.java:33) at org.nuxeo.ecm.core.event.impl.EventServiceImpl.fireEvent ( EventServiceImpl.java : 215) at org.nuxeo.ecm.core.api.AbstractSession.fireEvent ( AbstractSession.java : 385 ) at org.nuxeo.ecm.core.api.AbstractSession.notifyEvent ( AbstractSession.java : 437)

Only works when I 'm logged in as user with Administrator permission

Could someone help me ?

0 votes

0 answers

1309 views

ANSWER

Hi,

I grant permission to Manage everything for my group, and I can only create task when I'm related with the administrator group. Follow my test:

String nxql = "SELECT * FROM Document WHERE ecm:mixinType = 'Task' AND ecm:currentLifeCycleState NOT IN ('ended', 'cancelled') AND ecm:isProxy = 0 AND ( nt:targetDocumentId = '"

            + getCurrentDocument().getId()
            + "' OR nt:targetDocumentsIds IN ('"
            + getCurrentDocument().getId() + "')) ";

    DocumentModelList tasks = documentManager.query(nxql);

Only returns the task when I'm in the group administrator

05/05/2014