[opencms-dev] Change property in action class

Popall, Enrico Enrico.Popall at softwareag.com
Wed Dec 16 17:08:41 CET 2009


Hi everybody

I'm trying to set a property of a resource inside of an action class
that listens to I_CmsEventListener.EVENT_RESOURCE_MODIFIED.
The problem is that once I'm not logged in as "Admin" I can't change
this property. The error message: Resource XYZ is not locked by current
user "Admin". Again, that happens when I'm not logged in as Admin. The
class works as expected if I login as Admin and modify the resource
then. Another user which also has root admin rights but is not named
"Admin" can't do it.

So my guess was that the system internally somehow switches the user
prior to firing the event.
cmsObject.getRequestContext().currentUser().getFullName() confirms this.
The context also tells me that it is in the Online project (which kinda
explains the Admin).

Any ideas how to get around this? Is there a way to change the lock of
this resource temporary and then set it back to it's original state? Or
overwrite a property since you are the admin in this situation anyway?
Or is there another way to catch events in the Offline project?

The whole task is to put the categories (relations --> assign
categories) in a property field that is indexable for the search. Maybe
I'm on a wrong path here and I don't need/can't to do this via the
action class. If someone has an idea, please let me know too.

Thanks and best regards

__________________________________
Enrico Popall
Software AG
Global Marketing
Uhlandstr.12, 64297 Darmstadt, Germany

Tel: +49 6151 922998

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20091216/72bf85c5/attachment.htm>


More information about the opencms-dev mailing list