Fixes access key passing in curl statement.
This commit is contained in:
		| @@ -419,6 +419,10 @@ class AuthManager(object): | ||||
|                 raise exception.NotAuthorized('Signature does not match') | ||||
|         return (user, project) | ||||
|  | ||||
|     def get_access_key(self, user, project): | ||||
|         """Get an access key that includes user and project""" | ||||
|         return "%s:%s" % (User.safe_id(user), Project.safe_id(project)) | ||||
|  | ||||
|     def is_superuser(self, user): | ||||
|         """Checks for superuser status, allowing user to bypass rbac | ||||
|  | ||||
|   | ||||
| @@ -27,6 +27,7 @@ import urllib | ||||
|  | ||||
| from nova import flags | ||||
| from nova import utils | ||||
| from nova.auth import manager | ||||
|  | ||||
|  | ||||
| FLAGS = flags.FLAGS | ||||
| @@ -75,11 +76,14 @@ def deregister(context, image_id): | ||||
|             query_args=qs({'image_id': image_id})) | ||||
|  | ||||
| def conn(context): | ||||
|     return boto.s3.connection.S3Connection ( | ||||
|         aws_access_key_id=str('%s:%s' % (context.user.access, context.project.name)), | ||||
|         aws_secret_access_key=str(context.user.secret), | ||||
|     access = manager.AuthManager().get_access_key(context.user, | ||||
|                                                   context.project) | ||||
|     secret = str(context.user.secret) | ||||
|     calling = boto.s3.connection.OrdinaryCallingFormat() | ||||
|     return boto.s3.connection.S3Connection(aws_access_key_id=access, | ||||
|                                            aws_secret_access_key=secret, | ||||
|                                            is_secure=False, | ||||
|         calling_format=boto.s3.connection.OrdinaryCallingFormat(), | ||||
|                                            calling_format=calling, | ||||
|                                            port=FLAGS.s3_port, | ||||
|                                            host=FLAGS.s3_host) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Vishvananda Ishaya
					Vishvananda Ishaya