candlepin/candlepin — pull request #371 by mstead (2013-09-06 15:38:02+00:00)
Title: DO NOT MERGE UNTIL TESTS ARE IN: 1004905: Do not allow hypercheckin to create hosts in different orgs

THIS PATCH IS MISSING TESTS. SUBMITTED SO THAT THE FUNCTIONALITY
AND CODE COULD BE REVIEWED WHILE THE TESTS WERE BEING COMPLETED.

If multiple systems are reporting a host/guest mapping from the
same hypervisor, it was possible that hosts can get created in
multiple orgs, or appear that the update into the specified org
occurred, but did not.

Fix Details
-----------
- When checkin occurs via a Consumer principal:
* owner key now comes from the consumer
* if owner key is specified in the API call, it must
match that of the consumer.

- When checkin occurs via a User principal:
* owner key must be specified
* user must have full access to the target org.

- When updating the host/guest mapping, if ANY mapped host
exists and does not match the target owner, we assume that
the checkin was already done, and fail the transaction.

This does allow multiple systems to do a checkin for the same
hypervisor, but, restricts it to the same org.