corral_acl 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/.rspec +2 -0
  4. data/Gemfile +3 -0
  5. data/LICENSE +22 -0
  6. data/README.md +7 -0
  7. data/corral.gemspec +17 -0
  8. data/doc/Ability.html +257 -0
  9. data/doc/Corral/Ability.html +802 -0
  10. data/doc/Corral/AccessDenied.html +146 -0
  11. data/doc/Corral/AuthorizationNotPerformed.html +145 -0
  12. data/doc/Corral/ControllerAdditions/ClassMethods.html +277 -0
  13. data/doc/Corral/ControllerAdditions.html +513 -0
  14. data/doc/Corral/Error.html +141 -0
  15. data/doc/Corral/Generators/AbilityGenerator.html +195 -0
  16. data/doc/Corral/Generators.html +117 -0
  17. data/doc/Corral/NullRule.html +226 -0
  18. data/doc/Corral/SubjectRule.html +406 -0
  19. data/doc/Corral.html +131 -0
  20. data/doc/_index.html +194 -0
  21. data/doc/class_list.html +51 -0
  22. data/doc/css/common.css +1 -0
  23. data/doc/css/full_list.css +58 -0
  24. data/doc/css/style.css +474 -0
  25. data/doc/doc/_index.html +87 -0
  26. data/doc/doc/class_list.html +51 -0
  27. data/doc/doc/css/common.css +1 -0
  28. data/doc/doc/css/full_list.css +58 -0
  29. data/doc/doc/css/style.css +474 -0
  30. data/doc/doc/file_list.html +51 -0
  31. data/doc/doc/frames.html +17 -0
  32. data/doc/doc/index.html +87 -0
  33. data/doc/doc/js/app.js +243 -0
  34. data/doc/doc/js/full_list.js +216 -0
  35. data/doc/doc/js/jquery.js +4 -0
  36. data/doc/doc/method_list.html +51 -0
  37. data/doc/doc/top-level-namespace.html +102 -0
  38. data/doc/file.README.html +82 -0
  39. data/doc/file_list.html +56 -0
  40. data/doc/frames.html +17 -0
  41. data/doc/index.html +82 -0
  42. data/doc/js/app.js +243 -0
  43. data/doc/js/full_list.js +216 -0
  44. data/doc/js/jquery.js +4 -0
  45. data/doc/method_list.html +211 -0
  46. data/doc/top-level-namespace.html +114 -0
  47. data/lib/corral/ability.rb +85 -0
  48. data/lib/corral/controller_additions.rb +76 -0
  49. data/lib/corral/exceptions.rb +10 -0
  50. data/lib/corral/rule.rb +45 -0
  51. data/lib/corral/version.rb +3 -0
  52. data/lib/corral.rb +5 -0
  53. data/lib/generators/corral/ability/USAGE +4 -0
  54. data/lib/generators/corral/ability/ability_generator.rb +11 -0
  55. data/lib/generators/corral/ability/templates/ability.rb +25 -0
  56. data/spec/corral/ability_spec.rb +26 -0
  57. data/spec/spec_helper.rb +97 -0
  58. metadata +101 -0
