s33r 0.4.2 → 0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. data/examples/cli/instant_download_server.rb +88 -0
  2. data/examples/cli/s3cli.rb +31 -52
  3. data/examples/cli/simple.rb +16 -6
  4. data/examples/fores33r/app/controllers/browser_controller.rb +12 -10
  5. data/examples/fores33r/app/helpers/application_helper.rb +2 -1
  6. data/examples/fores33r/app/views/browser/_upload.rhtml +1 -1
  7. data/examples/fores33r/app/views/browser/index.rhtml +4 -4
  8. data/examples/fores33r/config/environment.rb +5 -3
  9. data/examples/fores33r/log/development.log +2259 -0
  10. data/examples/fores33r/log/mongrel.log +59 -0
  11. data/examples/s3.yaml +2 -6
  12. data/lib/s33r/bucket.rb +103 -0
  13. data/lib/s33r/bucket_listing.rb +33 -76
  14. data/lib/s33r/client.rb +305 -446
  15. data/lib/s33r/networking.rb +197 -0
  16. data/lib/s33r/s33r_exception.rb +29 -18
  17. data/lib/s33r/s33r_http.rb +36 -18
  18. data/lib/s33r/s3_acl.rb +32 -52
  19. data/lib/s33r/s3_logging.rb +117 -0
  20. data/lib/s33r/s3_obj.rb +124 -69
  21. data/lib/s33r/utility.rb +447 -0
  22. data/test/cases/spec_acl.rb +10 -40
  23. data/test/cases/spec_bucket_listing.rb +12 -32
  24. data/test/cases/spec_logging.rb +47 -0
  25. data/test/cases/spec_networking.rb +11 -0
  26. data/test/cases/spec_s3_object.rb +44 -5
  27. data/test/cases/spec_utility.rb +264 -0
  28. data/test/files/acl.xml +0 -6
  29. data/test/files/config.yaml +5 -0
  30. data/test/files/logging_status_disabled.xml +3 -0
  31. data/test/files/logging_status_enabled.xml +7 -0
  32. data/test/test_setup.rb +7 -2
  33. metadata +16 -94
  34. data/examples/cli/acl_x.rb +0 -41
  35. data/examples/cli/logging_x.rb +0 -20
  36. data/examples/fores33r/README +0 -183
  37. data/html/classes/MIME.html +0 -120
  38. data/html/classes/MIME/InvalidContentType.html +0 -119
  39. data/html/classes/MIME/Type.html +0 -1173
  40. data/html/classes/MIME/Types.html +0 -566
  41. data/html/classes/Net.html +0 -108
  42. data/html/classes/Net/HTTPGenericRequest.html +0 -233
  43. data/html/classes/Net/HTTPResponse.html +0 -271
  44. data/html/classes/S33r.html +0 -986
  45. data/html/classes/S33r/BucketListing.html +0 -434
  46. data/html/classes/S33r/Client.html +0 -1575
  47. data/html/classes/S33r/LoggingResource.html +0 -222
  48. data/html/classes/S33r/NamedBucket.html +0 -693
  49. data/html/classes/S33r/OrderlyXmlMarkup.html +0 -165
  50. data/html/classes/S33r/S33rException.html +0 -124
  51. data/html/classes/S33r/S33rException/BucketListingMaxKeysError.html +0 -111
  52. data/html/classes/S33r/S33rException/BucketNotLogTargetable.html +0 -119
  53. data/html/classes/S33r/S33rException/InvalidBucketListing.html +0 -111
  54. data/html/classes/S33r/S33rException/InvalidPermission.html +0 -111
  55. data/html/classes/S33r/S33rException/InvalidS3GroupType.html +0 -111
  56. data/html/classes/S33r/S33rException/MalformedBucketName.html +0 -111
  57. data/html/classes/S33r/S33rException/MethodNotAvailable.html +0 -111
  58. data/html/classes/S33r/S33rException/MissingBucketName.html +0 -111
  59. data/html/classes/S33r/S33rException/MissingRequiredHeaders.html +0 -111
  60. data/html/classes/S33r/S33rException/MissingResource.html +0 -111
  61. data/html/classes/S33r/S33rException/S3FallenOver.html +0 -111
  62. data/html/classes/S33r/S33rException/TryingToPutEmptyResource.html +0 -117
  63. data/html/classes/S33r/S33rException/UnsupportedCannedACL.html +0 -111
  64. data/html/classes/S33r/S33rException/UnsupportedHTTPMethod.html +0 -111
  65. data/html/classes/S33r/S3ACL.html +0 -125
  66. data/html/classes/S33r/S3ACL/ACLDoc.html +0 -521
  67. data/html/classes/S33r/S3ACL/AmazonCustomer.html +0 -168
  68. data/html/classes/S33r/S3ACL/CanonicalUser.html +0 -212
  69. data/html/classes/S33r/S3ACL/Grant.html +0 -403
  70. data/html/classes/S33r/S3ACL/Grantee.html +0 -239
  71. data/html/classes/S33r/S3ACL/Group.html +0 -178
  72. data/html/classes/S33r/S3Object.html +0 -618
  73. data/html/classes/S33r/Sync.html +0 -152
  74. data/html/classes/XML.html +0 -202
  75. data/html/classes/XML/Document.html +0 -125
  76. data/html/classes/XML/Node.html +0 -124
  77. data/html/created.rid +0 -1
  78. data/html/files/CHANGELOG.html +0 -107
  79. data/html/files/MIT-LICENSE.html +0 -129
  80. data/html/files/README_txt.html +0 -259
  81. data/html/files/lib/s33r/bucket_listing_rb.html +0 -101
  82. data/html/files/lib/s33r/builder_rb.html +0 -108
  83. data/html/files/lib/s33r/client_rb.html +0 -111
  84. data/html/files/lib/s33r/core_rb.html +0 -113
  85. data/html/files/lib/s33r/libxml_extensions_rb.html +0 -101
  86. data/html/files/lib/s33r/libxml_loader_rb.html +0 -109
  87. data/html/files/lib/s33r/logging_rb.html +0 -108
  88. data/html/files/lib/s33r/mimetypes_rb.html +0 -120
  89. data/html/files/lib/s33r/named_bucket_rb.html +0 -101
  90. data/html/files/lib/s33r/s33r_exception_rb.html +0 -101
  91. data/html/files/lib/s33r/s33r_http_rb.html +0 -108
  92. data/html/files/lib/s33r/s3_acl_rb.html +0 -108
  93. data/html/files/lib/s33r/s3_obj_rb.html +0 -108
  94. data/html/files/lib/s33r/sync_rb.html +0 -101
  95. data/html/files/lib/s33r_rb.html +0 -101
  96. data/html/fr_class_index.html +0 -66
  97. data/html/fr_file_index.html +0 -44
  98. data/html/fr_method_index.html +0 -183
  99. data/html/index.html +0 -24
  100. data/html/rdoc-style.css +0 -208
  101. data/lib/s33r/core.rb +0 -296
  102. data/lib/s33r/logging.rb +0 -43
  103. data/lib/s33r/named_bucket.rb +0 -148
  104. data/lib/s33r/sync.rb +0 -13
  105. data/test/cases/spec_all_buckets.rb +0 -28
  106. data/test/cases/spec_client.rb +0 -101
  107. data/test/cases/spec_core.rb +0 -128
  108. data/test/cases/spec_namedbucket.rb +0 -46
  109. data/test/cases/spec_sync.rb +0 -34
  110. data/test/files/all_buckets.xml +0 -21
  111. data/test/files/client_config.yml +0 -5
  112. data/test/files/namedbucket_config.yml +0 -8
  113. data/test/files/namedbucket_config2.yml +0 -8
  114. data/test/test_bucket_setup.rb +0 -41
