[opencms-dev] Visibility of the OpenCMS Object inside Struts Action

Maximiliano Basili matute.listas at gmail.com
Mon May 9 17:37:08 CEST 2005


Thanks Stephan !!
I still with a problem...

CmsObject cmso = OpenCms.initCmsObject("Guest");		
cmso.loginUser("Admin", "admin");

The problem is that when I try (after the befor lines) to create a resouce:
CmsResource cmsr = cmso.createResource("/folder/action-test/test1.html", 12);

I have this exception:
org.opencms.security.CmsSecurityException: Denied access to resource
'/folder/action-test/', required permis
sions are +w [Code 303 - No permissions to perform this operation]
        at org.opencms.db.CmsSecurityManager.checkPermissions(CmsSecurityManager.java:5023)
        at org.opencms.db.CmsSecurityManager.checkPermissions(CmsSecurityManager.java:4786)
        at org.opencms.db.CmsDriverManager.createResource(CmsDriverManager.java:1737)
        at org.opencms.db.CmsDriverManager.createResource(CmsDriverManager.java:1961)
        at org.opencms.db.CmsSecurityManager.createResource(CmsSecurityManager.java:1026)
        at org.opencms.file.types.A_CmsResourceType.createResource(A_CmsResourceType.java:323)
        at org.opencms.file.types.CmsResourceTypeXmlContent.createResource(CmsResourceTypeXmlContent.java:111)


thanks again!.

Matute

2005/5/9, Stephan Hartmann <hartmann at metamesh.de>:
> Maximiliano Basili schrieb:
> > org.opencms.main.OpenCms#initCmsObject("Guest"); ??
> >
> > Do you mean:
> > CmsObject cmso = org.opencms.main.OpenCms.initCmsObject("Guest"); ??
> >
> 
> cmso.loginUser("Admin", "admin");
> 
> Regards,
> Stephan
> 
> > But what about if I want to access with admin permissions??
> > After CmsObject creation I need to create resources but with "Guest",
> > I think it is not posible...
> > BTW thanks! for the answer I can keep reading in that way...
> > do you know how can I log-in with the Admin User or with other that
> > has permissions for create/update resources...
> >
> > thanks again.
> >
> > Matute
> >
> > 2005/5/3, Stephan Hartmann <hartmann at metamesh.de>:
> >
> >>You can create your own CmsObject with
> >>
> >>org.opencms.main.OpenCms#initCmsObject("Guest");
> >>
> >>But you have to make sure that your OpenCms servlet has been started before.
> >>
> >>Regards,
> >>Stephan
> >>
> >>--
> >>Stephan Hartmann
> >>
> >>metamesh
> >>
> >>Lippstädter Str. 22
> >>44143 Dortmund
> >>
> >>http://www.metamesh.de/
> >>
> >>Maximiliano Basili schrieb:
> >>
> >>>Hi all...
> >>>
> >>>I want to work with struts inisde opencms.
> >>>I have a Struts Action that has to create a resource so I need the
> >>>OpenCMS object,
> >>>
> >>>I want to know how can I access the opencms object inside that struts action,
> >>>I put some code that I test:
> >>>
> >>>      protected CmsObject getCmsObject(HttpServletRequest req)
> >>>                      throws ServletException {
> >>>              CmsFlexController controller = (CmsFlexController) req
> >>>                              .getAttribute(CmsFlexController.ATTRIBUTE_NAME);
> >>>
> >>>              if (controller == null) {
> >>>                      throw new ServletException(
> >>>                                      "OpenCmsStrutsAction could not obtain CmsObject! ATT_NAME ==> " +
> >>>CmsFlexController.ATTRIBUTE_NAME);
> >>>              } else
> >>>                      return controller.getCmsObject();
> >>>      }
> >>>
> >>>
> >>>The controller is null I think because for this point I can't reach
> >>>the OpenCMS Servlet so I can't access to the VFS....
> >>>
> >>>Any suggestions will be appreciated...
> >>>
> >>>Thanks in advance!!
> >>>
> >>>Matute (Matías Basilico)
> >>>
> >>>
> >>>_______________________________________________
> >>>This mail is send to you from the opencms-dev mailing list
> >>>To change your list options, or to unsubscribe from the list, please visit
> >>>http://mail.opencms.org/mailman/listinfo/opencms-dev
> >>
> >>
> >>
> >
> >
> 
> --
> Stephan Hartmann
> 
> metamesh
> 
> Lippstädter Str. 22
> 44143 Dortmund
> 
> http://www.metamesh.de/
> 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev
> 


-- 
Tutek.



More information about the opencms-dev mailing list