corral_acl 0.9.0

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 (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,146 @@
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>
@@ -0,0 +1,145 @@
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>
@@ -0,0 +1,277 @@
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::ClassMethods
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::ClassMethods";
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> &raquo; <span class='title'><span class='object_link'><a href="../ControllerAdditions.html" title="Corral::ControllerAdditions (module)">ControllerAdditions</a></span></span>
41
+ &raquo;
42
+ <span class="title">ClassMethods</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::ClassMethods
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
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+ <h2>
97
+ Instance Method Summary
98
+ <small><a href="#" class="summary_toggle">collapse</a></small>
99
+ </h2>
100
+
101
+ <ul class="summary">
102
+
103
+ <li class="public ">
104
+ <span class="summary_signature">
105
+
106
+ <a href="#check_authorization-instance_method" title="#check_authorization (instance method)">#<strong>check_authorization</strong>(options = {}) &#x21d2; Object </a>
107
+
108
+
109
+
110
+ </span>
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+ <span class="summary_desc"><div class='inline'>
121
+ <p>Add this to a controller to ensure it performs authorization through
122
+ <code>authorized</code>! or <code>authorize_resource</code> call.</p>
123
+ </div></span>
124
+
125
+ </li>
126
+
127
+
128
+ <li class="public ">
129
+ <span class="summary_signature">
130
+
131
+ <a href="#skip_authorization_check-instance_method" title="#skip_authorization_check (instance method)">#<strong>skip_authorization_check</strong>(*args) &#x21d2; Object </a>
132
+
133
+
134
+
135
+ </span>
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+ <span class="summary_desc"><div class='inline'>
146
+ <p>Call this in the class of a controller to skip the check_authorization
147
+ behavior on the actions.</p>
148
+ </div></span>
149
+
150
+ </li>
151
+
152
+
153
+ </ul>
154
+
155
+
156
+
157
+
158
+ <div id="instance_method_details" class="method_details_list">
159
+ <h2>Instance Method Details</h2>
160
+
161
+
162
+ <div class="method_details first">
163
+ <h3 class="signature first" id="check_authorization-instance_method">
164
+
165
+ #<strong>check_authorization</strong>(options = {}) &#x21d2; <tt>Object</tt>
166
+
167
+
168
+
169
+
170
+
171
+ </h3><div class="docstring">
172
+ <div class="discussion">
173
+
174
+ <p>Add this to a controller to ensure it performs authorization through
175
+ <code>authorized</code>! or <code>authorize_resource</code> call. If
176
+ neither of these authorization methods are called, a
177
+ Corral::AuthorizationNotPerformed exception will be raised. This can be
178
+ placed in ApplicationController to ensure all controller actions do
179
+ authorization.</p>
180
+
181
+
182
+ </div>
183
+ </div>
184
+ <div class="tags">
185
+
186
+
187
+ </div><table class="source_code">
188
+ <tr>
189
+ <td>
190
+ <pre class="lines">
191
+
192
+
193
+ 7
194
+ 8
195
+ 9
196
+ 10
197
+ 11
198
+ 12
199
+ 13
200
+ 14</pre>
201
+ </td>
202
+ <td>
203
+ <pre class="code"><span class="info file"># File 'lib/corral/controller_additions.rb', line 7</span>
204
+
205
+ <span class='kw'>def</span> <span class='id identifier rubyid_check_authorization'>check_authorization</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
206
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_after_filter'>after_filter</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_slice'>slice</span><span class='lparen'>(</span><span class='symbol'>:only</span><span class='comma'>,</span> <span class='symbol'>:except</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_controller'>controller</span><span class='op'>|</span>
207
+ <span class='kw'>next</span> <span class='kw'>if</span> <span class='id identifier rubyid_controller'>controller</span><span class='period'>.</span><span class='id identifier rubyid_instance_variable_defined?'>instance_variable_defined?</span><span class='lparen'>(</span><span class='symbol'>:@_authorized</span><span class='rparen'>)</span>
208
+ <span class='kw'>next</span> <span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:if</span><span class='rbracket'>]</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_controller'>controller</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:if</span><span class='rbracket'>]</span><span class='rparen'>)</span>
209
+ <span class='kw'>next</span> <span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:unless</span><span class='rbracket'>]</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_controller'>controller</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:unless</span><span class='rbracket'>]</span><span class='rparen'>)</span>
210
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>AuthorizationNotPerformed</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>This action failed the check_authorization because it did not authorize a resource. Add skip_authorization_check to bypass this check.</span><span class='tstring_end'>&quot;</span></span>
211
+ <span class='kw'>end</span>
212
+ <span class='kw'>end</span></pre>
213
+ </td>
214
+ </tr>
215
+ </table>
216
+ </div>
217
+
218
+ <div class="method_details ">
219
+ <h3 class="signature " id="skip_authorization_check-instance_method">
220
+
221
+ #<strong>skip_authorization_check</strong>(*args) &#x21d2; <tt>Object</tt>
222
+
223
+
224
+
225
+
226
+
227
+ </h3><div class="docstring">
228
+ <div class="discussion">
229
+
230
+ <p>Call this in the class of a controller to skip the check_authorization
231
+ behavior on the actions. Any arguments are passed to the
232
+ <code>before_filter</code> called.</p>
233
+
234
+
235
+ </div>
236
+ </div>
237
+ <div class="tags">
238
+
239
+
240
+ </div><table class="source_code">
241
+ <tr>
242
+ <td>
243
+ <pre class="lines">
244
+
245
+
246
+ 18
247
+ 19
248
+ 20
249
+ 21
250
+ 22</pre>
251
+ </td>
252
+ <td>
253
+ <pre class="code"><span class="info file"># File 'lib/corral/controller_additions.rb', line 18</span>
254
+
255
+ <span class='kw'>def</span> <span class='id identifier rubyid_skip_authorization_check'>skip_authorization_check</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
256
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_before_filter'>before_filter</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_controller'>controller</span><span class='op'>|</span>
257
+ <span class='id identifier rubyid_controller'>controller</span><span class='period'>.</span><span class='id identifier rubyid_instance_variable_set'>instance_variable_set</span><span class='lparen'>(</span><span class='symbol'>:@_authorized</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span>
258
+ <span class='kw'>end</span>
259
+ <span class='kw'>end</span></pre>
260
+ </td>
261
+ </tr>
262
+ </table>
263
+ </div>
264
+
265
+ </div>
266
+
267
+ </div>
268
+
269
+ <div id="footer">
270
+ Generated on Wed Jul 6 11:31:38 2016 by
271
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
272
+ 0.9.0 (ruby-2.3.1).
273
+ </div>
274
+
275
+ </div>
276
+ </body>
277
+ </html>