Adding user_id handling to keypair index, show and create api calls

Administering an openstack cluster I found the need to see what keypairs a
user had. I found this bug that was requesting the same thing and decided
to implement it. This is the update to the api server to handle a query
param passed to return a keypair list for a specific user-id. Only a user
with admin privileges is allowed to make this call.

Allowing the administrators to be able to list and get details of keypairs
which owned by users other than themselves, as well as creating new and
deleting keypairs on behalf of their users.

DocImpact: This adds API microversion
Implements blueprint admin-query-any-keypair
APIImpact
UpgradeImpact: Policy rules of the index, create, delete and show
               operations has been updated to support the change.
               os_compute_api:os-keypairs:{index, show, create, delete}:
               "rule:admin_api or user_id:%(user_id)s

Co-Authored-By: Dan Smith <dansmith@redhat.com>
Co-Authored-By: Dan Radez <dradez@redhat.com>
Closes-Bug: #1182965
Change-Id: I45846f770628e8f24a8c137dcdc46baa64c50801
This commit is contained in:
Vladik Romanovsky
2015-04-20 13:21:37 -07:00
committed by Dan Smith
parent 57967ae351
commit 1b8a2e0a92
24 changed files with 411 additions and 31 deletions
+3 -1
View File
@@ -48,6 +48,8 @@ REST_API_VERSION_HISTORY = """REST API Version History:
* 2.7 - Check flavor type before add tenant access.
* 2.8 - Add new protocol for VM console (mks)
* 2.9 - Exposes lock information in server details.
* 2.10 - Allow admins to query, create and delete keypairs owned by any
user.
"""
# The minimum and maximum versions of the API supported
@@ -56,7 +58,7 @@ REST_API_VERSION_HISTORY = """REST API Version History:
# Note(cyeoh): This only applies for the v2.1 API once microversions
# support is fully merged. It does not affect the V2 API.
_MIN_API_VERSION = "2.1"
_MAX_API_VERSION = "2.9"
_MAX_API_VERSION = "2.10"
DEFAULT_API_VERSION = _MIN_API_VERSION