I'm using Spring Security ACL in my Grails project to manage access into my application. I can create Admin and User to have different permissions into the application. Now, I want that a particular user can see only some instances of a domain class object. That is:
following the example domain class object
class Patient
{
String name;
String surname;
...
}
Suppose that there are 3 created Patient objects. I want that, if I login with
username = test1
password=test1
I can see only Patient that belongs to this User. I think that is needed that, when I create a new Patient, it is stored that this Patient belongs to the User currently logged. How can I do that?
EDIT: Another problem is that, if I change the URL in the part of id to show, I can see all the Patient that are created. I want that, if I change URL manually, I see an access error. Is it possible?
EDIT 2: How can I get the role of the user currently logged in? I've tried with the following code How to get current user role with spring security plugin? but I cannot perform the getAuthorities() because it tells me that it does not exists
I've solved EDIT2 in the following discussion grails exception: Tag [paginate] is missing required attribute [total] I need to solve the EDIT1 thanks