corral_acl 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -1,146 +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
- Exception: Corral::AccessDenied
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::AccessDenied";
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">AccessDenied</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>Exception: Corral::AccessDenied
65
-
66
-
67
-
68
- </h1>
69
- <div class="box_info">
70
-
71
- <dl>
72
- <dt>Inherits:</dt>
73
- <dd>
74
- <span class="inheritName"><span class='object_link'><a href="Error.html" title="Corral::Error (class)">Error</a></span></span>
75
-
76
- <ul class="fullTree">
77
- <li>Object</li>
78
-
79
- <li class="next">StandardError</li>
80
-
81
- <li class="next"><span class='object_link'><a href="Error.html" title="Corral::Error (class)">Error</a></span></li>
82
-
83
- <li class="next">Corral::AccessDenied</li>
84
-
85
- </ul>
86
- <a href="#" class="inheritanceTree">show all</a>
87
-
88
- </dd>
89
- </dl>
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
- <dl>
102
- <dt>Defined in:</dt>
103
- <dd>lib/corral/exceptions.rb</dd>
104
- </dl>
105
-
106
- </div>
107
-
108
- <h2>Overview</h2><div class="docstring">
109
- <div class="discussion">
110
-
111
- <p>This error is raised when a user isn&#39;t allowed to access a given
112
- controller action.</p>
113
-
114
-
115
- </div>
116
- </div>
117
- <div class="tags">
118
-
119
-
120
- </div>
121
-
122
-
123
-
124
-
125
-
126
-
127
-
128
-
129
-
130
-
131
-
132
-
133
-
134
-
135
-
136
- </div>
137
-
138
- <div id="footer">
139
- Generated on Wed Jul 6 11:31:38 2016 by
140
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
141
- 0.9.0 (ruby-2.3.1).
142
- </div>
143
-
144
- </div>
145
- </body>
146
- </html>
@@ -1,145 +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
- Exception: Corral::AuthorizationNotPerformed
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::AuthorizationNotPerformed";
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">AuthorizationNotPerformed</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>Exception: Corral::AuthorizationNotPerformed
65
-
66
-
67
-
68
- </h1>
69
- <div class="box_info">
70
-
71
- <dl>
72
- <dt>Inherits:</dt>
73
- <dd>
74
- <span class="inheritName"><span class='object_link'><a href="Error.html" title="Corral::Error (class)">Error</a></span></span>
75
-
76
- <ul class="fullTree">
77
- <li>Object</li>
78
-
79
- <li class="next">StandardError</li>
80
-
81
- <li class="next"><span class='object_link'><a href="Error.html" title="Corral::Error (class)">Error</a></span></li>
82
-
83
- <li class="next">Corral::AuthorizationNotPerformed</li>
84
-
85
- </ul>
86
- <a href="#" class="inheritanceTree">show all</a>
87
-
88
- </dd>
89
- </dl>
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
- <dl>
102
- <dt>Defined in:</dt>
103
- <dd>lib/corral/exceptions.rb</dd>
104
- </dl>
105
-
106
- </div>
107
-
108
- <h2>Overview</h2><div class="docstring">
109
- <div class="discussion">
110
-
111
- <p>Raised when using check_authorization without calling authorize!</p>
112
-
113
-
114
- </div>
115
- </div>
116
- <div class="tags">
117
-
118
-
119
- </div>
120
-
121
-
122
-
123
-
124
-
125
-
126
-
127
-
128
-
129
-
130
-
131
-
132
-
133
-
134
-
135
- </div>
136
-
137
- <div id="footer">
138
- Generated on Wed Jul 6 11:31:38 2016 by
139
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
140
- 0.9.0 (ruby-2.3.1).
141
- </div>
142
-
143
- </div>
144
- </body>
145
- </html>
@@ -1,513 +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::ControllerAdditions
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::ControllerAdditions";
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
- <span class='title'><span class='object_link'><a href="../Corral.html" title="Corral (module)">Corral</a></span></span>
41
- &raquo;
42
- <span class="title">ControllerAdditions</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::ControllerAdditions
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/controller_additions.rb</dd>
84
- </dl>
85
-
86
- </div>
87
-
88
- <h2>Defined Under Namespace</h2>
89
- <p class="children">
90
-
91
-
92
- <strong class="modules">Modules:</strong> <span class='object_link'><a href="ControllerAdditions/ClassMethods.html" title="Corral::ControllerAdditions::ClassMethods (module)">ClassMethods</a></span>
93
-
94
-
95
-
96
-
97
- </p>
98
-
99
-
100
-
101
-
102
-
103
-
104
-
105
-
106
- <h2>
107
- Class Method Summary
108
- <small><a href="#" class="summary_toggle">collapse</a></small>
109
- </h2>
110
-
111
- <ul class="summary">
112
-
113
- <li class="public ">
114
- <span class="summary_signature">
115
-
116
- <a href="#included-class_method" title="included (class method)">.<strong>included</strong>(base) &#x21d2; Object </a>
117
-
118
-
119
-
120
- </span>
121
-
122
-
123
-
124
-
125
-
126
-
127
-
128
-
129
-
130
- <span class="summary_desc"><div class='inline'></div></span>
131
-
132
- </li>
133
-
134
-
135
- </ul>
136
-
137
- <h2>
138
- Instance Method Summary
139
- <small><a href="#" class="summary_toggle">collapse</a></small>
140
- </h2>
141
-
142
- <ul class="summary">
143
-
144
- <li class="public ">
145
- <span class="summary_signature">
146
-
147
- <a href="#authorize%21-instance_method" title="#authorize! (instance method)">#<strong>authorize!</strong>(*args) &#x21d2; Object </a>
148
-
149
-
150
-
151
- </span>
152
-
153
-
154
-
155
-
156
-
157
-
158
-
159
-
160
-
161
- <span class="summary_desc"><div class='inline'>
162
- <p>Raises a Corral::AccessDenied exception if the current_ability cannot
163
- perform the given action.</p>
164
- </div></span>
165
-
166
- </li>
167
-
168
-
169
- <li class="public ">
170
- <span class="summary_signature">
171
-
172
- <a href="#can%3F-instance_method" title="#can? (instance method)">#<strong>can?</strong>(*args) &#x21d2; Boolean </a>
173
-
174
-
175
-
176
- </span>
177
-
178
-
179
-
180
-
181
-
182
-
183
-
184
-
185
-
186
- <span class="summary_desc"><div class='inline'>
187
- <p>Use in the controller or view to check the user&#39;s permission for a
188
- given action and object.</p>
189
- </div></span>
190
-
191
- </li>
192
-
193
-
194
- <li class="public ">
195
- <span class="summary_signature">
196
-
197
- <a href="#cannot%3F-instance_method" title="#cannot? (instance method)">#<strong>cannot?</strong>(*args) &#x21d2; Boolean </a>
198
-
199
-
200
-
201
- </span>
202
-
203
-
204
-
205
-
206
-
207
-
208
-
209
-
210
-
211
- <span class="summary_desc"><div class='inline'>
212
- <p>Convenience method which works the same as “can?” but returns the opposite
213
- value.</p>
214
- </div></span>
215
-
216
- </li>
217
-
218
-
219
- <li class="public ">
220
- <span class="summary_signature">
221
-
222
- <a href="#current_ability-instance_method" title="#current_ability (instance method)">#<strong>current_ability</strong> &#x21d2; Object </a>
223
-
224
-
225
-
226
- </span>
227
-
228
-
229
-
230
-
231
-
232
-
233
-
234
-
235
-
236
- <span class="summary_desc"><div class='inline'>
237
- <p>Creates and returns the current user&#39;s ability and caches it.</p>
238
- </div></span>
239
-
240
- </li>
241
-
242
-
243
- </ul>
244
-
245
-
246
-
247
-
248
- <div id="class_method_details" class="method_details_list">
249
- <h2>Class Method Details</h2>
250
-
251
-
252
- <div class="method_details first">
253
- <h3 class="signature first" id="included-class_method">
254
-
255
- .<strong>included</strong>(base) &#x21d2; <tt>Object</tt>
256
-
257
-
258
-
259
-
260
-
261
- </h3><table class="source_code">
262
- <tr>
263
- <td>
264
- <pre class="lines">
265
-
266
-
267
- 25
268
- 26
269
- 27
270
- 28</pre>
271
- </td>
272
- <td>
273
- <pre class="code"><span class="info file"># File 'lib/corral/controller_additions.rb', line 25</span>
274
-
275
- <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_included'>included</span><span class='lparen'>(</span><span class='id identifier rubyid_base'>base</span><span class='rparen'>)</span>
276
- <span class='id identifier rubyid_base'>base</span><span class='period'>.</span><span class='id identifier rubyid_extend'>extend</span> <span class='const'>ClassMethods</span>
277
- <span class='id identifier rubyid_base'>base</span><span class='period'>.</span><span class='id identifier rubyid_helper_method'>helper_method</span> <span class='symbol'>:can?</span><span class='comma'>,</span> <span class='symbol'>:cannot?</span><span class='comma'>,</span> <span class='symbol'>:current_ability</span> <span class='kw'>if</span> <span class='id identifier rubyid_base'>base</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span> <span class='symbol'>:helper_method</span>
278
- <span class='kw'>end</span></pre>
279
- </td>
280
- </tr>
281
- </table>
282
- </div>
283
-
284
- </div>
285
-
286
- <div id="instance_method_details" class="method_details_list">
287
- <h2>Instance Method Details</h2>
288
-
289
-
290
- <div class="method_details first">
291
- <h3 class="signature first" id="authorize!-instance_method">
292
-
293
- #<strong>authorize!</strong>(*args) &#x21d2; <tt>Object</tt>
294
-
295
-
296
-
297
-
298
-
299
- </h3><div class="docstring">
300
- <div class="discussion">
301
-
302
- <p>Raises a Corral::AccessDenied exception if the current_ability cannot
303
- perform the given action. This is usually called in a controller action or
304
- before filter to perform the authorization.</p>
305
-
306
- <p>A :message option can be passed to specify a different message.</p>
307
-
308
- <p>You can rescue from the exception in the controller to customize how
309
- unauthorized access is displayed to the user.</p>
310
-
311
- <p>See the load_and_authorize_resource method to automatically add the
312
- authorize! behavior to the default RESTful actions.</p>
313
-
314
-
315
- </div>
316
- </div>
317
- <div class="tags">
318
-
319
-
320
- </div><table class="source_code">
321
- <tr>
322
- <td>
323
- <pre class="lines">
324
-
325
-
326
- 41
327
- 42
328
- 43
329
- 44</pre>
330
- </td>
331
- <td>
332
- <pre class="code"><span class="info file"># File 'lib/corral/controller_additions.rb', line 41</span>
333
-
334
- <span class='kw'>def</span> <span class='id identifier rubyid_authorize!'>authorize!</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
335
- <span class='ivar'>@_authorized</span> <span class='op'>=</span> <span class='kw'>true</span>
336
- <span class='id identifier rubyid_current_ability'>current_ability</span><span class='period'>.</span><span class='id identifier rubyid_authorize!'>authorize!</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
337
- <span class='kw'>end</span></pre>
338
- </td>
339
- </tr>
340
- </table>
341
- </div>
342
-
343
- <div class="method_details ">
344
- <h3 class="signature " id="can?-instance_method">
345
-
346
- #<strong>can?</strong>(*args) &#x21d2; <tt>Boolean</tt>
347
-
348
-
349
-
350
-
351
-
352
- </h3><div class="docstring">
353
- <div class="discussion">
354
-
355
- <p>Use in the controller or view to check the user&#39;s permission for a
356
- given action and object.</p>
357
-
358
- <p>This simply calls “can?” on the current_ability. See Ability#can?.</p>
359
-
360
-
361
- </div>
362
- </div>
363
- <div class="tags">
364
-
365
- <p class="tag_title">Returns:</p>
366
- <ul class="return">
367
-
368
- <li>
369
-
370
-
371
- <span class='type'>(<tt>Boolean</tt>)</span>
372
-
373
-
374
-
375
- </li>
376
-
377
- </ul>
378
-
379
- </div><table class="source_code">
380
- <tr>
381
- <td>
382
- <pre class="lines">
383
-
384
-
385
- 60
386
- 61
387
- 62</pre>
388
- </td>
389
- <td>
390
- <pre class="code"><span class="info file"># File 'lib/corral/controller_additions.rb', line 60</span>
391
-
392
- <span class='kw'>def</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>
393
- <span class='id identifier rubyid_current_ability'>current_ability</span><span class='period'>.</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>
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="cannot?-instance_method">
402
-
403
- #<strong>cannot?</strong>(*args) &#x21d2; <tt>Boolean</tt>
404
-
405
-
406
-
407
-
408
-
409
- </h3><div class="docstring">
410
- <div class="discussion">
411
-
412
- <p>Convenience method which works the same as “can?” but returns the opposite
413
- value.</p>
414
-
415
-
416
- </div>
417
- </div>
418
- <div class="tags">
419
-
420
- <p class="tag_title">Returns:</p>
421
- <ul class="return">
422
-
423
- <li>
424
-
425
-
426
- <span class='type'>(<tt>Boolean</tt>)</span>
427
-
428
-
429
-
430
- </li>
431
-
432
- </ul>
433
-
434
- </div><table class="source_code">
435
- <tr>
436
- <td>
437
- <pre class="lines">
438
-
439
-
440
- 66
441
- 67
442
- 68</pre>
443
- </td>
444
- <td>
445
- <pre class="code"><span class="info file"># File 'lib/corral/controller_additions.rb', line 66</span>
446
-
447
- <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>
448
- <span class='id identifier rubyid_current_ability'>current_ability</span><span class='period'>.</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>
449
- <span class='kw'>end</span></pre>
450
- </td>
451
- </tr>
452
- </table>
453
- </div>
454
-
455
- <div class="method_details ">
456
- <h3 class="signature " id="current_ability-instance_method">
457
-
458
- #<strong>current_ability</strong> &#x21d2; <tt>Object</tt>
459
-
460
-
461
-
462
-
463
-
464
- </h3><div class="docstring">
465
- <div class="discussion">
466
-
467
- <p>Creates and returns the current user&#39;s ability and caches it. If you
468
- want to override how the Ability is defined then this is the place. Just
469
- define the method in the controller to change behavior.</p>
470
-
471
- <p>Notice it is important to memoize the ability object so it is not recreated
472
- every time.</p>
473
-
474
-
475
- </div>
476
- </div>
477
- <div class="tags">
478
-
479
-
480
- </div><table class="source_code">
481
- <tr>
482
- <td>
483
- <pre class="lines">
484
-
485
-
486
- 52
487
- 53
488
- 54</pre>
489
- </td>
490
- <td>
491
- <pre class="code"><span class="info file"># File 'lib/corral/controller_additions.rb', line 52</span>
492
-
493
- <span class='kw'>def</span> <span class='id identifier rubyid_current_ability'>current_ability</span>
494
- <span class='ivar'>@current_ability</span> <span class='op'>||=</span> <span class='op'>::</span><span class='const'>Ability</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_current_user'>current_user</span><span class='rparen'>)</span>
495
- <span class='kw'>end</span></pre>
496
- </td>
497
- </tr>
498
- </table>
499
- </div>
500
-
501
- </div>
502
-
503
- </div>
504
-
505
- <div id="footer">
506
- Generated on Wed Jul 6 11:31:38 2016 by
507
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
508
- 0.9.0 (ruby-2.3.1).
509
- </div>
510
-
511
- </div>
512
- </body>
513
- </html>