blob: 5d2d36445bf18ff004dcceb954d85ca6ae30f941 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#!/usr/bin/python
import rgw
import sys
r = rgw.Rgw()
xml = """<AccessControlPolicy xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Owner>
<ID>foo</ID>
<DisplayName>MrFoo</DisplayName>
</Owner>
<AccessControlList>
<Grant>
<Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"CanonicalUser\">
<ID>bar</ID>
<DisplayName>display-name</DisplayName>
</Grantee>
<Permission>FULL_CONTROL</Permission>
</Grant>
</AccessControlList>
</AccessControlPolicy>"""
print "converting %s to binary..." % xml
blob = r.acl_xml2bin(xml)
print "got blob of length %d" % len(blob)
xml2 = r.acl_bin2xml(blob)
blob2 = r.acl_xml2bin(xml2)
if (blob != blob2):
raise "blob differed from blob2!"
sys.exit(0)
|