candlepin/candlepin — pull request #343 by jmrodri (2013-08-08 17:14:57+00:00)
Title: 994711: protect against consuming other org ents

TEST
======
Deploy Candlepin, then use a system running subscription-manager to test against:

```#!/bin/bash
# register to grumpy to snowshites org
sudo subscription-manager register --username grumpy --password password --org snowwhite --force

# get a list of available pools, and pick the last one
POOL=$(sudo subscription-manager list --available | grep ^Pool | tail -1 | cut -f2 -d':')

# strip whitespace
POOL="${POOL//[[:space:]]/}"

# register to user huey in donaldducks org
sudo subscription-manager register --username huey --password password --org donaldduck --force

# verify it's not in the list available
sudo subscription-manager list --available | grep "${POOL}"

# subscribe to it anyway
sudo subscription-manager subscribe --pool "${POOL}"

sudo subscription-manager list --consumed
```
You should get an Insufficient permissions error. Here is sample output of the expected behavior.

```
The system has been registered with ID: 60d1d38d-6487-4ead-87a8-f3b6215189d2
The system with UUID 60d1d38d-6487-4ead-87a8-f3b6215189d2 has been unregistered
The system has been registered with ID: 089d8735-7a91-4d6e-afab-d84ec701965a
Insufficient permissions
No consumed subscription pools to list
```