corral_acl 0.9.0 → 0.9.1

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 (111) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +7 -1
  3. data/Gemfile +12 -1
  4. data/LICENSE +1 -1
  5. data/README.md +2 -2
  6. data/Rakefile +34 -0
  7. data/bin/test +9 -0
  8. data/corral.gemspec +12 -12
  9. data/lib/corral/version.rb +1 -1
  10. data/lib/tasks/corral_tasks.rake +4 -0
  11. data/test/corral_test.rb +7 -0
  12. data/test/dummy/Rakefile +6 -0
  13. data/test/dummy/app/assets/config/manifest.js +4 -0
  14. data/test/dummy/app/assets/images/.keep +0 -0
  15. data/test/dummy/app/assets/javascripts/application.js +13 -0
  16. data/test/dummy/app/assets/javascripts/cable.js +13 -0
  17. data/test/dummy/app/assets/javascripts/channels/.keep +0 -0
  18. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  19. data/test/dummy/app/channels/application_cable/channel.rb +4 -0
  20. data/test/dummy/app/channels/application_cable/connection.rb +4 -0
  21. data/test/dummy/app/controllers/application_controller.rb +3 -0
  22. data/test/dummy/app/controllers/concerns/.keep +0 -0
  23. data/test/dummy/app/helpers/application_helper.rb +2 -0
  24. data/test/dummy/app/jobs/application_job.rb +2 -0
  25. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  26. data/test/dummy/app/models/application_record.rb +3 -0
  27. data/test/dummy/app/models/concerns/.keep +0 -0
  28. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  29. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  30. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  31. data/test/dummy/bin/bundle +3 -0
  32. data/test/dummy/bin/rails +4 -0
  33. data/test/dummy/bin/rake +4 -0
  34. data/test/dummy/bin/setup +34 -0
  35. data/test/dummy/bin/update +29 -0
  36. data/test/dummy/config.ru +5 -0
  37. data/test/dummy/config/application.rb +15 -0
  38. data/test/dummy/config/boot.rb +5 -0
  39. data/test/dummy/config/cable.yml +9 -0
  40. data/test/dummy/config/database.yml +25 -0
  41. data/test/dummy/config/environment.rb +5 -0
  42. data/test/dummy/config/environments/development.rb +54 -0
  43. data/test/dummy/config/environments/production.rb +86 -0
  44. data/test/dummy/config/environments/test.rb +42 -0
  45. data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
  46. data/test/dummy/config/initializers/assets.rb +11 -0
  47. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  48. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  49. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  50. data/test/dummy/config/initializers/inflections.rb +16 -0
  51. data/test/dummy/config/initializers/mime_types.rb +4 -0
  52. data/test/dummy/config/initializers/new_framework_defaults.rb +24 -0
  53. data/test/dummy/config/initializers/session_store.rb +3 -0
  54. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  55. data/test/dummy/config/locales/en.yml +23 -0
  56. data/test/dummy/config/puma.rb +47 -0
  57. data/test/dummy/config/routes.rb +3 -0
  58. data/test/dummy/config/secrets.yml +22 -0
  59. data/test/dummy/config/spring.rb +6 -0
  60. data/test/dummy/lib/assets/.keep +0 -0
  61. data/test/dummy/log/.keep +0 -0
  62. data/test/dummy/public/404.html +67 -0
  63. data/test/dummy/public/422.html +67 -0
  64. data/test/dummy/public/500.html +66 -0
  65. data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
  66. data/test/dummy/public/apple-touch-icon.png +0 -0
  67. data/test/dummy/public/favicon.ico +0 -0
  68. data/test/test_helper.rb +20 -0
  69. metadata +90 -51
  70. data/.rspec +0 -2
  71. data/doc/Ability.html +0 -257
  72. data/doc/Corral.html +0 -131
  73. data/doc/Corral/Ability.html +0 -802
  74. data/doc/Corral/AccessDenied.html +0 -146
  75. data/doc/Corral/AuthorizationNotPerformed.html +0 -145
  76. data/doc/Corral/ControllerAdditions.html +0 -513
  77. data/doc/Corral/ControllerAdditions/ClassMethods.html +0 -277
  78. data/doc/Corral/Error.html +0 -141
  79. data/doc/Corral/Generators.html +0 -117
  80. data/doc/Corral/Generators/AbilityGenerator.html +0 -195
  81. data/doc/Corral/NullRule.html +0 -226
  82. data/doc/Corral/SubjectRule.html +0 -406
  83. data/doc/_index.html +0 -194
  84. data/doc/class_list.html +0 -51
  85. data/doc/css/common.css +0 -1
  86. data/doc/css/full_list.css +0 -58
  87. data/doc/css/style.css +0 -474
  88. data/doc/doc/_index.html +0 -87
  89. data/doc/doc/class_list.html +0 -51
  90. data/doc/doc/css/common.css +0 -1
  91. data/doc/doc/css/full_list.css +0 -58
  92. data/doc/doc/css/style.css +0 -474
  93. data/doc/doc/file_list.html +0 -51
  94. data/doc/doc/frames.html +0 -17
  95. data/doc/doc/index.html +0 -87
  96. data/doc/doc/js/app.js +0 -243
  97. data/doc/doc/js/full_list.js +0 -216
  98. data/doc/doc/js/jquery.js +0 -4
  99. data/doc/doc/method_list.html +0 -51
  100. data/doc/doc/top-level-namespace.html +0 -102
  101. data/doc/file.README.html +0 -82
  102. data/doc/file_list.html +0 -56
  103. data/doc/frames.html +0 -17
  104. data/doc/index.html +0 -82
  105. data/doc/js/app.js +0 -243
  106. data/doc/js/full_list.js +0 -216
  107. data/doc/js/jquery.js +0 -4
  108. data/doc/method_list.html +0 -211
  109. data/doc/top-level-namespace.html +0 -114
  110. data/spec/corral/ability_spec.rb +0 -26
  111. data/spec/spec_helper.rb +0 -97
