You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Martin Makundi <ma...@koodaripalvelut.com> on 2017/12/15 13:26:24 UTC

Re: How to automatically log access to data objects in wicket gui

> I think you will need custom specialization of those models anyway.
> You will need to decide somehow when to apply your logic and when not.
>

True, but a nice boilerplate template would be nice, we could call it "The
GDPR compliance <https://www.eugdpr.org/> model" ;)

It could have methods like isAuthorized before invoking get or set and log
if not authorized and throw exception.

When model access is authroized, it would have methods like logAccess()
which will log (as necessary) how and what is accessed. Logging
implementation will take care of optimizing frequent logs etc.

Possibly it could be applied to both propertymodel and lamba model as a
"model behavior" or something.

I made a jira proposal and we will submit something soon:
https://issues.apache.org/jira/browse/WICKET-6508

**
Martin


>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Fri, Dec 15, 2017 at 2:20 PM, Martin Makundi <
> martin.makundi@koodaripalvelut.com> wrote:
>
> > Thanks
> >
> > We don't want to log ALL invocations, only those in particular wicket
> > imodels. Aspect will give you all like a profiler, that's not what we
> want
> > and it would not have natural visibility to wicket session.
> >
> > Or do you have a specific example in mind?
> >
> > **
> > Martin
> >
> > 2017-12-15 9:54 GMT+02:00 Martin Grigorov <mg...@apache.org>:
> >
> > > Hi,
> > >
> > > You can use Aspect Oriented Programming for this too.
> > > See wicket-metrics module for example.
> > >
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > > https://twitter.com/mtgrigorov
> > >
> > > On Fri, Dec 15, 2017 at 7:57 AM, Martin Makundi <
> > > martin.makundi@koodaripalvelut.com> wrote:
> > >
> > > > Hi!
> > > >
> > > > We are investigating ways to automatically log access to data objects
> > in
> > > > wicket gui.
> > > >
> > > > Oldschool solutions would be, for example to override/customize
> > > > PropertyModel and log target object and method invoked, and possibly
> > > result
> > > > value, together with necessary information from session (timestamp,
> > user
> > > > id, authorization level, etc.).
> > > >
> > > > However, with wicket 8 and java 8 lambda possibilities, I am
> wondering
> > if
> > > > anybody would have some ingenious suggestion how to do this very
> nicely
> > > by
> > > > implementing own AuditTrailSerializableFunction or similar?
> > > >
> > > > Might need to wrap the data objects in some sort of proxy but that
> > would
> > > be
> > > > ok:
> > > >
> > > >    - https://gist.github.com/jhorstmann/de367a42a08d8deb8df9
> > > >    -
> > > >    https://stackoverflow.com/questions/13356326/how-can-i-
> > > > log-every-method-called-in-a-class-automatically-with-log4j
> > > >    -
> > > >    https://stackoverflow.com/questions/3291637/
> > > alternatives-to-java-lang-
> > > > reflect-proxy-for-creating-proxies-of-abstract-classes
> > > >
> > > >
> > > > Any suggestions?
> > > >
> > > > Would be cool if blueprints for this were built into wicket.
> > > >
> > > > Thanks.
> > > >
> > > > **
> > > > Martin
> > > >
> > >
> >
>