s33r 0.3.1 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. data/examples/cli/acl_x.rb +41 -0
  2. data/examples/cli/logging_x.rb +20 -0
  3. data/{bin → examples/cli}/s3cli.rb +13 -20
  4. data/examples/fores33r/README +183 -0
  5. data/examples/fores33r/Rakefile +10 -0
  6. data/examples/fores33r/app/controllers/application.rb +4 -0
  7. data/examples/fores33r/app/controllers/browser_controller.rb +68 -0
  8. data/examples/fores33r/app/helpers/application_helper.rb +8 -0
  9. data/examples/fores33r/app/views/browser/index.rhtml +14 -0
  10. data/examples/fores33r/app/views/browser/show_bucket.rhtml +14 -0
  11. data/examples/fores33r/app/views/layouts/application.rhtml +29 -0
  12. data/examples/fores33r/config/boot.rb +44 -0
  13. data/examples/fores33r/config/database.yml +35 -0
  14. data/examples/fores33r/config/environment.rb +64 -0
  15. data/examples/fores33r/config/environments/development.rb +21 -0
  16. data/examples/fores33r/config/environments/production.rb +18 -0
  17. data/examples/fores33r/config/environments/test.rb +19 -0
  18. data/examples/fores33r/config/routes.rb +23 -0
  19. data/examples/fores33r/doc/README_FOR_APP +2 -0
  20. data/examples/fores33r/log/development.log +5507 -0
  21. data/examples/fores33r/log/production.log +0 -0
  22. data/examples/fores33r/log/server.log +0 -0
  23. data/examples/fores33r/log/test.log +0 -0
  24. data/examples/fores33r/public/404.html +8 -0
  25. data/examples/fores33r/public/500.html +8 -0
  26. data/examples/fores33r/public/dispatch.cgi +10 -0
  27. data/examples/fores33r/public/dispatch.fcgi +24 -0
  28. data/examples/fores33r/public/dispatch.rb +10 -0
  29. data/examples/fores33r/public/favicon.ico +0 -0
  30. data/examples/fores33r/public/images/rails.png +0 -0
  31. data/examples/fores33r/public/javascripts/application.js +2 -0
  32. data/examples/fores33r/public/javascripts/controls.js +815 -0
  33. data/examples/fores33r/public/javascripts/dragdrop.js +913 -0
  34. data/examples/fores33r/public/javascripts/effects.js +958 -0
  35. data/examples/fores33r/public/javascripts/prototype.js +2006 -0
  36. data/examples/fores33r/public/robots.txt +1 -0
  37. data/examples/fores33r/public/stylesheets/core.css +37 -0
  38. data/examples/fores33r/script/about +3 -0
  39. data/examples/fores33r/script/breakpointer +3 -0
  40. data/examples/fores33r/script/console +3 -0
  41. data/examples/fores33r/script/destroy +3 -0
  42. data/examples/fores33r/script/generate +3 -0
  43. data/examples/fores33r/script/performance/benchmarker +3 -0
  44. data/examples/fores33r/script/performance/profiler +3 -0
  45. data/examples/fores33r/script/plugin +3 -0
  46. data/examples/fores33r/script/process/reaper +3 -0
  47. data/examples/fores33r/script/process/spawner +3 -0
  48. data/examples/fores33r/script/runner +3 -0
  49. data/examples/fores33r/script/server +3 -0
  50. data/examples/fores33r/test/test_helper.rb +28 -0
  51. data/examples/fores33r/tmp/sessions/ruby_sess.39d37e054d21d545 +0 -0
  52. data/examples/fores33r/tmp/sessions/ruby_sess.acf71fc73aa74983 +0 -0
  53. data/examples/fores33r/tmp/sessions/ruby_sess.c1697b7d6670f3cd +0 -0
  54. data/examples/s3.yaml +11 -0
  55. data/html/classes/Net/HTTPGenericRequest.html +32 -32
  56. data/html/classes/Net/HTTPResponse.html +20 -19
  57. data/html/classes/S33r.html +422 -190
  58. data/html/classes/S33r/BucketListing.html +107 -70
  59. data/html/classes/S33r/Client.html +888 -414
  60. data/html/classes/S33r/LoggingResource.html +222 -0
  61. data/html/classes/S33r/NamedBucket.html +149 -150
  62. data/html/classes/S33r/OrderlyXmlMarkup.html +165 -0
  63. data/html/classes/S33r/S33rException.html +3 -0
  64. data/html/classes/S33r/S33rException/BucketNotLogTargetable.html +119 -0
  65. data/html/classes/S33r/S33rException/InvalidPermission.html +111 -0
  66. data/html/classes/S33r/S33rException/InvalidS3GroupType.html +111 -0
  67. data/html/classes/S33r/S3ACL.html +125 -0
  68. data/html/classes/S33r/S3ACL/ACLDoc.html +521 -0
  69. data/html/classes/S33r/{S3User.html → S3ACL/AmazonCustomer.html} +27 -30
  70. data/html/classes/S33r/S3ACL/CanonicalUser.html +212 -0
  71. data/html/classes/S33r/S3ACL/Grant.html +403 -0
  72. data/html/classes/S33r/S3ACL/Grantee.html +239 -0
  73. data/html/classes/S33r/S3ACL/Group.html +178 -0
  74. data/html/classes/S33r/S3Object.html +53 -50
  75. data/html/classes/S33r/Sync.html +6 -6
  76. data/html/classes/XML.html +4 -2
  77. data/html/created.rid +1 -1
  78. data/html/files/README_txt.html +82 -28
  79. data/html/files/lib/s33r/bucket_listing_rb.html +1 -8
  80. data/html/files/lib/s33r/builder_rb.html +108 -0
  81. data/html/files/lib/s33r/client_rb.html +2 -1
  82. data/html/files/lib/s33r/core_rb.html +2 -1
  83. data/html/files/lib/s33r/libxml_extensions_rb.html +1 -1
  84. data/html/files/lib/s33r/logging_rb.html +109 -0
  85. data/html/files/lib/s33r/named_bucket_rb.html +1 -1
  86. data/html/files/lib/s33r/s33r_exception_rb.html +1 -1
  87. data/html/files/lib/s33r/s33r_http_rb.html +1 -1
  88. data/html/files/lib/s33r/s3_acl_rb.html +109 -0
  89. data/html/fr_class_index.html +12 -1
  90. data/html/fr_file_index.html +3 -0
  91. data/html/fr_method_index.html +101 -57
  92. data/lib/s33r/bucket_listing.rb +21 -22
  93. data/lib/s33r/builder.rb +20 -0
  94. data/lib/s33r/client.rb +240 -42
  95. data/lib/s33r/core.rb +106 -36
  96. data/lib/s33r/libxml_extensions.rb +2 -2
  97. data/lib/s33r/logging.rb +43 -0
  98. data/lib/s33r/named_bucket.rb +16 -17
  99. data/lib/s33r/s33r_exception.rb +11 -0
  100. data/lib/s33r/s33r_http.rb +2 -1
  101. data/lib/s33r/s3_acl.rb +337 -0
  102. data/test/cases/spec_acl.rb +146 -0
  103. data/test/cases/spec_all_buckets.rb +28 -0
  104. data/test/cases/spec_bucket_listing.rb +2 -2
  105. data/test/cases/spec_client.rb +45 -18
  106. data/test/cases/spec_core.rb +0 -9
  107. data/test/cases/spec_namedbucket.rb +3 -3
  108. data/test/files/acl.xml +47 -0
  109. data/test/files/acl_grant1.xml +7 -0
  110. data/test/files/acl_grant2.xml +6 -0
  111. data/test/files/acl_grant3.xml +6 -0
  112. data/test/files/acl_grant4.xml +6 -0
  113. data/test/files/all_buckets.xml +21 -0
  114. data/test/files/bucket_listing.xml +138 -1
  115. data/test/files/client_config.yml +0 -1
  116. data/test/files/logging_acl.xml +34 -0
  117. data/test/files/namedbucket_config.yml +1 -5
  118. data/test/files/namedbucket_config2.yml +1 -5
  119. data/test/test_setup.rb +1 -0
  120. metadata +132 -7
