def test_set_acl(self): owner = User(id='1234567890', display_name='test') acl = ACL() grant = Grant() grant.permission = "READ" grant.display_name = "test" grant.email_address = "*****@*****.**" acl.add_grant(grant) policy = Policy() policy.owner = owner policy.acl = acl bucket = conn.get_bucket(test_bucket) #ret = bucket.set_acl("public-read-write", test_key) ret = bucket.set_acl(policy, test_key) print(ret)
def test_set_acl(self): owner = User(id='1234567890', display_name='test') acl = ACL() grant = Grant() grant.permission = "READ" grant.display_name = "test" grant.email_address = "*****@*****.**" acl.add_grant(grant) policy = Policy() policy.owner = owner policy.acl = acl bucket = conn.get_bucket(test_bucket) #ret = bucket.set_acl("public-read-write", test_key) ret = bucket.set_acl(policy, test_key) print ret
def test_set_acl(self): owner = User(id='1234567890', display_name='test') acl = ACL() grant = Grant() grant.permission = "READ" grant.display_name = "test" grant.email_address = "*****@*****.**" grant.type = 'CanonicalUser' acl.add_grant(grant) policy = Policy() policy.owner = owner policy.acl = acl bucket = conn.get_bucket(test_bucket) # ret = bucket.set_acl("public-read-write", test_key) ret = bucket.set_xml_acl(policy.to_xml(), test_key, headers={'content-type': 'text/plain'}) print(ret)