blob: 99703a29878a69f57f4907ebc1570699d9f25318 [file]
[[authorityGroupAuthorityClass]]
=== GroupAuthority Class
The typical approach to mapping the relationship between "`group`" and "`authority`" is a many-to-many. In a standard implementation, users have multiple roles, and roles are shared by multiple users. In a group implementation, groups have multiple roles and roles are shared by multiple groups. For the same reason we would use a join class between "`person`" and "`authority`", we should use one between "`group`" and "`authority`".
If you run the <<s2-quickstart>> script with the group name specified, this class will be generated for you, so you don't need to deal with the details of mapping it. Assuming you choose `com.mycompany.myapp` as your package, and `RoleGroup` and `Role` as your class names, you'll generate this class:
[source, groovy]
.`RoleGroupRole.groovy`
----
include::../code/s2-quickstart-rolegroup/grails-app/domain/com/mycompany/myapp/RoleGroupRole.groovy[]
----