diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-04-23 09:51:47 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-04-23 09:51:47 +0000 |
commit | a0efbbcfc701563473e0dc42ca5b6b4b57ca7d5a (patch) | |
tree | 5ff57841c6c69d0e56217f08c560a666f6d0bc47 | |
parent | 6442773d2635a26e242cca1feddabab2a520f3f6 (diff) | |
parent | 8c9b5e620eef3233677b64cd234ed2551e6aa182 (diff) | |
download | nova-a0efbbcfc701563473e0dc42ca5b6b4b57ca7d5a.tar.gz |
Merge "Control create/delete flavor api permissions using policy.json" into stable/kilo2015.1.0rc2
-rw-r--r-- | nova/api/openstack/compute/contrib/flavormanage.py | 11 | ||||
-rw-r--r-- | nova/tests/unit/api/openstack/compute/contrib/test_flavor_manage.py | 4 |
2 files changed, 2 insertions, 13 deletions
diff --git a/nova/api/openstack/compute/contrib/flavormanage.py b/nova/api/openstack/compute/contrib/flavormanage.py index dc5b35c35d..4c3ee0be90 100644 --- a/nova/api/openstack/compute/contrib/flavormanage.py +++ b/nova/api/openstack/compute/contrib/flavormanage.py @@ -16,7 +16,6 @@ from nova.api.openstack.compute.views import flavors as flavors_view from nova.api.openstack import extensions from nova.api.openstack import wsgi from nova.compute import flavors -from nova import context as nova_context from nova import exception from nova.i18n import _ @@ -35,11 +34,6 @@ class FlavorManageController(wsgi.Controller): def _delete(self, req, id): context = req.environ['nova.context'] authorize(context) - - # NOTE(alex_xu): back-compatible with db layer hard-code admin - # permission checks. - nova_context.require_admin_context(context) - try: flavor = flavors.get_flavor_by_flavor_id( id, ctxt=context, read_deleted="no") @@ -54,11 +48,6 @@ class FlavorManageController(wsgi.Controller): def _create(self, req, body): context = req.environ['nova.context'] authorize(context) - - # NOTE(alex_xu): back-compatible with db layer hard-code admin - # permission checks. - nova_context.require_admin_context(context) - if not self.is_valid_body(body, 'flavor'): msg = _("Invalid request body") raise webob.exc.HTTPBadRequest(explanation=msg) diff --git a/nova/tests/unit/api/openstack/compute/contrib/test_flavor_manage.py b/nova/tests/unit/api/openstack/compute/contrib/test_flavor_manage.py index ad0d27959f..950cdae39f 100644 --- a/nova/tests/unit/api/openstack/compute/contrib/test_flavor_manage.py +++ b/nova/tests/unit/api/openstack/compute/contrib/test_flavor_manage.py @@ -442,7 +442,7 @@ class FlavorManageTestV2(FlavorManageTestV21): environ['nova.context']) def _get_http_request(self, url=''): - return fakes.HTTPRequest.blank(url, use_admin_context=True) + return fakes.HTTPRequest.blank(url, use_admin_context=False) class PrivateFlavorManageTestV2(PrivateFlavorManageTestV21): @@ -464,7 +464,7 @@ class PrivateFlavorManageTestV2(PrivateFlavorManageTestV21): environ['nova.context']) def _get_http_request(self, url=''): - return fakes.HTTPRequest.blank(url, use_admin_context=True) + return fakes.HTTPRequest.blank(url, use_admin_context=False) class FlavorManagerPolicyEnforcementV21(test.NoDBTestCase): |