diff options
| author | Sandy Walsh <sandy.walsh@rackspace.com> | 2011-06-09 16:16:55 -0700 |
|---|---|---|
| committer | Sandy Walsh <sandy.walsh@rackspace.com> | 2011-06-09 16:16:55 -0700 |
| commit | c6ba1bb5035cb1ea4cb2b86ee56797c4dac63983 (patch) | |
| tree | 759c604ced049496970db1e779b72f2395f95a5a /nova/api | |
| parent | 16f0aef6706139b5fba9338dfb971fa012eeb52b (diff) | |
| parent | 50c9ebfdc00a87d1a37a11501e5678de89e25a4f (diff) | |
| download | nova-c6ba1bb5035cb1ea4cb2b86ee56797c4dac63983.tar.gz nova-c6ba1bb5035cb1ea4cb2b86ee56797c4dac63983.tar.xz nova-c6ba1bb5035cb1ea4cb2b86ee56797c4dac63983.zip | |
trunk merge and ec2 tests fixed
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/ec2/__init__.py | 1 | ||||
| -rw-r--r-- | nova/api/openstack/auth.py | 17 | ||||
| -rw-r--r-- | nova/api/openstack/versions.py | 2 |
3 files changed, 12 insertions, 8 deletions
diff --git a/nova/api/ec2/__init__.py b/nova/api/ec2/__init__.py index 1915d007d..890d57fe7 100644 --- a/nova/api/ec2/__init__.py +++ b/nova/api/ec2/__init__.py @@ -242,6 +242,7 @@ class Authorizer(wsgi.Middleware): 'CreateKeyPair': ['all'], 'DeleteKeyPair': ['all'], 'DescribeSecurityGroups': ['all'], + 'ImportPublicKey': ['all'], 'AuthorizeSecurityGroupIngress': ['netadmin'], 'RevokeSecurityGroupIngress': ['netadmin'], 'CreateSecurityGroup': ['netadmin'], diff --git a/nova/api/openstack/auth.py b/nova/api/openstack/auth.py index b49bf449b..7c3e683d6 100644 --- a/nova/api/openstack/auth.py +++ b/nova/api/openstack/auth.py @@ -49,19 +49,22 @@ class AuthMiddleware(wsgi.Middleware): if not self.has_authentication(req): return self.authenticate(req) user = self.get_user_by_authentication(req) - accounts = self.auth.get_projects(user=user) if not user: token = req.headers["X-Auth-Token"] msg = _("%(user)s could not be found with token '%(token)s'") LOG.warn(msg % locals()) return faults.Fault(webob.exc.HTTPUnauthorized()) - if accounts: - #we are punting on this til auth is settled, - #and possibly til api v1.1 (mdragon) - account = accounts[0] - else: - return faults.Fault(webob.exc.HTTPUnauthorized()) + try: + account = req.headers["X-Auth-Project-Id"] + except KeyError: + # FIXME(usrleon): It needed only for compatibility + # while osapi clients don't use this header + accounts = self.auth.get_projects(user=user) + if accounts: + account = accounts[0] + else: + return faults.Fault(webob.exc.HTTPUnauthorized()) if not self.auth.is_admin(user) and \ not self.auth.is_project_member(user, account): diff --git a/nova/api/openstack/versions.py b/nova/api/openstack/versions.py index 9db160102..4c682302f 100644 --- a/nova/api/openstack/versions.py +++ b/nova/api/openstack/versions.py @@ -35,7 +35,7 @@ class Versions(wsgi.Resource): 'application/xml': wsgi.XMLDictSerializer(metadata=metadata), } - super(Versions, self).__init__(None, serializers=serializers) + wsgi.Resource.__init__(self, None, serializers=serializers) def dispatch(self, request, *args): """Respond to a request for all OpenStack API versions.""" |
