I'm trying to implement deadbolt2 groups, but I am puzzled how I am supposed to achieve this. I am using Play 2.2.1, Deadbolt 2.2.RC4 and Hibernate 4.3.1 with a MySQL database.
I have been able to implement some of Deadbolt:. I can login, register users and annotate methods with @SubjectPresent
I would now like to annotate my functions with this: @Restrict(@Group("Administrator"))
.
I have been using Deadbolt2-java-example as a guide, but the part concerning groups seems obscure to me.
In the model AuthorisedUser I have:
@ManyToMany
public List<SecurityRole> roles;
In my database this creates a table called AuthorisedUser_SecurityRole
The problem I have is that I have no idea how I am supposed to query this table. Typing the table name will give me a run-time error. AuthorisedUser_SecurityRole is not mapped
. The same applies if I type roles
What I am wondering about then is:
- How and where do I create new groups?
- How do I retrieve/query the list
roles
(list of groups a user belongs to) - How do I add groups to a user?
Please let me know if you need to see any of my code, but I am unsure what you would need to see as most of the code is standard from the deadbolt example.