Permalink
Browse files

Merge branch 'feature/acl-public-copy'

  • Loading branch information...
bladealslayer committed Oct 17, 2012
2 parents 1471678 + 9b645c0 commit 6ac0e57382d01d6a6c00ba0d4cae888d781520f9
Showing with 9 additions and 0 deletions.
  1. +1 −0 S3/Config.py
  2. +7 −0 S3/S3.py
  3. +1 −0 s3cmd
View
@@ -34,6 +34,7 @@ class Config(object):
skip_existing = False
recursive = False
acl_public = None
+ acl_copy_public = False
acl_grants = []
acl_revokes = []
proxy_host = ""
View
@@ -418,6 +418,13 @@ def object_copy(self, src_uri, dst_uri, extra_headers = None):
headers["x-amz-storage-class"] = "REDUCED_REDUNDANCY"
if extra_headers:
headers.update(extra_headers)
+
+ # Sync public ACL
+ if self.config.acl_copy_public:
+ acl = self.get_acl(src_uri)
+ if acl.isAnonRead():
+ headers["x-amz-acl"] = "public-read"
+
request = self.create_request("OBJECT_PUT", uri = dst_uri, headers = headers)
try:
response = self.send_request(request)
View
1 s3cmd
@@ -1499,6 +1499,7 @@ def main():
optparser.add_option( "--check-md5", dest="check_md5", action="store_true", help="Check MD5 sums when comparing files for [sync]. (default)")
optparser.add_option( "--no-check-md5", dest="check_md5", action="store_false", help="Do not check MD5 sums when comparing files for [sync]. Only size will be compared. May significantly speed up transfer but may also miss some changed files.")
optparser.add_option("-P", "--acl-public", dest="acl_public", action="store_true", help="Store objects with ACL allowing read for anyone.")
+ optparser.add_option( "--acl-copy-public", dest="acl_copy_public", action="store_true", help="When copying or syncing remote objects, preserve public ACLs.")
optparser.add_option( "--acl-private", dest="acl_public", action="store_false", help="Store objects with default ACL allowing access for you only.")
optparser.add_option( "--acl-grant", dest="acl_grants", type="s3acl", action="append", metavar="PERMISSION:EMAIL or USER_CANONICAL_ID", help="Grant stated permission to a given amazon user. Permission is one of: read, write, read_acp, write_acp, full_control, all")
optparser.add_option( "--acl-revoke", dest="acl_revokes", type="s3acl", action="append", metavar="PERMISSION:USER_CANONICAL_ID", help="Revoke stated permission for a given amazon user. Permission is one of: read, write, read_acp, wr ite_acp, full_control, all")

0 comments on commit 6ac0e57

Please sign in to comment.