Skip to content

Commit

Permalink
* s3cmd, S3/ACL.py: Print all ACLs for a Grantee
Browse files Browse the repository at this point in the history
(one Grantee can have multiple different Grant entries)



git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@405 830e0280-6d2a-0410-9c65-932aecc39d9d
  • Loading branch information
ludvigm committed Mar 19, 2010
1 parent 47116ee commit 6d87691
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -1,3 +1,8 @@
2010-03-19 Michal Ludvig <mludvig@logix.net.nz>

* s3cmd, S3/ACL.py: Print all ACLs for a Grantee
(one Grantee can have multiple different Grant entries)

2010-03-19 Michal Ludvig <mludvig@logix.net.nz> 2010-03-19 Michal Ludvig <mludvig@logix.net.nz>


* s3cmd: Enable bucket-level ACL setting * s3cmd: Enable bucket-level ACL setting
Expand Down
4 changes: 2 additions & 2 deletions S3/ACL.py
Expand Up @@ -99,15 +99,15 @@ def parseGrants(self, tree):
self.grantees.append(grantee) self.grantees.append(grantee)


def getGrantList(self): def getGrantList(self):
acl = {} acl = []
for grantee in self.grantees: for grantee in self.grantees:
if grantee.display_name: if grantee.display_name:
user = grantee.display_name user = grantee.display_name
elif grantee.isAllUsers(): elif grantee.isAllUsers():
user = "*anon*" user = "*anon*"
else: else:
user = grantee.name user = grantee.name
acl[user] = grantee.permission acl.append({'grantee': user, 'permission': grantee.permission})
return acl return acl


def getOwner(self): def getOwner(self):
Expand Down
6 changes: 3 additions & 3 deletions s3cmd
Expand Up @@ -603,9 +603,9 @@ def cmd_info(args):
output(u"%s (bucket):" % uri.uri()) output(u"%s (bucket):" % uri.uri())
output(u" Location: %s" % info['bucket-location']) output(u" Location: %s" % info['bucket-location'])
acl = s3.get_acl(uri) acl = s3.get_acl(uri)
acl_list = acl.getGrantList() acl_grant_list = acl.getGrantList()
for user in acl_list: for grant in acl_grant_list:
output(u" ACL: %s: %s" % (user, acl_list[user])) output(u" ACL: %s: %s" % (grant['grantee'], grant['permission']))
if acl.isAnonRead(): if acl.isAnonRead():
output(u" URL: %s" % uri.public_url()) output(u" URL: %s" % uri.public_url())
except S3Error, e: except S3Error, e:
Expand Down

0 comments on commit 6d87691

Please sign in to comment.