Cleanup MemberResource and IncludedGroupResource
It can be easier to describe the nested member resource as
being a subclass of the parent. This allows views to act on
the parent using the passed in resource, which is logical.
Any changes made by the view are within the scope of the
parent and not the scope of the other entity.
This means the child resource should extend GroupResource.
Most methods on the child refer to the group that is being
accessed by the view. An additional field specifies a user
or included group that is being accessed.
GroupResources come with a GroupControl that was already
used to verify the current user can view the group. In a
view we can now rely on the incoming GroupControl, rather
than making a new instance. This simplifies some view code.
Nested child collections should be ensuring the user can see
the member before creating the child resource. Verify this is
true when parsing the incoming IdString by asking the control
if the current user can see the member.
Simplify the way group resources are downcast to the internal
AccountGroup instance. The downcast is a critical part of each
view and should be consistent. If a group is accessed that is
not an internal group some views do not exist or cannot be used.
Change-Id: I28628b2d04ae59a98b63d6143b620afd9765c122
15 files changed