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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3d80ffade1eeec014fc8c4d662dedc9a1c0a3f8e
4
+ data.tar.gz: 4e179a50363c9234992f392d3d3171f7d35ed03a
5
+ SHA512:
6
+ metadata.gz: 779136d92fbd16dc15132b6a3a9c5969db7a1bc8ebd48358167395cc37cb451bfb86637fa51651afa86140a38b5597ef9339af7fce6844744e7ef3389a7ec581
7
+ data.tar.gz: 9dc6ed073e0c32373307e01910b6b8988b35efbcefce91bcca7caf808f94243f8aabe904690f0076328754223a9d9b4b432a59c786324e6add858a95e7dc05a9
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ .yardoc/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2016 Liam P. White
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # Corral
2
+
3
+ A dead-simple, fast, pure Ruby ACL module for Rails applications.
4
+
5
+ This project is mostly the Sinatra to Rails's [CanCanCan](https://github.com/CanCanCommunity/cancancan).
6
+
7
+ This gem was written with speed and very specific requirements in mind. You probably do want CanCanCan, so please check that out first!
data/corral.gemspec ADDED
@@ -0,0 +1,17 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'corral/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "corral_acl"
8
+ s.version = Corral::VERSION
9
+ s.authors = ["Arcaire", "Liam White"]
10
+ s.email = "/dev/null"
11
+ s.summary = "Extremely simple authorization solution."
12
+ s.description = "Yet another authorization solution."
13
+ s.license = "MIT"
14
+
15
+ s.files = `git ls-files`.split($/)
16
+ s.require_paths = ["lib"]
17
+ end
data/doc/Ability.html ADDED
@@ -0,0 +1,257 @@
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: 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 = "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
+
41
+
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>Class: Ability
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">Ability</li>
80
+
81
+ </ul>
82
+ <a href="#" class="inheritanceTree">show all</a>
83
+
84
+ </dd>
85
+ </dl>
86
+
87
+
88
+
89
+
90
+
91
+
92
+ <dl>
93
+ <dt>Includes:</dt>
94
+ <dd><span class='object_link'><a href="Corral/Ability.html" title="Corral::Ability (module)">Corral::Ability</a></span></dd>
95
+ </dl>
96
+
97
+
98
+
99
+
100
+
101
+
102
+ <dl>
103
+ <dt>Defined in:</dt>
104
+ <dd>lib/generators/corral/ability/templates/ability.rb</dd>
105
+ </dl>
106
+
107
+ </div>
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+ <h2>
118
+ Instance Method Summary
119
+ <small><a href="#" class="summary_toggle">collapse</a></small>
120
+ </h2>
121
+
122
+ <ul class="summary">
123
+
124
+ <li class="public ">
125
+ <span class="summary_signature">
126
+
127
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(user) &#x21d2; Ability </a>
128
+
129
+
130
+
131
+ </span>
132
+
133
+
134
+ <span class="note title constructor">constructor</span>
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+ <span class="summary_desc"><div class='inline'>
144
+ <p>A new instance of Ability.</p>
145
+ </div></span>
146
+
147
+ </li>
148
+
149
+
150
+ </ul>
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="Corral/Ability.html" title="Corral::Ability (module)">Corral::Ability</a></span></h3>
163
+ <p class="inherited"><span class='object_link'><a href="Corral/Ability.html#allow_anything%21-instance_method" title="Corral::Ability#allow_anything! (method)">#allow_anything!</a></span>, <span class='object_link'><a href="Corral/Ability.html#authorize%21-instance_method" title="Corral::Ability#authorize! (method)">#authorize!</a></span>, <span class='object_link'><a href="Corral/Ability.html#can-instance_method" title="Corral::Ability#can (method)">#can</a></span>, <span class='object_link'><a href="Corral/Ability.html#can%3F-instance_method" title="Corral::Ability#can? (method)">#can?</a></span>, <span class='object_link'><a href="Corral/Ability.html#cannot-instance_method" title="Corral::Ability#cannot (method)">#cannot</a></span>, <span class='object_link'><a href="Corral/Ability.html#cannot%3F-instance_method" title="Corral::Ability#cannot? (method)">#cannot?</a></span></p>
164
+ <div id="constructor_details" class="method_details_list">
165
+ <h2>Constructor Details</h2>
166
+
167
+ <div class="method_details first">
168
+ <h3 class="signature first" id="initialize-instance_method">
169
+
170
+ #<strong>initialize</strong>(user) &#x21d2; <tt><span class='object_link'><a href="" title="Ability (class)">Ability</a></span></tt>
171
+
172
+
173
+
174
+
175
+
176
+ </h3><div class="docstring">
177
+ <div class="discussion">
178
+
179
+ <p>Returns a new instance of Ability</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
+ 4
194
+ 5
195
+ 6
196
+ 7
197
+ 8
198
+ 9
199
+ 10
200
+ 11
201
+ 12
202
+ 13
203
+ 14
204
+ 15
205
+ 16
206
+ 17
207
+ 18
208
+ 19
209
+ 20
210
+ 21
211
+ 22
212
+ 23
213
+ 24</pre>
214
+ </td>
215
+ <td>
216
+ <pre class="code"><span class="info file"># File 'lib/generators/corral/ability/templates/ability.rb', line 4</span>
217
+
218
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_user'>user</span><span class='rparen'>)</span>
219
+ <span class='comment'># Define abilities for the passed in user here. For example:
220
+ </span> <span class='comment'>#
221
+ </span> <span class='comment'># user ||= User.new # guest user (not logged in)
222
+ </span> <span class='comment'># if user.admin?
223
+ </span> <span class='comment'># allow_anything!
224
+ </span> <span class='comment'># else
225
+ </span> <span class='comment'># can :read, Post
226
+ </span> <span class='comment'># end
227
+ </span> <span class='comment'>#
228
+ </span> <span class='comment'># The first argument to `can` is the action you are giving the user
229
+ </span> <span class='comment'># permission to do.
230
+ </span> <span class='comment'># If you pass :manage it will apply to every action. Other common actions
231
+ </span> <span class='comment'># here are :read, :create, :update and :destroy.
232
+ </span> <span class='comment'>#
233
+ </span> <span class='comment'># The second argument is the resource the user can perform the action on.
234
+ </span> <span class='comment'># Pass a Ruby class of the resource.
235
+ </span> <span class='comment'>#
236
+ </span> <span class='comment'># can :update, Article
237
+ </span> <span class='comment'>#
238
+ </span><span class='kw'>end</span></pre>
239
+ </td>
240
+ </tr>
241
+ </table>
242
+ </div>
243
+
244
+ </div>
245
+
246
+
247
+ </div>
248
+
249
+ <div id="footer">
250
+ Generated on Wed Jul 6 11:31:38 2016 by
251
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
252
+ 0.9.0 (ruby-2.3.1).
253
+ </div>
254
+
255
+ </div>
256
+ </body>
257
+ </html>