[opencms-dev] Switch users and project programatically
Paul-Inge Flakstad
flakstad at npolar.no
Fri Apr 1 10:32:27 CEST 2011
Hi Mario,
OK, I'll do that then. Many thanks for the reply! ;)
Cheers,
Paul
> -----Original Message-----
> From: opencms-dev-bounces at opencms.org
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Mario Jäger
> Sent: 1. april 2011 09:18
> To: opencms-dev at opencms.org
> Subject: Re: [opencms-dev] Switch users and project programatically
>
> Hi Paul,
>
> It is better to get an independent copy of the provided
> CmsObject with:
>
> CmsObject copyCms = org.opencms.main.OpenCmsCore.initCmsObject(cms);
>
> On this independent copy of the CmsObject you can login as the
> administrator user then and change the project. After
> modifying files in
> the Vfs no further actions are necessary, because you have
> not changed
> the current CmsObject then.
>
> Kind Regards,
> Mario.
>
> Am 30.03.2011 22:06, schrieb Paul-Inge Flakstad:
> > Hi list,
> > I need to modify some files in the VFS programatically in a
> JSP, so I do
> > this:
> > if (cms.getRequestContext().currentProject().isOnlineProject()) {
> > cmso.loginUser("myadmin", "mypassword");
> >
> cmso.getRequestContext().setCurrentProject(cmso.readProject("O
> ffline"));
> > }
> > // Now I modify the files in the VFS
> > My questions:
> > 1.) Should I set the project to "Online" again, after I'm finished
> > modifying the files?
> > 2.) Do I also need to login the "Guest" user, to ensure
> regular guest
> > users do not get the privileges assigned to "myadmin" user?
> (How do I do
> > this?)
> > 3.) Is the order of loginUser() and setCurrentProject()
> correct? (First
> > login user and then set project?)
> > Appreciate any help! :)
> > Cheers,
> > Paul
> >
> >
> >
> >
> > _______________________________________________
> > This mail is sent to you from the opencms-dev mailing list
> > To change your list options, or to unsubscribe from the
> list, please visit
> > http://lists.opencms.org/mailman/listinfo/opencms-dev
>
>
> --
> -------------------
> Mario Jäger
>
> Visit OpenCms Days 2011 Conference and Expo
> May 9 to May 10 2011 in Cologne, Germany
> http://www.opencms-days.org
>
> Alkacon Software GmbH - The OpenCms Experts
> http://www.alkacon.com - http://www.opencms.org
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list,
> please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>
More information about the opencms-dev
mailing list