@@ -1,111 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Class: S33r::S33rException::UnsupportedCannedACL</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Class</strong></td>
53
- <td class="class-name-in-header">S33r::S33rException::UnsupportedCannedACL</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../../../files/lib/s33r/s33r_exception_rb.html">
59
- lib/s33r/s33r_exception.rb
60
- </a>
61
- <br />
62
- </td>
63
- </tr>
64
-
65
- <tr class="top-aligned-row">
66
- <td><strong>Parent:</strong></td>
67
- <td>
68
- Exception
69
- </td>
70
- </tr>
71
- </table>
72
- </div>
73
- <!-- banner header -->
74
-
75
- <div id="bodyContent">
76
-
77
-
78
-
79
- <div id="contextContent">
80
-
81
-
82
-
83
- </div>
84
-
85
-
86
- </div>
87
-
88
-
89
- <!-- if includes -->
90
-
91
- <div id="section">
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
- <!-- if method_list -->
101
-
102
-
103
- </div>
104
-
105
-
106
- <div id="validator-badges">
107
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
108
- </div>
109
-
110
- </body>
111
- </html>
@@ -1,111 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Class: S33r::S33rException::UnsupportedHTTPMethod</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Class</strong></td>
53
- <td class="class-name-in-header">S33r::S33rException::UnsupportedHTTPMethod</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../../../files/lib/s33r/s33r_exception_rb.html">
59
- lib/s33r/s33r_exception.rb
60
- </a>
61
- <br />
62
- </td>
63
- </tr>
64
-
65
- <tr class="top-aligned-row">
66
- <td><strong>Parent:</strong></td>
67
- <td>
68
- Exception
69
- </td>
70
- </tr>
71
- </table>
72
- </div>
73
- <!-- banner header -->
74
-
75
- <div id="bodyContent">
76
-
77
-
78
-
79
- <div id="contextContent">
80
-
81
-
82
-
83
- </div>
84
-
85
-
86
- </div>
87
-
88
-
89
- <!-- if includes -->
90
-
91
- <div id="section">
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
- <!-- if method_list -->
101
-
102
-
103
- </div>
104
-
105
-
106
- <div id="validator-badges">
107
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
108
- </div>
109
-
110
- </body>
111
- </html>
@@ -1,125 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Module: S33r::S3ACL</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Module</strong></td>
53
- <td class="class-name-in-header">S33r::S3ACL</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../../files/lib/s33r/s3_acl_rb.html">
59
- lib/s33r/s3_acl.rb
60
- </a>
61
- <br />
62
- </td>
63
- </tr>
64
-
65
- </table>
66
- </div>
67
- <!-- banner header -->
68
-
69
- <div id="bodyContent">
70
-
71
-
72
-
73
- <div id="contextContent">
74
-
75
- <div id="description">
76
- <p>
77
- S3 ACL handling.
78
- </p>
79
- <p>
80
- NB an individual ACL for an object can only contain &lt;= 100 grants.
81
- </p>
82
-
83
- </div>
84
-
85
-
86
- </div>
87
-
88
-
89
- </div>
90
-
91
-
92
- <!-- if includes -->
93
-
94
- <div id="section">
95
-
96
- <div id="class-list">
97
- <h3 class="section-bar">Classes and Modules</h3>
98
-
99
- Class <a href="S3ACL/ACLDoc.html" class="link">S33r::S3ACL::ACLDoc</a><br />
100
- Class <a href="S3ACL/AmazonCustomer.html" class="link">S33r::S3ACL::AmazonCustomer</a><br />
101
- Class <a href="S3ACL/CanonicalUser.html" class="link">S33r::S3ACL::CanonicalUser</a><br />
102
- Class <a href="S3ACL/Grant.html" class="link">S33r::S3ACL::Grant</a><br />
103
- Class <a href="S3ACL/Grantee.html" class="link">S33r::S3ACL::Grantee</a><br />
104
- Class <a href="S3ACL/Group.html" class="link">S33r::S3ACL::Group</a><br />
105
-
106
- </div>
107
-
108
-
109
-
110
-
111
-
112
-
113
-
114
- <!-- if method_list -->
115
-
116
-
117
- </div>
118
-
119
-
120
- <div id="validator-badges">
121
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
122
- </div>
123
-
124
- </body>
125
- </html>
@@ -1,521 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Class: S33r::S3ACL::ACLDoc</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Class</strong></td>
53
- <td class="class-name-in-header">S33r::S3ACL::ACLDoc</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../../../files/lib/s33r/s3_acl_rb.html">
59
- lib/s33r/s3_acl.rb
60
- </a>
61
- <br />
62
- </td>
63
- </tr>
64
-
65
- <tr class="top-aligned-row">
66
- <td><strong>Parent:</strong></td>
67
- <td>
68
- Object
69
- </td>
70
- </tr>
71
- </table>
72
- </div>
73
- <!-- banner header -->
74
-
75
- <div id="bodyContent">
76
-
77
-
78
-
79
- <div id="contextContent">
80
-
81
- <div id="description">
82
- <p>
83
- An S3 ACL document, incorporating one or more Grants (see <a
84
- href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/UsingACL.html">docs.amazonwebservices.com/AmazonS3/2006-03-01/UsingACL.html</a>).
85
- </p>
86
- <p>
87
- Represents both retrieved ACL <a href="../../XML.html">XML</a> or can be
88
- built up using objects and converted to <a href="../../XML.html">XML</a>.
89
- NB the <a href="ACLDoc.html">ACLDoc</a> is oblivious to the resource it is
90
- going to be applied to.
91
- </p>
92
-
93
- </div>
94
-
95
-
96
- </div>
97
-
98
- <div id="method-list">
99
- <h3 class="section-bar">Methods</h3>
100
-
101
- <div class="name-list">
102
- <a href="#M000067">add_grant</a>&nbsp;&nbsp;
103
- <a href="#M000072">add_log_target_grants</a>&nbsp;&nbsp;
104
- <a href="#M000070">add_public_read_grant</a>&nbsp;&nbsp;
105
- <a href="#M000065">from_xml</a>&nbsp;&nbsp;
106
- <a href="#M000071">log_targetable?</a>&nbsp;&nbsp;
107
- <a href="#M000064">new</a>&nbsp;&nbsp;
108
- <a href="#M000069">public_readable?</a>&nbsp;&nbsp;
109
- <a href="#M000068">remove_grant</a>&nbsp;&nbsp;
110
- <a href="#M000073">remove_log_target_grants</a>&nbsp;&nbsp;
111
- <a href="#M000066">to_xml</a>&nbsp;&nbsp;
112
- </div>
113
- </div>
114
-
115
- </div>
116
-
117
-
118
- <!-- if includes -->
119
-
120
- <div id="section">
121
-
122
-
123
-
124
-
125
-
126
- <div id="attribute-list">
127
- <h3 class="section-bar">Attributes</h3>
128
-
129
- <div class="name-list">
130
- <table>
131
- <tr class="top-aligned-row context-row">
132
- <td class="context-item-name">grants</td>
133
- <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
134
- <td class="context-item-desc">
135
- List of grants to be applied.
136
-
137
- </td>
138
- </tr>
139
- <tr class="top-aligned-row context-row">
140
- <td class="context-item-name">owner</td>
141
- <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
142
- <td class="context-item-desc">
143
- List of grants to be applied.
144
-
145
- </td>
146
- </tr>
147
- </table>
148
- </div>
149
- </div>
150
-
151
-
152
-
153
- <!-- if method_list -->
154
- <div id="methods">
155
- <h3 class="section-bar">Public Class methods</h3>
156
-
157
- <div id="method-M000065" class="method-detail">
158
- <a name="M000065"></a>
159
-
160
- <div class="method-heading">
161
- <a href="#M000065" class="method-signature">
162
- <span class="method-name">from_xml</span><span class="method-args">(acl_xml)</span>
163
- </a>
164
- </div>
165
-
166
- <div class="method-description">
167
- <p>
168
- Create an <a href="ACLDoc.html">ACLDoc</a> instance from a raw Access
169
- Control Policy <a href="../../XML.html">XML</a> document.
170
- </p>
171
- <p>
172
- <tt>acl_xml</tt> is a raw Access Control Policy <a
173
- href="../../XML.html">XML</a> string (NOT libxml Document or Node).
174
- </p>
175
- <p>
176
- Returns nil if the ACL <a href="../../XML.html">XML</a> is nil.
177
- </p>
178
- <p><a class="source-toggle" href="#"
179
- onclick="toggleCode('M000065-source');return false;">[Source]</a></p>
180
- <div class="method-source-code" id="M000065-source">
181
- <pre>
182
- <span class="ruby-comment cmt"># File lib/s33r/s3_acl.rb, line 35</span>
183
- 35: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">from_xml</span>(<span class="ruby-identifier">acl_xml</span>)
184
- 36: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">acl_xml</span>.<span class="ruby-identifier">nil?</span>
185
- 37:
186
- 38: <span class="ruby-identifier">acl_xml</span> = <span class="ruby-constant">S33r</span>.<span class="ruby-identifier">remove_namespace</span>(<span class="ruby-identifier">acl_xml</span>)
187
- 39: <span class="ruby-identifier">doc</span> = <span class="ruby-constant">XML</span>.<span class="ruby-identifier">get_xml_doc</span>(<span class="ruby-identifier">acl_xml</span>)
188
- 40:
189
- 41: <span class="ruby-identifier">owner_xml</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">find</span>(<span class="ruby-value str">'//Owner'</span>).<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">first</span>
190
- 42: <span class="ruby-identifier">owner</span> = <span class="ruby-constant">CanonicalUser</span>.<span class="ruby-identifier">from_xml</span>(<span class="ruby-identifier">owner_xml</span>)
191
- 43:
192
- 44: <span class="ruby-identifier">grants</span> = []
193
- 45: <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">find</span>(<span class="ruby-value str">'//AccessControlList/Grant'</span>).<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">g</span><span class="ruby-operator">|</span>
194
- 46: <span class="ruby-identifier">grantee_xml</span> = <span class="ruby-identifier">g</span>.<span class="ruby-identifier">find</span>(<span class="ruby-value str">'Grantee'</span>).<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">first</span>
195
- 47: <span class="ruby-identifier">grantee</span> = <span class="ruby-constant">Grantee</span>.<span class="ruby-identifier">from_xml</span>(<span class="ruby-identifier">grantee_xml</span>)
196
- 48: <span class="ruby-identifier">permission</span> = <span class="ruby-identifier">g</span>.<span class="ruby-identifier">xget</span>(<span class="ruby-value str">'Permission'</span>)
197
- 49:
198
- 50: <span class="ruby-identifier">grants</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Grant</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">grantee</span>, <span class="ruby-identifier">permission</span>)
199
- 51: <span class="ruby-keyword kw">end</span>
200
- 52:
201
- 53: <span class="ruby-constant">ACLDoc</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">owner</span>, <span class="ruby-identifier">grants</span>)
202
- 54: <span class="ruby-keyword kw">end</span>
203
- </pre>
204
- </div>
205
- </div>
206
- </div>
207
-
208
- <div id="method-M000064" class="method-detail">
209
- <a name="M000064"></a>
210
-
211
- <div class="method-heading">
212
- <a href="#M000064" class="method-signature">
213
- <span class="method-name">new</span><span class="method-args">(owner, grants=[])</span>
214
- </a>
215
- </div>
216
-
217
- <div class="method-description">
218
- <p>
219
- <tt>owner</tt>: <a href="CanonicalUser.html">S33r::S3ACL::CanonicalUser</a>
220
- instance
221
- </p>
222
- <p><a class="source-toggle" href="#"
223
- onclick="toggleCode('M000064-source');return false;">[Source]</a></p>
224
- <div class="method-source-code" id="M000064-source">
225
- <pre>
226
- <span class="ruby-comment cmt"># File lib/s33r/s3_acl.rb, line 25</span>
227
- 25: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">owner</span>, <span class="ruby-identifier">grants</span>=[])
228
- 26: <span class="ruby-ivar">@grants</span> = <span class="ruby-identifier">grants</span>
229
- 27: <span class="ruby-ivar">@owner</span> = <span class="ruby-identifier">owner</span>
230
- 28: <span class="ruby-keyword kw">end</span>
231
- </pre>
232
- </div>
233
- </div>
234
- </div>
235
-
236
- <h3 class="section-bar">Public Instance methods</h3>
237
-
238
- <div id="method-M000067" class="method-detail">
239
- <a name="M000067"></a>
240
-
241
- <div class="method-heading">
242
- <a href="#M000067" class="method-signature">
243
- <span class="method-name">add_grant</span><span class="method-args">(grant)</span>
244
- </a>
245
- </div>
246
-
247
- <div class="method-description">
248
- <p>
249
- Add a grant to the ACL document.
250
- </p>
251
- <p>
252
- Returns true if grant was added; false otherwise (grant already exists).
253
- </p>
254
- <p><a class="source-toggle" href="#"
255
- onclick="toggleCode('M000067-source');return false;">[Source]</a></p>
256
- <div class="method-source-code" id="M000067-source">
257
- <pre>
258
- <span class="ruby-comment cmt"># File lib/s33r/s3_acl.rb, line 83</span>
259
- 83: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_grant</span>(<span class="ruby-identifier">grant</span>)
260
- 84: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@grants</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">grant</span>)
261
- 85: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
262
- 86: <span class="ruby-keyword kw">else</span>
263
- 87: <span class="ruby-ivar">@grants</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">grant</span>
264
- 88: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
265
- 89: <span class="ruby-keyword kw">end</span>
266
- 90: <span class="ruby-keyword kw">end</span>
267
- </pre>
268
- </div>
269
- </div>
270
- </div>
271
-
272
- <div id="method-M000072" class="method-detail">
273
- <a name="M000072"></a>
274
-
275
- <div class="method-heading">
276
- <a href="#M000072" class="method-signature">
277
- <span class="method-name">add_log_target_grants</span><span class="method-args">()</span>
278
- </a>
279
- </div>
280
-
281
- <div class="method-description">
282
- <p>
283
- Add permissions to an instances which give READ_ACL and WRITE permissions
284
- to the LogDelivery group. Used to enable a bucket as a logging destination.
285
- </p>
286
- <p>
287
- Returns true if grants added, false otherwise (if already a log target).
288
- </p>
289
- <p><a class="source-toggle" href="#"
290
- onclick="toggleCode('M000072-source');return false;">[Source]</a></p>
291
- <div class="method-source-code" id="M000072-source">
292
- <pre>
293
- <span class="ruby-comment cmt"># File lib/s33r/s3_acl.rb, line 133</span>
294
- 133: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_log_target_grants</span>
295
- 134: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">log_targetable?</span>
296
- 135: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
297
- 136: <span class="ruby-keyword kw">else</span>
298
- 137: <span class="ruby-constant">Grant</span>.<span class="ruby-identifier">log_target_grants</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">g</span><span class="ruby-operator">|</span> <span class="ruby-identifier">add_grant</span>(<span class="ruby-identifier">g</span>) }
299
- 138: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
300
- 139: <span class="ruby-keyword kw">end</span>
301
- 140: <span class="ruby-keyword kw">end</span>
302
- </pre>
303
- </div>
304
- </div>
305
- </div>
306
-
307
- <div id="method-M000070" class="method-detail">
308
- <a name="M000070"></a>
309
-
310
- <div class="method-heading">
311
- <a href="#M000070" class="method-signature">
312
- <span class="method-name">add_public_read_grant</span><span class="method-args">()</span>
313
- </a>
314
- </div>
315
-
316
- <div class="method-description">
317
- <p>
318
- Add a public READ permission to this instance.
319
- </p>
320
- <p><a class="source-toggle" href="#"
321
- onclick="toggleCode('M000070-source');return false;">[Source]</a></p>
322
- <div class="method-source-code" id="M000070-source">
323
- <pre>
324
- <span class="ruby-comment cmt"># File lib/s33r/s3_acl.rb, line 116</span>
325
- 116: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_public_read_grant</span>
326
- 117: <span class="ruby-identifier">add_grant</span>(<span class="ruby-constant">Grant</span>.<span class="ruby-identifier">public_read_grant</span>)
327
- 118: <span class="ruby-keyword kw">end</span>
328
- </pre>
329
- </div>
330
- </div>
331
- </div>
332
-
333
- <div id="method-M000071" class="method-detail">
334
- <a name="M000071"></a>
335
-
336
- <div class="method-heading">
337
- <a href="#M000071" class="method-signature">
338
- <span class="method-name">log_targetable?</span><span class="method-args">()</span>
339
- </a>
340
- </div>
341
-
342
- <div class="method-description">
343
- <p>
344
- Does the ACL make the associated resource available as a log target?
345
- </p>
346
- <p><a class="source-toggle" href="#"
347
- onclick="toggleCode('M000071-source');return false;">[Source]</a></p>
348
- <div class="method-source-code" id="M000071-source">
349
- <pre>
350
- <span class="ruby-comment cmt"># File lib/s33r/s3_acl.rb, line 121</span>
351
- 121: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">log_targetable?</span>
352
- 122: <span class="ruby-identifier">log_target_grants</span> = <span class="ruby-constant">Grant</span>.<span class="ruby-identifier">log_target_grants</span>
353
- 123: <span class="ruby-identifier">log_target_grants</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">g</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">grants</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">g</span>) }
354
- 124: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
355
- 125: <span class="ruby-keyword kw">end</span>
356
- </pre>
357
- </div>
358
- </div>
359
- </div>
360
-
361
- <div id="method-M000069" class="method-detail">
362
- <a name="M000069"></a>
363
-
364
- <div class="method-heading">
365
- <a href="#M000069" class="method-signature">
366
- <span class="method-name">public_readable?</span><span class="method-args">()</span>
367
- </a>
368
- </div>
369
-
370
- <div class="method-description">
371
- <p>
372
- Does the ACL contain a grant for public reads? (i.e. grants holds a <a
373
- href="Grant.html">Grant</a> object for :all_users with :read permission)
374
- </p>
375
- <p><a class="source-toggle" href="#"
376
- onclick="toggleCode('M000069-source');return false;">[Source]</a></p>
377
- <div class="method-source-code" id="M000069-source">
378
- <pre>
379
- <span class="ruby-comment cmt"># File lib/s33r/s3_acl.rb, line 107</span>
380
- 107: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">public_readable?</span>
381
- 108: <span class="ruby-identifier">pr_grant</span> = <span class="ruby-constant">Grant</span>.<span class="ruby-identifier">public_read_grant</span>
382
- 109: <span class="ruby-identifier">grants</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">g</span><span class="ruby-operator">|</span>
383
- 110: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pr_grant</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">g</span>
384
- 111: <span class="ruby-keyword kw">end</span>
385
- 112: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
386
- 113: <span class="ruby-keyword kw">end</span>
387
- </pre>
388
- </div>
389
- </div>
390
- </div>
391
-
392
- <div id="method-M000068" class="method-detail">
393
- <a name="M000068"></a>
394
-
395
- <div class="method-heading">
396
- <a href="#M000068" class="method-signature">
397
- <span class="method-name">remove_grant</span><span class="method-args">(grant)</span>
398
- </a>
399
- </div>
400
-
401
- <div class="method-description">
402
- <p>
403
- Remove a grant from the ACL document. Note that if you set a grant for an
404
- <a href="AmazonCustomer.html">AmazonCustomer</a>, you want be able to
405
- remove it by specifying the same grant. This is because grants set by <a
406
- href="AmazonCustomer.html">AmazonCustomer</a> are converted at the S3 end
407
- into <a href="CanonicalUser.html">CanonicalUser</a> grants - so you will
408
- need to remove a <a href="CanonicalUser.html">CanonicalUser</a> grant
409
- instead. See <a href="Grant.html#M000078">Grant.for_amazon_customer</a> for
410
- a few more details.
411
- </p>
412
- <p>
413
- Returns true if grant was removed; false if it wasn&#8217;t in the
414
- document.
415
- </p>
416
- <p><a class="source-toggle" href="#"
417
- onclick="toggleCode('M000068-source');return false;">[Source]</a></p>
418
- <div class="method-source-code" id="M000068-source">
419
- <pre>
420
- <span class="ruby-comment cmt"># File lib/s33r/s3_acl.rb, line 101</span>
421
- 101: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove_grant</span>(<span class="ruby-identifier">grant</span>)
422
- 102: <span class="ruby-ivar">@grants</span>.<span class="ruby-identifier">delete_if</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">g</span><span class="ruby-operator">|</span> <span class="ruby-identifier">grant</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">g</span> }
423
- 103: <span class="ruby-keyword kw">end</span>
424
- </pre>
425
- </div>
426
- </div>
427
- </div>
428
-
429
- <div id="method-M000073" class="method-detail">
430
- <a name="M000073"></a>
431
-
432
- <div class="method-heading">
433
- <a href="#M000073" class="method-signature">
434
- <span class="method-name">remove_log_target_grants</span><span class="method-args">()</span>
435
- </a>
436
- </div>
437
-
438
- <div class="method-description">
439
- <p>
440
- Remove log target ACLs from the document.
441
- </p>
442
- <p>
443
- Returns true if all log target grants were removed; false otherwise.
444
- </p>
445
- <p>
446
- NB even if this method returns false, that doesn&#8217;t mean the bucket is
447
- still a log target. Use <a href="ACLDoc.html#M000071">log_targetable?</a>
448
- to check whether a bucket can be used as a log target.
449
- </p>
450
- <p><a class="source-toggle" href="#"
451
- onclick="toggleCode('M000073-source');return false;">[Source]</a></p>
452
- <div class="method-source-code" id="M000073-source">
453
- <pre>
454
- <span class="ruby-comment cmt"># File lib/s33r/s3_acl.rb, line 150</span>
455
- 150: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove_log_target_grants</span>
456
- 151: <span class="ruby-identifier">ok</span> = <span class="ruby-keyword kw">true</span>
457
- 152: <span class="ruby-constant">Grant</span>.<span class="ruby-identifier">log_target_grants</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">g</span><span class="ruby-operator">|</span> <span class="ruby-identifier">ok</span> = <span class="ruby-identifier">ok</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">remove_grant</span>(<span class="ruby-identifier">g</span>) }
458
- 153: <span class="ruby-identifier">ok</span>
459
- 154: <span class="ruby-keyword kw">end</span>
460
- </pre>
461
- </div>
462
- </div>
463
- </div>
464
-
465
- <div id="method-M000066" class="method-detail">
466
- <a name="M000066"></a>
467
-
468
- <div class="method-heading">
469
- <a href="#M000066" class="method-signature">
470
- <span class="method-name">to_xml</span><span class="method-args">()</span>
471
- </a>
472
- </div>
473
-
474
- <div class="method-description">
475
- <p>
476
- Generate AccessControlPolicy <a href="../../XML.html">XML</a> document.
477
- </p>
478
- <p><a class="source-toggle" href="#"
479
- onclick="toggleCode('M000066-source');return false;">[Source]</a></p>
480
- <div class="method-source-code" id="M000066-source">
481
- <pre>
482
- <span class="ruby-comment cmt"># File lib/s33r/s3_acl.rb, line 57</span>
483
- 57: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_xml</span>
484
- 58: <span class="ruby-identifier">xml_str</span> = <span class="ruby-value str">&quot;&quot;</span>
485
- 59: <span class="ruby-identifier">xml</span> = <span class="ruby-constant">Builder</span><span class="ruby-operator">::</span><span class="ruby-constant">XmlMarkup</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">:target</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">xml_str</span>, <span class="ruby-identifier">:indent</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>)
486
- 60:
487
- 61: <span class="ruby-identifier">xml</span>.<span class="ruby-identifier">instruct!</span>
488
- 62:
489
- 63: <span class="ruby-comment cmt"># Access control policy XML.</span>
490
- 64: <span class="ruby-identifier">xml</span>.<span class="ruby-constant">AccessControlPolicy</span>({<span class="ruby-value str">&quot;xmlns&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">RESPONSE_NAMESPACE_URI</span>}) {
491
- 65: <span class="ruby-identifier">xml</span>.<span class="ruby-constant">Owner</span> {
492
- 66: <span class="ruby-identifier">xml</span>.<span class="ruby-constant">ID</span> <span class="ruby-identifier">owner</span>.<span class="ruby-identifier">user_id</span>
493
- 67: <span class="ruby-identifier">xml</span>.<span class="ruby-constant">DisplayName</span> <span class="ruby-identifier">owner</span>.<span class="ruby-identifier">display_name</span>
494
- 68: }
495
- 69: <span class="ruby-identifier">xml</span>.<span class="ruby-constant">AccessControlList</span> {
496
- 70: <span class="ruby-identifier">grants</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">grant</span><span class="ruby-operator">|</span>
497
- 71: <span class="ruby-identifier">xml</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">grant</span>.<span class="ruby-identifier">to_xml</span>
498
- 72: <span class="ruby-keyword kw">end</span>
499
- 73: }
500
- 74: }
501
- 75:
502
- 76: <span class="ruby-identifier">xml_str</span>
503
- 77: <span class="ruby-keyword kw">end</span>
504
- </pre>
505
- </div>
506
- </div>
507
- </div>
508
-
509
-
510
- </div>
511
-
512
-
513
- </div>
514
-
515
-
516
- <div id="validator-badges">
517
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
518
- </div>
519
-
520
- </body>
521
- </html>