I am developing a grails application. In some cases, I want to manage role-based domain class fields. So in every call to the getter setter method of the domain class I want to apply some filter based on the role (Written in the user role). I assume that grails will create a set getter method at runtime for domin classes. Thus, when writing Grails code, you can apply this logic. If possible, how to apply?
Example:
Domain Class:
class Book{
String name;
double price;
}
Controller:
def index={
Book book=Book.get(1);
println book.name;
println book.price;
}
In the above code, "println book.price;" this line should only work for a specific role. For some other role, this should raise some kind of exception.
Is it possible to achieve? Is there any plugin for this?
Please help with this .... Thanks