I have two types of groups: block sections, and free sections.
Block sections are composed of one or more free sections.
Free sections are associated with zero or one block section.
Requirements:
1. If a user is added as a member of a block section, he is automatically
a member of all the free sections associated with the block section.
2. If a user is added as a member of a free section, he should not
be automatically added as a member of the block section associated with
the free section.
3. If a member of a block section is removed from the block section,
he should be automatically removed from all associated free sections.
To make the example more concrete:
The group Nerds is a block section, and it has two free sections:
Nerdy Chemistry 101, and Nerdy Algebra 101. Juan joins the group
Nerds and is automatically enrolled to Nerdy Chemistry 101 and
Nerdy Algebra 101. Maria does not join the group Nerds but joins
the group Nerdy Algebra 101.
A query on group_member_map on Nerdy Algebra 101 should list both Juan
and Maria as members. However, a query on group_member_map on Nerds should
not include Maria.
I tried making a free section a component of a block sections,
but this does not satisfy requirement #2 above. If I add a user
to a free section, the user is also added to the associated block section.
I tried making a free section a member of a block section, but the
groups API won't allow me. membership_rel__new(integer, integer) requires
that the second parameter should be a Person object.
How do I represent this organization with the Groups API?