diff options
| author | Jake Dahn <jake@markupisart.com> | 2011-08-16 09:15:14 -0700 |
|---|---|---|
| committer | Jake Dahn <jake@markupisart.com> | 2011-08-16 09:15:14 -0700 |
| commit | 817b596bccd38f84f72e1ee73df3c3b35287c75c (patch) | |
| tree | e33d27b10acfedfb828c8d61ad081818f49105cd /nova/api | |
| parent | 02c5d589483abef3fb8ec65f983e5b43a9e41f71 (diff) | |
| download | nova-817b596bccd38f84f72e1ee73df3c3b35287c75c.tar.gz nova-817b596bccd38f84f72e1ee73df3c3b35287c75c.tar.xz nova-817b596bccd38f84f72e1ee73df3c3b35287c75c.zip | |
refactoring tests to not use authmanager, and now returning 403 when non admin user tries to update quotas
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/contrib/quotas.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/nova/api/openstack/contrib/quotas.py b/nova/api/openstack/contrib/quotas.py index 5f2b54d57..f7e7b4105 100644 --- a/nova/api/openstack/contrib/quotas.py +++ b/nova/api/openstack/contrib/quotas.py @@ -15,6 +15,7 @@ # License for the specific language governing permissions and limitations # under the License. +import webob import urlparse from nova import db @@ -54,7 +55,6 @@ class QuotaSetsController(object): resources = ['metadata_items', 'injected_file_content_bytes', 'volumes', 'gigabytes', 'ram', 'floating_ips', 'instances', 'injected_files', 'cores'] - for key in body['quota_set'].keys(): if key in resources: value = int(body['quota_set'][key]) @@ -62,6 +62,8 @@ class QuotaSetsController(object): db.quota_update(context, project_id, key, value) except exception.ProjectQuotaNotFound: db.quota_create(context, project_id, key, value) + except exception.AdminRequired as e: + return webob.Response(status_int=403) return {'quota_set': quota.get_project_quotas(context, project_id)} def defaults(self, req): |
