MgnlContext.doInSystemContext()

On Mar 12, 2009, at 5:51 PM, Matteo Pelucco wrote:


Will Scheidegger ha scritto:
You can access the repository as superuser:
HierarchyManager hm = MgnlContext.getSystemContext().getHierarchyManager("website");
   // and then do something with hm
Does this help?

I don't think: I need to launch a workflow command (an simpler version
of standard workflow) from the front end.

I manager to do this from AdminInterface, changing the command chain
"activate" and my workflow runs well.

But when I try to launch the workflow from a taglib with this code:

// user swap
User loggedUser = MgnlContext.getUser();
MgnlContext.login(Security.getSystemUser());            // ***
Context ctx = MgnlContext.getInstance();
                
ActivationFlowCommand cmd = new ActivationFlowCommand();
cmd.setRepository("website");
cmd.setPath(fullArticlePath);
cmd.setWorkflowName("directActivation");

I see an exception: can not read workflow definition [directActivation]

But if I omit // *** I can read the wf definition, but other errors
occurs (like




-will
On 12.03.2009, at 17:06, Matteo Pelucco wrote:

Hi all,
is it possible to force an action / command be executed as superuser?

Something like:

// user swap
User loggedUser = MgnlContext.getUser();

MgnlContext.login(Security.getSystemUser());

[... superuser actions ...]

// user swap
MgnlContext.login(loggedUser);

?
Thanks..
Matteo



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

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



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


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

Reply via email to