Using policies for protected properties

This patch extends the way we can define rules for property protections.
It allows us to use the roles/rules defined in policy.json and leverage
the policy language for property protections as well.

DocImpact

Related to bp api-v2-property-protection

Change-Id: I4789ebb2645171280185d2c76138e78d954b5954
optimize queries for image-list

- avoid full table scan on images table by converting,
images.is_public = 1 OR images.owner = 'OWNER'
to
query WHERE images.is_public = 1
UNION
query WHERE images.owner = 'OWNER'
- move image related conditions to the inner union queries
- remove unwanted union of queries in case of admin querying for image list
- change the condition images.status != 'killed' to images.status in ('active', 'saving', 'queued', 'pending_delete', 'deleted')
- convert the correlation subqueries that are used for image_property filters into inner joins

Fixes bug 1211315

depends on bug 1214830

Change-Id: Ie7458044edbe1ef64871bcf5ef4996ed3cc0f957
Merge "optimize queries for image-list"
Merge "Using policies for protected properties"