Hi Daniel,

You'll want to do it within a Op.doInSystemContext() call if not working within 
the session of an authenticated and adequately privileged user.

And you do need to have the magnolia filters (at least the basic ones) process 
the request, or there are many things that won't work.
It hardly seems reasonable to expect otherwise by the way - after all, your 
spring controllers would not work either without the associated filters, 
servlets and configuration... any framework depends on correct setup for 
correct execution, magnolia is no different from spring in this regard...

Regards from Vienna,

Richard



> -----Ursprüngliche Nachricht-----
> Von: [email protected] 
> [mailto:user-list-owner@magnolia- cms.com] Im Auftrag von Daniel Paval 
> (via Magnolia Forums)
> Gesendet: Donnerstag, 14. Jänner 2016 20:32
> An: Magnolia User List
> Betreff: [magnolia-user] Re: Create asset in Magnolia programatically
> 
> Hi Vincent, Nils,
> 
> Thank you both for your replies!
> 
> Before posting here I did look into ImportAssetZipCommand.createAsset 
> myself and assembled some code that compiled, but threw an access 
> denied exception at runtime. Which, unfortunatelly, is what happens at 
> line
> 
> [code]final Node resourceNode = JcrUtils.getOrAddNode(...)[/code]
> 
> above too:
> 
> [code]javax.jcr.AccessDeniedException: Access denied.
>       at
> org.apache.jackrabbit.core.security.DefaultAccessManager.checkPermissi
> on
> (DefaultAccessManager.java:193)
>       at
> org.apache.jackrabbit.core.NodeImpl.addNode(NodeImpl.java:1267)[/code]
> 
> So I have my own Spring DispatcherServlet defined in the <servlets> 
> section of my Magnolia module's XML descriptor. I'm not going through 
> any Magnolia page / components nor though the admincentral login, 
> though some part of the Magnolia filter chain does get executed. I 
> figure the exception might have to do with my particular setup / 
> servlet, though I can browse assets just fine in the same request / Spring 
> controller.
> 
> In any case, this is another Magnolia odity that again makes me want 
> to switch to a different CMS..
> 
> --
> Context is everything: http://forum.magnolia-
> cms.com/forum/thread.html?threadId=8a22aaec-21e8-487a-b0ee-
> 319409bd4fdb
> 
> 
> ----------------------------------------------------------------
> For list details, see http://www.magnolia-cms.com/community/mailing-
> lists.html
> Alternatively, use our forums: http://forum.magnolia-cms.com/ To 
> unsubscribe, E-mail to: <[email protected]>
> ----------------------------------------------------------------



----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to