Hi Jeroen, Have you looked at the newAdhocQuery function? I am sure it must be possible to pass the XML contents as a query parameter (external variable). I would certainly recommend trying to prevent to make it a multiple request action, so not read permissions first and sending them back again. Permissions can change in meantime however unlikely.
You could also switch to an HTTP interface all together, using POST or PUT to send data, and just call a predefined xquery module.. ;-) Yes, there is no xdmp function to convert role id to role name (nor one to change user id into user name), but I personally have the idea that you are either doing some administrative task (for which you should assign more privileges), or you could be better off using default permissions (and collections).. Kind regards, Geert > Drs. G.P.H. Josten Consultant http://www.daidalos.nl/ Daidalos BV Source of Innovation Hoekeindsehof 1-4 2665 JZ Bleiswijk Tel.: +31 (0) 10 850 1200 Fax: +31 (0) 10 850 1199 http://www.daidalos.nl/ KvK 27164984 De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend. > From: [email protected] > [mailto:[email protected]] On Behalf Of > Jeroen Pulles > Sent: dinsdag 6 oktober 2009 17:04 > To: General Mark Logic Developer Discussion > Subject: [MarkLogic Dev General] Saving a document over XCC? > > Hi, > > I want to update an existing document, with its existing > permissions and collections, in XCC, but I'm stuck. > > In XQuery, I do this with > > xdmp:document-insert( > $uri, > <updated_doc_here/>, > xdmp:document-get-permissions($uri), > xdmp:document-get-collections($uri)) > > ... Or alternatively, I guess I could use xdmp:node-replace, > which doesn't seem to have an XCC equivalent. > > In XCC, ContentFactory.newContent can have a > ContentCreateOptions object. If I use a "default" > ContentCreateOptions object, I get errors[1]. I can create > that object with the relevant values by first doing a query > that retrieves permissions and collections. However, the > ContentPermission object in the options object needs a role > name, whereas xdmp:document-get-permissions returns role id's. > > The particular user that performs these operations, does not > have administrative privileges, so she can't access functions > like sec:get-role-names (on the security database). > > As far as I can tell, there is no way to get at the role names. > > ... Alternatively, I would have to trust the magic qualities > of ML and pass an entire document as string to a module that > does all the saving work for me. Which seems a brittle > solution, especially since I have no knowledge of the > particular content my XML documents will have (document size, > processing instructions, special characters, etcetera). It's > not going to be fast either, since it won't stream the > document content and need megabytes of heap size on the Java > application server per request. > > And how about if I want to use the DLS Library services, e.g. > dls:document-update; Would I be able to mix that with XCC? > > And so, I am wondering, how can I save a document over XCC? > > regards, > Jeroen > > [1] "Document must have at least one update permission"; This > particular user doesn't have default permissions/collection, > and I certainly don't want to reset the permissionss and > collections on save. > > -- > Jeroen Pulles > Xopus B.V., The Netherlands > > Xopus: The web based WYSIWYG XML Editor > _______________________________________________ > General mailing list > [email protected] > http://xqzone.com/mailman/listinfo/general > _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
