Hello,
I would like to intercept calls to properties of domain classes to implement access control.
My first try was to override setProperty and getProperty. By doing this, I disabled all nice functionality of Grails domain classes, such as
domainClass.properties = params
and the automatic conversion of data types.
The next try was to use the DelegatingMetaClass, which enabled me at least to print out some nice log messages around the actual call. But I could not figure out how to access the actual object to evaluate the permissions.
Last, groovy.lang.Interceptor seems to be a good choice, as I can access the actual object. But is this the right way? How am I able to force all domain classes to be intercepted?
Thanks a lot in advance.
Regards, Daniel