(grants)
return False
Take a list of grants from an ACL and check if they allow public read access.
Take a list of grants from an ACL and check if they allow public read access.
Take a list of grants from an ACL and check if they allow public read access .
def _public_readable(grants):
    """Take a list of grants from an ACL and check if they allow public read access."""
    for grant in grants:
        # see: https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html
        if grant['Permission'] not in ('READ', 'FULL_CONTROL'):
            continue
        grantee = grant['Grantee']
        if grantee.get('Type') != 'Group':
            continue
        if grantee.get('URI') != 'http://acs.amazonaws.com/groups/global/AllUsers':
            continue
        return True
    return False
def _public_readable ( grants ) : for grant in grants : # see: https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html if grant [ 'Permission' ] not in ( 'READ' , 'FULL_CONTROL' ) : continue grantee = grant [ 'Grantee' ] if grantee . get ( 'Type' ) != 'Group' : continue if grantee . get ( 'URI' ) != 'http://acs.amazonaws.com/groups/global/AllUsers' : continue return True return False