@@ -0,0 +1,125 @@
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>
@@ -0,0 +1,521 @@
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_grants</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 34</span>
183
+ 34: <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
+ 35: <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
+ 36:
186
+ 37: <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
+ 38: <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
+ 39:
189
+ 40: <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
+ 41: <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
+ 42:
192
+ 43: <span class="ruby-identifier">grants</span> = []
193
+ 44: <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
+ 45: <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
+ 46: <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
+ 47: <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
+ 48:
198
+ 49: <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
+ 50: <span class="ruby-keyword kw">end</span>
200
+ 51:
201
+ 52: <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
+ 53: <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 24</span>
227
+ 24: <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
+ 25: <span class="ruby-ivar">@grants</span> = <span class="ruby-identifier">grants</span>
229
+ 26: <span class="ruby-ivar">@owner</span> = <span class="ruby-identifier">owner</span>
230
+ 27: <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 82</span>
259
+ 82: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_grant</span>(<span class="ruby-identifier">grant</span>)
260
+ 83: <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
+ 84: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
262
+ 85: <span class="ruby-keyword kw">else</span>
263
+ 86: <span class="ruby-ivar">@grants</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">grant</span>
264
+ 87: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
265
+ 88: <span class="ruby-keyword kw">end</span>
266
+ 89: <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 132</span>
294
+ 132: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_log_target_grants</span>
295
+ 133: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">log_targetable?</span>
296
+ 134: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
297
+ 135: <span class="ruby-keyword kw">else</span>
298
+ 136: <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
+ 137: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
300
+ 138: <span class="ruby-keyword kw">end</span>
301
+ 139: <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_grants</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 115</span>
325
+ 115: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_public_read_grants</span>
326
+ 116: <span class="ruby-identifier">add_grant</span>(<span class="ruby-constant">Grant</span>.<span class="ruby-identifier">public_read_grant</span>)
327
+ 117: <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 120</span>
351
+ 120: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">log_targetable?</span>
352
+ 121: <span class="ruby-identifier">log_target_grants</span> = <span class="ruby-constant">Grant</span>.<span class="ruby-identifier">log_target_grants</span>
353
+ 122: <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
+ 123: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
355
+ 124: <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 106</span>
380
+ 106: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">public_readable?</span>
381
+ 107: <span class="ruby-identifier">pr_grant</span> = <span class="ruby-constant">Grant</span>.<span class="ruby-identifier">public_read_grant</span>
382
+ 108: <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
+ 109: <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
+ 110: <span class="ruby-keyword kw">end</span>
385
+ 111: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
386
+ 112: <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 100</span>
421
+ 100: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove_grant</span>(<span class="ruby-identifier">grant</span>)
422
+ 101: <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
+ 102: <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 149</span>
455
+ 149: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove_log_target_grants</span>
456
+ 150: <span class="ruby-identifier">ok</span> = <span class="ruby-keyword kw">true</span>
457
+ 151: <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
+ 152: <span class="ruby-identifier">ok</span>
459
+ 153: <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 56</span>
483
+ 56: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_xml</span>
484
+ 57: <span class="ruby-identifier">xml_str</span> = <span class="ruby-value str">&quot;&quot;</span>
485
+ 58: <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
+ 59:
487
+ 60: <span class="ruby-identifier">xml</span>.<span class="ruby-identifier">instruct!</span>
488
+ 61:
489
+ 62: <span class="ruby-comment cmt"># Access control policy XML.</span>
490
+ 63: <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
+ 64: <span class="ruby-identifier">xml</span>.<span class="ruby-constant">Owner</span> {
492
+ 65: <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
+ 66: <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
+ 67: }
495
+ 68: <span class="ruby-identifier">xml</span>.<span class="ruby-constant">AccessControlList</span> {
496
+ 69: <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
+ 70: <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
+ 71: <span class="ruby-keyword kw">end</span>
499
+ 72: }
500
+ 73: }
501
+ 74:
502
+ 75: <span class="ruby-identifier">xml_str</span>
503
+ 76: <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>