data/doc/Corral.html DELETED
@@ -1,131 +0,0 @@
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>
@@ -1,802 +0,0 @@
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::Ability
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::Ability";
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 (A)</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">Ability</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::Ability
65
-
66
-
67
-
68
- </h1>
69
- <div class="box_info">
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
-
78
-
79
- <dl>
80
- <dt>Included in:</dt>
81
- <dd><span class='object_link'><a href="../Ability.html" title="Ability (class)">Ability</a></span></dd>
82
- </dl>
83
-
84
-
85
-
86
- <dl>
87
- <dt>Defined in:</dt>
88
- <dd>lib/corral/ability.rb</dd>
89
- </dl>
90
-
91
- </div>
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
- <h2>
102
- Instance Method Summary
103
- <small><a href="#" class="summary_toggle">collapse</a></small>
104
- </h2>
105
-
106
- <ul class="summary">
107
-
108
- <li class="public ">
109
- <span class="summary_signature">
110
-
111
- <a href="#allow_anything%21-instance_method" title="#allow_anything! (instance method)">#<strong>allow_anything!</strong> &#x21d2; Object </a>
112
-
113
-
114
-
115
- </span>
116
-
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
-
125
- <span class="summary_desc"><div class='inline'>
126
- <p>Allow the object to perform any action on any subject.</p>
127
- </div></span>
128
-
129
- </li>
130
-
131
-
132
- <li class="public ">
133
- <span class="summary_signature">
134
-
135
- <a href="#authorize%21-instance_method" title="#authorize! (instance method)">#<strong>authorize!</strong>(action, subject, *args) &#x21d2; Object </a>
136
-
137
-
138
-
139
- </span>
140
-
141
-
142
-
143
-
144
-
145
-
146
-
147
-
148
-
149
- <span class="summary_desc"><div class='inline'>
150
- <p>Check whether the object has authorization to perform the action it intends
151
- to on the subject.</p>
152
- </div></span>
153
-
154
- </li>
155
-
156
-
157
- <li class="public ">
158
- <span class="summary_signature">
159
-
160
- <a href="#can-instance_method" title="#can (instance method)">#<strong>can</strong>(action, subject, &amp;block) &#x21d2; Object </a>
161
-
162
-
163
-
164
- </span>
165
-
166
-
167
-
168
-
169
-
170
-
171
-
172
-
173
-
174
- <span class="summary_desc"><div class='inline'>
175
- <p>Adds a granting-access rule.</p>
176
- </div></span>
177
-
178
- </li>
179
-
180
-
181
- <li class="public ">
182
- <span class="summary_signature">
183
-
184
- <a href="#can%3F-instance_method" title="#can? (instance method)">#<strong>can?</strong>(action, subject, *args) &#x21d2; Boolean </a>
185
-
186
-
187
-
188
- </span>
189
-
190
-
191
-
192
-
193
-
194
-
195
-
196
-
197
-
198
- <span class="summary_desc"><div class='inline'>
199
- <p>Check whether the object can perform an action on a subject.</p>
200
- </div></span>
201
-
202
- </li>
203
-
204
-
205
- <li class="public ">
206
- <span class="summary_signature">
207
-
208
- <a href="#cannot-instance_method" title="#cannot (instance method)">#<strong>cannot</strong>(action, subject, &amp;block) &#x21d2; Object </a>
209
-
210
-
211
-
212
- </span>
213
-
214
-
215
-
216
-
217
-
218
-
219
-
220
-
221
-
222
- <span class="summary_desc"><div class='inline'>
223
- <p>Inverse of #can.</p>
224
- </div></span>
225
-
226
- </li>
227
-
228
-
229
- <li class="public ">
230
- <span class="summary_signature">
231
-
232
- <a href="#cannot%3F-instance_method" title="#cannot? (instance method)">#<strong>cannot?</strong>(*args) &#x21d2; Boolean </a>
233
-
234
-
235
-
236
- </span>
237
-
238
-
239
-
240
-
241
-
242
-
243
-
244
-
245
-
246
- <span class="summary_desc"><div class='inline'>
247
- <p>Inverse of #can?.</p>
248
- </div></span>
249
-
250
- </li>
251
-
252
-
253
- </ul>
254
-
255
-
256
-
257
-
258
- <div id="instance_method_details" class="method_details_list">
259
- <h2>Instance Method Details</h2>
260
-
261
-
262
- <div class="method_details first">
263
- <h3 class="signature first" id="allow_anything!-instance_method">
264
-
265
- #<strong>allow_anything!</strong> &#x21d2; <tt>Object</tt>
266
-
267
-
268
-
269
-
270
-
271
- </h3><div class="docstring">
272
- <div class="discussion">
273
-
274
- <p>Allow the object to perform any action on any subject. This overrides any
275
- #cannot rules.</p>
276
-
277
-
278
- </div>
279
- </div>
280
- <div class="tags">
281
-
282
-
283
- </div><table class="source_code">
284
- <tr>
285
- <td>
286
- <pre class="lines">
287
-
288
-
289
- 44
290
- 45
291
- 46</pre>
292
- </td>
293
- <td>
294
- <pre class="code"><span class="info file"># File 'lib/corral/ability.rb', line 44</span>
295
-
296
- <span class='kw'>def</span> <span class='id identifier rubyid_allow_anything!'>allow_anything!</span>
297
- <span class='ivar'>@allow_anything</span> <span class='op'>=</span> <span class='kw'>true</span>
298
- <span class='kw'>end</span></pre>
299
- </td>
300
- </tr>
301
- </table>
302
- </div>
303
-
304
- <div class="method_details ">
305
- <h3 class="signature " id="authorize!-instance_method">
306
-
307
- #<strong>authorize!</strong>(action, subject, *args) &#x21d2; <tt>Object</tt>
308
-
309
-
310
-
311
-
312
-
313
- </h3><div class="docstring">
314
- <div class="discussion">
315
-
316
- <p>Check whether the object has authorization to perform the action it intends
317
- to on the subject. Raise AccessDenied if it doesn&#39;t.</p>
318
-
319
-
320
- </div>
321
- </div>
322
- <div class="tags">
323
- <p class="tag_title">Parameters:</p>
324
- <ul class="param">
325
-
326
- <li>
327
-
328
- <span class='name'>action</span>
329
-
330
-
331
- <span class='type'>(<tt>Symbol</tt>)</span>
332
-
333
-
334
-
335
- &mdash;
336
- <div class='inline'>
337
- <p>The intended action.</p>
338
- </div>
339
-
340
- </li>
341
-
342
- <li>
343
-
344
- <span class='name'>subject</span>
345
-
346
-
347
- <span class='type'>(<tt>Object</tt>)</span>
348
-
349
-
350
-
351
- &mdash;
352
- <div class='inline'>
353
- <p>The subject of the action.</p>
354
- </div>
355
-
356
- </li>
357
-
358
- </ul>
359
-
360
- <p class="tag_title">Raises:</p>
361
- <ul class="raise">
362
-
363
- <li>
364
-
365
-
366
- <span class='type'>(<tt><span class='object_link'><a href="AccessDenied.html" title="Corral::AccessDenied (class)">AccessDenied</a></span></tt>)</span>
367
-
368
-
369
-
370
- &mdash;
371
- <div class='inline'>
372
- <p>if the object does not have permission.</p>
373
- </div>
374
-
375
- </li>
376
-
377
- </ul>
378
-
379
- </div><table class="source_code">
380
- <tr>
381
- <td>
382
- <pre class="lines">
383
-
384
-
385
- 55
386
- 56
387
- 57</pre>
388
- </td>
389
- <td>
390
- <pre class="code"><span class="info file"># File 'lib/corral/ability.rb', line 55</span>
391
-
392
- <span class='kw'>def</span> <span class='id identifier rubyid_authorize!'>authorize!</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='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
393
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>AccessDenied</span> <span class='kw'>if</span> <span class='id identifier rubyid_cannot?'>cannot?</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='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
394
- <span class='kw'>end</span></pre>
395
- </td>
396
- </tr>
397
- </table>
398
- </div>
399
-
400
- <div class="method_details ">
401
- <h3 class="signature " id="can-instance_method">
402
-
403
- #<strong>can</strong>(action, subject, &amp;block) &#x21d2; <tt>Object</tt>
404
-
405
-
406
-
407
-
408
-
409
- </h3><div class="docstring">
410
- <div class="discussion">
411
-
412
- <p>Adds a granting-access rule.</p>
413
-
414
-
415
- </div>
416
- </div>
417
- <div class="tags">
418
- <p class="tag_title">Parameters:</p>
419
- <ul class="param">
420
-
421
- <li>
422
-
423
- <span class='name'>action</span>
424
-
425
-
426
- <span class='type'>(<tt>Symbol</tt>)</span>
427
-
428
-
429
-
430
- &mdash;
431
- <div class='inline'>
432
- <p>The action, represented as a symbol.</p>
433
- </div>
434
-
435
- </li>
436
-
437
- <li>
438
-
439
- <span class='name'>subject</span>
440
-
441
-
442
- <span class='type'>(<tt>Object</tt>)</span>
443
-
444
-
445
-
446
- &mdash;
447
- <div class='inline'>
448
- <p>The subject.</p>
449
- </div>
450
-
451
- </li>
452
-
453
- <li>
454
-
455
- <span class='name'>block</span>
456
-
457
-
458
- <span class='type'>(<tt>Hash</tt>)</span>
459
-
460
-
461
-
462
- &mdash;
463
- <div class='inline'>
464
- <p>Variable arguments for more granular matching.</p>
465
- </div>
466
-
467
- </li>
468
-
469
- </ul>
470
-
471
-
472
- </div><table class="source_code">
473
- <tr>
474
- <td>
475
- <pre class="lines">
476
-
477
-
478
- 30
479
- 31
480
- 32</pre>
481
- </td>
482
- <td>
483
- <pre class="code"><span class="info file"># File 'lib/corral/ability.rb', line 30</span>
484
-
485
- <span class='kw'>def</span> <span class='id identifier rubyid_can'>can</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='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
486
- <span class='id identifier rubyid_rule_for'>rule_for</span><span class='lparen'>(</span><span class='id identifier rubyid_subject'>subject</span><span class='rparen'>)</span><span class='period'>.</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>
487
- <span class='kw'>end</span></pre>
488
- </td>
489
- </tr>
490
- </table>
491
- </div>
492
-
493
- <div class="method_details ">
494
- <h3 class="signature " id="can?-instance_method">
495
-
496
-
497
- <span class="overload">#<strong>can?</strong>(action, subject) &#x21d2; <tt>Boolean</tt> </span>
498
-
499
- <span class="overload">#<strong>can?</strong>(action, subject, args) &#x21d2; <tt>Boolean</tt> </span>
500
-
501
-
502
-
503
-
504
-
505
-
506
- </h3><div class="docstring">
507
- <div class="discussion">
508
-
509
- <p>Check whether the object can perform an action on a subject.</p>
510
-
511
-
512
- </div>
513
- </div>
514
- <div class="tags">
515
-
516
- <p class="tag_title">Overloads:</p>
517
- <ul class="overload">
518
-
519
-
520
- <li class="overload_item">
521
- <span class="signature">#<strong>can?</strong>(action, subject) &#x21d2; <tt>Boolean</tt> </span>
522
- <div class="docstring">
523
- <div class="discussion">
524
-
525
-
526
- </div>
527
- </div>
528
- <div class="tags">
529
- <p class="tag_title">Parameters:</p>
530
- <ul class="param">
531
-
532
- <li>
533
-
534
- <span class='name'>action</span>
535
-
536
-
537
- <span class='type'>(<tt>Symbol</tt>)</span>
538
-
539
-
540
-
541
- &mdash;
542
- <div class='inline'>
543
- <p>The action, represented as a symbol.</p>
544
- </div>
545
-
546
- </li>
547
-
548
- <li>
549
-
550
- <span class='name'>subject</span>
551
-
552
-
553
- <span class='type'>(<tt>Object</tt>)</span>
554
-
555
-
556
-
557
- &mdash;
558
- <div class='inline'>
559
- <p>The subject.</p>
560
- </div>
561
-
562
- </li>
563
-
564
- </ul>
565
-
566
-
567
- </div>
568
- </li>
569
-
570
-
571
- <li class="overload_item">
572
- <span class="signature">#<strong>can?</strong>(action, subject, args) &#x21d2; <tt>Boolean</tt> </span>
573
- <div class="docstring">
574
- <div class="discussion">
575
-
576
-
577
- </div>
578
- </div>
579
- <div class="tags">
580
- <p class="tag_title">Parameters:</p>
581
- <ul class="param">
582
-
583
- <li>
584
-
585
- <span class='name'>action</span>
586
-
587
-
588
- <span class='type'>(<tt>Symbol</tt>)</span>
589
-
590
-
591
-
592
- &mdash;
593
- <div class='inline'>
594
- <p>The action, represented as a symbol.</p>
595
- </div>
596
-
597
- </li>
598
-
599
- <li>
600
-
601
- <span class='name'>subject</span>
602
-
603
-
604
- <span class='type'>(<tt>Object</tt>)</span>
605
-
606
-
607
-
608
- &mdash;
609
- <div class='inline'>
610
- <p>The subject.</p>
611
- </div>
612
-
613
- </li>
614
-
615
- <li>
616
-
617
- <span class='name'>args</span>
618
-
619
-
620
- <span class='type'>(<tt>Hash</tt>)</span>
621
-
622
-
623
-
624
- &mdash;
625
- <div class='inline'>
626
- <p>Variable arguments for more granular matching.</p>
627
- </div>
628
-
629
- </li>
630
-
631
- </ul>
632
-
633
-
634
- </div>
635
- </li>
636
-
637
- </ul>
638
-
639
- <p class="tag_title">Returns:</p>
640
- <ul class="return">
641
-
642
- <li>
643
-
644
-
645
- <span class='type'>(<tt>Boolean</tt>)</span>
646
-
647
-
648
-
649
- &mdash;
650
- <div class='inline'>
651
- <p>True or false.</p>
652
- </div>
653
-
654
- </li>
655
-
656
- </ul>
657
-
658
- </div><table class="source_code">
659
- <tr>
660
- <td>
661
- <pre class="lines">
662
-
663
-
664
- 13
665
- 14
666
- 15
667
- 16</pre>
668
- </td>
669
- <td>
670
- <pre class="code"><span class="info file"># File 'lib/corral/ability.rb', line 13</span>
671
-
672
- <span class='kw'>def</span> <span class='id identifier rubyid_can?'>can?</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='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
673
- <span class='kw'>return</span> <span class='kw'>true</span> <span class='kw'>if</span> <span class='ivar'>@allow_anything</span>
674
- <span class='id identifier rubyid_lookup_rule'>lookup_rule</span><span class='lparen'>(</span><span class='id identifier rubyid_subject'>subject</span><span class='rparen'>)</span><span class='period'>.</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>
675
- <span class='kw'>end</span></pre>
676
- </td>
677
- </tr>
678
- </table>
679
- </div>
680
-
681
- <div class="method_details ">
682
- <h3 class="signature " id="cannot-instance_method">
683
-
684
- #<strong>cannot</strong>(action, subject, &amp;block) &#x21d2; <tt>Object</tt>
685
-
686
-
687
-
688
-
689
-
690
- </h3><div class="docstring">
691
- <div class="discussion">
692
-
693
- <p>Inverse of #can.</p>
694
-
695
-
696
- </div>
697
- </div>
698
- <div class="tags">
699
-
700
-
701
- <p class="tag_title">See Also:</p>
702
- <ul class="see">
703
-
704
- <li><span class='object_link'><a href="#can-instance_method" title="Corral::Ability#can (method)">#can</a></span></li>
705
-
706
- </ul>
707
-
708
- </div><table class="source_code">
709
- <tr>
710
- <td>
711
- <pre class="lines">
712
-
713
-
714
- 37
715
- 38
716
- 39</pre>
717
- </td>
718
- <td>
719
- <pre class="code"><span class="info file"># File 'lib/corral/ability.rb', line 37</span>
720
-
721
- <span class='kw'>def</span> <span class='id identifier rubyid_cannot'>cannot</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='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
722
- <span class='id identifier rubyid_rule_for'>rule_for</span><span class='lparen'>(</span><span class='id identifier rubyid_subject'>subject</span><span class='rparen'>)</span><span class='period'>.</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>
723
- <span class='kw'>end</span></pre>
724
- </td>
725
- </tr>
726
- </table>
727
- </div>
728
-
729
- <div class="method_details ">
730
- <h3 class="signature " id="cannot?-instance_method">
731
-
732
- #<strong>cannot?</strong>(*args) &#x21d2; <tt>Boolean</tt>
733
-
734
-
735
-
736
-
737
-
738
- </h3><div class="docstring">
739
- <div class="discussion">
740
-
741
- <p>Inverse of #can?.</p>
742
-
743
-
744
- </div>
745
- </div>
746
- <div class="tags">
747
-
748
- <p class="tag_title">Returns:</p>
749
- <ul class="return">
750
-
751
- <li>
752
-
753
-
754
- <span class='type'>(<tt>Boolean</tt>)</span>
755
-
756
-
757
-
758
- </li>
759
-
760
- </ul>
761
-
762
- <p class="tag_title">See Also:</p>
763
- <ul class="see">
764
-
765
- <li><span class='object_link'><a href="#can%3F-instance_method" title="Corral::Ability#can? (method)">#can?</a></span></li>
766
-
767
- </ul>
768
-
769
- </div><table class="source_code">
770
- <tr>
771
- <td>
772
- <pre class="lines">
773
-
774
-
775
- 21
776
- 22
777
- 23</pre>
778
- </td>
779
- <td>
780
- <pre class="code"><span class="info file"># File 'lib/corral/ability.rb', line 21</span>
781
-
782
- <span class='kw'>def</span> <span class='id identifier rubyid_cannot?'>cannot?</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
783
- <span class='kw'>not</span> <span class='id identifier rubyid_can?'>can?</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
784
- <span class='kw'>end</span></pre>
785
- </td>
786
- </tr>
787
- </table>
788
- </div>
789
-
790
- </div>
791
-
792
- </div>
793
-
794
- <div id="footer">
795
- Generated on Wed Jul 6 11:31:38 2016 by
796
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
797
- 0.9.0 (ruby-2.3.1).
798
- </div>
799
-
800
- </div>
801
- </body>
802
- </html>