[opencms-dev] Suggestion: make CmsUser available in I_CmsWidget / A_Widget

Michael Moossen m.moossen at alkacon.com
Fri May 1 09:33:38 CEST 2009


Hi Mathias!

This should be possible out of the box since the method that generates 
the widget code:
String I_CmsWidget#getDialogWidget(CmsObject, I_CmsWidgetDialog, 
I_CmsWidgetParameter);
as well as many other methods of I_CmsWidget get the cms context as 
parameter.
having the cms context you also have the user with 
cms.getRequesdtContext.currentUser()

Kind Regards,
Michael.

-------------------
Michael Moossen

Alkacon Software GmbH  - The OpenCms Experts
http://www.alkacon.com - http://www.opencms.org

Visit OpenCms Days 2009 Conference and Expo
June 15 to June 16 2009 in Cologne, Germany
http://www.opencms-days.org

Mathias Lin | SYSVISION wrote:
> Hi Alkacon,
> 
> I needed a custom widget (derived from simple text input widget
> CmsInputWidget), that is either read-only or read-write depending on the
> current user/current user's groups.
> Therefore I added setter and getter for CmsUser in I_CmsWidget and
> A_CmsWidget and pass the user from the editor to the widget (in my case I do
> it in the constructor public CmsXmlContentEditor(CmsJspActionElement jsp) of
> CmsXmlContentEditor.
> 
> I find it helpful and can imagine it's very useful in many cases (especially
> for custom widgets) to have the current user available in the widget class
> to implement custom behaviours of the widgets.
> Therefore my question if it wouldn't be good to add/modify this in the
> OpenCms core?
> 
> Mathias
> 
> 
> 
> -----
> Mathias Lin
> SYSVISION Ltd., China
> http://www.sysvision.com



More information about the opencms-dev mailing list