[opencms-dev] Struts Integration

Kenneth Lewelling klewelling at curoalemanz.com
Sat Jan 18 02:33:10 CET 2003


Alex,
Looks like great info. I will play around with it and let you know if I have
any questions.

Thank you
Kenneth Lewelling

-----Original Message-----
From: owner-opencms-dev at www.opencms.org
[mailto:owner-opencms-dev at www.opencms.org]On Behalf Of Alexander
Kandzior
Sent: Friday, January 17, 2003 6:14 PM
To: opencms-dev at www.opencms.org
Subject: RE: [opencms-dev] Struts Integration


Kenneth,

I'm back with more details as promised.

To prevent the user from being able to delete a resource, the context
menu must not have the "delete" entry. This is easy to achive - for each
content type you will have a file in /system/workplace/restypes/ (in the
OpenCms VFS). Have a look at file /system/workplace/restypes/jsp. Check
out the line where "language_key(explorer.context.delete)" is used -
just remove it, and the "delete" action will disappear from the context
menu. So you should create a file here for your "action" resource and
just remove every functionality not needed. Copy one of the existing
files as a start.

Then you must make sure that there is no entry for your restype in the
"New" dialog which is shown when you click on the "magic wand" icon in
the explorer bar. Now this dialog is dynamically generated by a
JavaScript from the file
"/system/workplace/scripts/explorer_resource.js", which is just a hook
to the class "com.opencms.workplace.CmsExplorerResources" in this class
the contents of the /system/workplace/restypes/ directory is read and a
JavaScript in generated which will in turn generate the HTML page where
the user selects the "New" entry. You may somehow make sure that your
"action" resource is handled apropriatly here - maybe setting some file
permission (like "view" to "-" will already do the trick - this is how I
prevent the Joe user from generating JSP pages, which are restricted to
the Admin group.

You also might need to create you own implementation of
"com.opencms.file.I_CmsResourceType" for your action type to make sure
the core (not the interface) can handle all you need have a look at
"com.opencms.file.CmsResourceTypeJsp" for a simplistic implementation
for JSP. Usually, you inherit form
"com.opencms.file.CmsResourceTypePage" as this provides all required
basic functionality and just change what you need. Maybe you need to
overload the "deleteResource(CmsObject cms, String filename)" method to
prevent deletion of your action element.

I hope this helps a bit. Let me know if you make progess.


Best Regards,
Alex.

Alexander Kandzior
Alkacon Software - The OpenCms Experts
http://www.alkacon.com

> -----Original Message-----
> From: owner-opencms-dev at www.opencms.org
> [mailto:owner-opencms-dev at www.opencms.org] On Behalf Of
> Kenneth Lewelling
> Sent: Tuesday, January 14, 2003 3:25 AM
> To: opencms-dev at www.opencms.org
> Subject: RE: [opencms-dev] Struts Integration
>
>
>
> Please let me know if this is possible so that I don't waste
> a time doing something that is impossible. It has to do with
> creating a CmsLauncher for Struts actions (when I refer to
> actions I am realy refering to the url mapping to the action
> (ie map /logon.do to com.somepackage.logonaction)). I would
> like to figure out a way to use OpenCms's declarative
> security model for the Struts actions. The logical choice is
> to have the actions in the workplace. This would require a
> new OpenCms resouce (like jsp, xml template,
> text,etc) because these "action resouces" would have no
> content, they would be place-holders to allow declarative
> security. These "ation resouces" would need to be tightly
> managed through a Struts administrative interface so that
> they were not created or deleted in the workplace breaking
> the Struts application.  My question is, would it be possible
> to restrict users from create/deleting an "action resource"
> in the OpenCms workplace?
>
> Kenneth Lewelling
> http://opencmsstruts.sourceforge.net
>
> -----Original Message-----
> From: owner-opencms-dev at www.opencms.org
> [mailto:owner-opencms-dev at www.opencms.org]On > Behalf Of
> Alexander Kandzior
> Sent: Saturday, January 11, 2003 3:04 AM
> To: opencms-dev at www.opencms.org
> Subject: RE: [opencms-dev] Struts Integration
>
>
> Very good. I will try and help as much as I can.
>
> Best Regards,
> Alex.
>
> Alexander Kandzior
> Alkacon Software - The OpenCms Experts
> http://www.alkacon.com
>
>
>





More information about the opencms-dev mailing list