@@ -0,0 +1,406 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Class: Corral::SubjectRule
8
+
9
+ &mdash; Documentation by YARD 0.9.0
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "Corral::SubjectRule";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (S)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Corral.html" title="Corral (module)">Corral</a></span></span>
41
+ &raquo;
42
+ <span class="title">SubjectRule</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <iframe id="search_frame" src="../class_list.html"></iframe>
63
+
64
+ <div id="content"><h1>Class: Corral::SubjectRule
65
+
66
+
67
+
68
+ </h1>
69
+ <div class="box_info">
70
+
71
+ <dl>
72
+ <dt>Inherits:</dt>
73
+ <dd>
74
+ <span class="inheritName">Object</span>
75
+
76
+ <ul class="fullTree">
77
+ <li>Object</li>
78
+
79
+ <li class="next">Corral::SubjectRule</li>
80
+
81
+ </ul>
82
+ <a href="#" class="inheritanceTree">show all</a>
83
+
84
+ </dd>
85
+ </dl>
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+ <dl>
98
+ <dt>Defined in:</dt>
99
+ <dd>lib/corral/rule.rb</dd>
100
+ </dl>
101
+
102
+ </div>
103
+
104
+ <h2>Overview</h2><div class="docstring">
105
+ <div class="discussion">
106
+
107
+ <p>Rule class representing actions doable on a subject.</p>
108
+
109
+
110
+ </div>
111
+ </div>
112
+ <div class="tags">
113
+
114
+
115
+ </div>
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+ <h2>
124
+ Instance Method Summary
125
+ <small><a href="#" class="summary_toggle">collapse</a></small>
126
+ </h2>
127
+
128
+ <ul class="summary">
129
+
130
+ <li class="public ">
131
+ <span class="summary_signature">
132
+
133
+ <a href="#add_deny-instance_method" title="#add_deny (instance method)">#<strong>add_deny</strong>(action, block) &#x21d2; Object </a>
134
+
135
+
136
+
137
+ </span>
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+ <span class="summary_desc"><div class='inline'></div></span>
148
+
149
+ </li>
150
+
151
+
152
+ <li class="public ">
153
+ <span class="summary_signature">
154
+
155
+ <a href="#add_grant-instance_method" title="#add_grant (instance method)">#<strong>add_grant</strong>(action, block) &#x21d2; Object </a>
156
+
157
+
158
+
159
+ </span>
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+ <span class="summary_desc"><div class='inline'></div></span>
170
+
171
+ </li>
172
+
173
+
174
+ <li class="public ">
175
+ <span class="summary_signature">
176
+
177
+ <a href="#authorized%3F-instance_method" title="#authorized? (instance method)">#<strong>authorized?</strong>(action, subject, args) &#x21d2; Boolean </a>
178
+
179
+
180
+
181
+ </span>
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+ <span class="summary_desc"><div class='inline'></div></span>
192
+
193
+ </li>
194
+
195
+
196
+ <li class="public ">
197
+ <span class="summary_signature">
198
+
199
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong> &#x21d2; SubjectRule </a>
200
+
201
+
202
+
203
+ </span>
204
+
205
+
206
+ <span class="note title constructor">constructor</span>
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+ <span class="summary_desc"><div class='inline'>
216
+ <p>A new instance of SubjectRule.</p>
217
+ </div></span>
218
+
219
+ </li>
220
+
221
+
222
+ </ul>
223
+
224
+
225
+ <div id="constructor_details" class="method_details_list">
226
+ <h2>Constructor Details</h2>
227
+
228
+ <div class="method_details first">
229
+ <h3 class="signature first" id="initialize-instance_method">
230
+
231
+ #<strong>initialize</strong> &#x21d2; <tt><span class='object_link'><a href="" title="Corral::SubjectRule (class)">SubjectRule</a></span></tt>
232
+
233
+
234
+
235
+
236
+
237
+ </h3><div class="docstring">
238
+ <div class="discussion">
239
+
240
+ <p>Returns a new instance of SubjectRule</p>
241
+
242
+
243
+ </div>
244
+ </div>
245
+ <div class="tags">
246
+
247
+
248
+ </div><table class="source_code">
249
+ <tr>
250
+ <td>
251
+ <pre class="lines">
252
+
253
+
254
+ 4
255
+ 5
256
+ 6</pre>
257
+ </td>
258
+ <td>
259
+ <pre class="code"><span class="info file"># File 'lib/corral/rule.rb', line 4</span>
260
+
261
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
262
+ <span class='ivar'>@actions</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
263
+ <span class='kw'>end</span></pre>
264
+ </td>
265
+ </tr>
266
+ </table>
267
+ </div>
268
+
269
+ </div>
270
+
271
+
272
+ <div id="instance_method_details" class="method_details_list">
273
+ <h2>Instance Method Details</h2>
274
+
275
+
276
+ <div class="method_details first">
277
+ <h3 class="signature first" id="add_deny-instance_method">
278
+
279
+ #<strong>add_deny</strong>(action, block) &#x21d2; <tt>Object</tt>
280
+
281
+
282
+
283
+
284
+
285
+ </h3><table class="source_code">
286
+ <tr>
287
+ <td>
288
+ <pre class="lines">
289
+
290
+
291
+ 12
292
+ 13
293
+ 14</pre>
294
+ </td>
295
+ <td>
296
+ <pre class="code"><span class="info file"># File 'lib/corral/rule.rb', line 12</span>
297
+
298
+ <span class='kw'>def</span> <span class='id identifier rubyid_add_deny'>add_deny</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='comma'>,</span> <span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
299
+ <span class='ivar'>@actions</span><span class='lbracket'>[</span><span class='id identifier rubyid_action'>action</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_block'>block</span> <span class='op'>||</span> <span class='kw'>false</span><span class='rparen'>)</span>
300
+ <span class='kw'>end</span></pre>
301
+ </td>
302
+ </tr>
303
+ </table>
304
+ </div>
305
+
306
+ <div class="method_details ">
307
+ <h3 class="signature " id="add_grant-instance_method">
308
+
309
+ #<strong>add_grant</strong>(action, block) &#x21d2; <tt>Object</tt>
310
+
311
+
312
+
313
+
314
+
315
+ </h3><table class="source_code">
316
+ <tr>
317
+ <td>
318
+ <pre class="lines">
319
+
320
+
321
+ 8
322
+ 9
323
+ 10</pre>
324
+ </td>
325
+ <td>
326
+ <pre class="code"><span class="info file"># File 'lib/corral/rule.rb', line 8</span>
327
+
328
+ <span class='kw'>def</span> <span class='id identifier rubyid_add_grant'>add_grant</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='comma'>,</span> <span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
329
+ <span class='ivar'>@actions</span><span class='lbracket'>[</span><span class='id identifier rubyid_action'>action</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_block'>block</span> <span class='op'>||</span> <span class='kw'>true</span><span class='rparen'>)</span>
330
+ <span class='kw'>end</span></pre>
331
+ </td>
332
+ </tr>
333
+ </table>
334
+ </div>
335
+
336
+ <div class="method_details ">
337
+ <h3 class="signature " id="authorized?-instance_method">
338
+
339
+ #<strong>authorized?</strong>(action, subject, args) &#x21d2; <tt>Boolean</tt>
340
+
341
+
342
+
343
+
344
+
345
+ </h3><div class="docstring">
346
+ <div class="discussion">
347
+
348
+
349
+ </div>
350
+ </div>
351
+ <div class="tags">
352
+
353
+ <p class="tag_title">Returns:</p>
354
+ <ul class="return">
355
+
356
+ <li>
357
+
358
+
359
+ <span class='type'>(<tt>Boolean</tt>)</span>
360
+
361
+
362
+
363
+ </li>
364
+
365
+ </ul>
366
+
367
+ </div><table class="source_code">
368
+ <tr>
369
+ <td>
370
+ <pre class="lines">
371
+
372
+
373
+ 16
374
+ 17
375
+ 18
376
+ 19
377
+ 20
378
+ 21</pre>
379
+ </td>
380
+ <td>
381
+ <pre class="code"><span class="info file"># File 'lib/corral/rule.rb', line 16</span>
382
+
383
+ <span class='kw'>def</span> <span class='id identifier rubyid_authorized?'>authorized?</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='comma'>,</span> <span class='id identifier rubyid_subject'>subject</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
384
+ <span class='id identifier rubyid_block'>block</span> <span class='op'>=</span> <span class='ivar'>@actions</span><span class='lbracket'>[</span><span class='symbol'>:manage</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='ivar'>@actions</span><span class='lbracket'>[</span><span class='id identifier rubyid_action'>action</span><span class='rbracket'>]</span>
385
+ <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block'>block</span>
386
+ <span class='kw'>return</span> <span class='kw'>true</span> <span class='kw'>if</span> <span class='id identifier rubyid_block'>block</span> <span class='op'>==</span> <span class='kw'>true</span>
387
+ <span class='kw'>return</span> <span class='op'>!</span><span class='op'>!</span><span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='op'>*</span><span class='lbracket'>[</span><span class='id identifier rubyid_subject'>subject</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rbracket'>]</span><span class='rparen'>)</span>
388
+ <span class='kw'>end</span></pre>
389
+ </td>
390
+ </tr>
391
+ </table>
392
+ </div>
393
+
394
+ </div>
395
+
396
+ </div>
397
+
398
+ <div id="footer">
399
+ Generated on Wed Jul 6 11:22:31 2016 by
400
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
401
+ 0.9.0 (ruby-2.3.1).
402
+ </div>
403
+
404
+ </div>
405
+ </body>
406
+ </html>
data/doc/Corral.html ADDED
@@ -0,0 +1,131 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Module: Corral
8
+
9
+ &mdash; Documentation by YARD 0.9.0
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "Corral";
19
+ relpath = '';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="class_list.html"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="_index.html">Index (C)</a> &raquo;
40
+
41
+
42
+ <span class="title">Corral</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <iframe id="search_frame" src="class_list.html"></iframe>
63
+
64
+ <div id="content"><h1>Module: Corral
65
+
66
+
67
+
68
+ </h1>
69
+ <div class="box_info">
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ <dl>
82
+ <dt>Defined in:</dt>
83
+ <dd>lib/corral/rule.rb<span class="defines">,<br />
84
+ lib/corral/ability.rb,<br /> lib/corral/version.rb,<br /> lib/corral/exceptions.rb,<br /> lib/corral/controller_additions.rb,<br /> lib/generators/corral/ability/ability_generator.rb</span>
85
+ </dd>
86
+ </dl>
87
+
88
+ </div>
89
+
90
+ <h2>Defined Under Namespace</h2>
91
+ <p class="children">
92
+
93
+
94
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Corral/Ability.html" title="Corral::Ability (module)">Ability</a></span>, <span class='object_link'><a href="Corral/ControllerAdditions.html" title="Corral::ControllerAdditions (module)">ControllerAdditions</a></span>, <span class='object_link'><a href="Corral/Generators.html" title="Corral::Generators (module)">Generators</a></span>
95
+
96
+
97
+
98
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Corral/AccessDenied.html" title="Corral::AccessDenied (class)">AccessDenied</a></span>, <span class='object_link'><a href="Corral/AuthorizationNotPerformed.html" title="Corral::AuthorizationNotPerformed (class)">AuthorizationNotPerformed</a></span>, <span class='object_link'><a href="Corral/Error.html" title="Corral::Error (class)">Error</a></span>
99
+
100
+
101
+ </p>
102
+
103
+ <h2>Constant Summary</h2>
104
+ <dl class="constants">
105
+
106
+ <dt id="VERSION-constant" class="">VERSION =
107
+
108
+ </dt>
109
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.9.0</span><span class='tstring_end'>&quot;</span></span></pre></dd>
110
+
111
+ </dl>
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+ </div>
122
+
123
+ <div id="footer">
124
+ Generated on Wed Jul 6 11:31:38 2016 by
125
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
126
+ 0.9.0 (ruby-2.3.1).
127
+ </div>
128
+
129
+ </div>
130
+ </body>
131
+ </html>