RE: Portlet- or HttpServletRequest in DDMStorageAdapter.save(...)

Jamie Sammons, modified 3 Years ago. New Member Posts: 3 Join Date: 7/31/22 Recent Posts

Is it possible to get access to the Portlet- or HttpServletRequest in a DDMStorageAdapter.save(...) method?  I need the browser-client IP-address.

Ciao

Thorsten

thumbnail
Jamie Sammons, modified 3 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts

I don't think so - at least not every time: These APIs might as well be executed during batch execution, a timer, or other programmatic ways (e.g. in a Workflow), e.g. at times when there is no actual request - neither a Http- nor a Portlet-Request.

What's the problem you're trying to solve with that? If it's permission-related (e.g. only a certain IP-range can execute a certain function when logged in), I'd rather go with a "RoleContributor", which sets permissions programmatically. And then you can tie the permission for an operation to a role, which is granted or revoked based on the client's IP address.

Jamie Sammons, modified 3 Years ago. New Member Posts: 3 Join Date: 7/31/22 Recent Posts

Hi Olaf,

thank you for your answer. I've written my own CVS and Jira storage adapter as backend for forms. It would be nice to have the client ip included into the stored data. Maybe i could solve this problem via a custom form field.

Ciao

Thorsten

PS: I'm sorry i am not at the next CampusSource event.