(NC-157) Detect inheritance cycles in groups

This prevents people from creating inheritance cycles. Cycles are checked when a user makes a request modifying a group. If any cycle is detected an error with the cycle is returned.