pundit 0.2.1 → 0.2.2
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.
- checksums.yaml +7 -0
- data/.travis.yml +3 -2
- data/README.md +119 -39
- data/Rakefile +1 -0
- data/lib/pundit.rb +14 -6
- data/lib/pundit/rspec.rb +5 -1
- data/lib/pundit/version.rb +1 -1
- data/pundit.gemspec +3 -1
- data/spec/pundit_spec.rb +22 -2
- metadata +34 -33
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6dc0e920a5482e8b695a1cc1afd205fdc7752ad2
|
4
|
+
data.tar.gz: 1354dab74c79e3673cc034ccccea04688e4cb07a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0b745c98f6c3aa8376e97f3270ae6f3358339f13eb2fdd57c8adfc0e47f2dee073138866b7df986317d3bd19f6d23c80f7ffb6311a99b97c4f2fe46cb6924e93
|
7
|
+
data.tar.gz: bad3e8cb1c9c8888abf4b93521100ae0122eeebb19dbaaf1790e6beb20189dac55a7e60c017bf525ea5b7091ff9c2a07b3126bd928e6f8d22ded5b0b1f3e9ab2
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Pundit
|
2
2
|
|
3
3
|
[](https://travis-ci.org/elabs/pundit)
|
4
|
+
[](https://codeclimate.com/github/elabs/pundit)
|
4
5
|
|
5
6
|
Pundit provides a set of helpers which guide you in leveraging regular Ruby
|
6
7
|
classes and object oriented design patterns to build a simple, robust and
|
@@ -28,10 +29,14 @@ with some useful defaults for you:
|
|
28
29
|
rails g pundit:install
|
29
30
|
```
|
30
31
|
|
32
|
+
After generating your application policy, restart the Rails server so that Rails
|
33
|
+
can pick up any classes in the new `app/policies/` directory.
|
34
|
+
|
31
35
|
## Policies
|
32
36
|
|
33
37
|
Pundit is focused around the notion of policy classes. We suggest that you put
|
34
|
-
these classes in `app/policies`. This is a simple example
|
38
|
+
these classes in `app/policies`. This is a simple example that allows updating
|
39
|
+
a post if the user is an admin, or if the post is unpublished:
|
35
40
|
|
36
41
|
``` ruby
|
37
42
|
class PostPolicy
|
@@ -42,18 +47,18 @@ class PostPolicy
|
|
42
47
|
@post = post
|
43
48
|
end
|
44
49
|
|
45
|
-
def
|
50
|
+
def update?
|
46
51
|
user.admin? or not post.published?
|
47
52
|
end
|
48
53
|
end
|
49
54
|
```
|
50
55
|
|
51
56
|
As you can see, this is just a plain Ruby class. As a convenience, we can inherit
|
52
|
-
from Struct:
|
57
|
+
from Struct or use Struct.new to define the policy class:
|
53
58
|
|
54
59
|
``` ruby
|
55
|
-
|
56
|
-
def
|
60
|
+
PostPolicy = Struct.new(:user, :post) do
|
61
|
+
def update?
|
57
62
|
user.admin? or not post.published?
|
58
63
|
end
|
59
64
|
end
|
@@ -68,7 +73,7 @@ Pundit makes the following assumptions about this class:
|
|
68
73
|
- The second argument is some kind of model object, whose authorization
|
69
74
|
you want to check. This does not need to be an ActiveRecord or even
|
70
75
|
an ActiveModel object, it can be anything really.
|
71
|
-
- The class implements some kind of query method, in this case `
|
76
|
+
- The class implements some kind of query method, in this case `update?`.
|
72
77
|
Usually, this will map to the name of a particular controller action.
|
73
78
|
|
74
79
|
That's it really.
|
@@ -77,13 +82,13 @@ Supposing that you have an instance of class `Post`, Pundit now lets you do
|
|
77
82
|
this in your controller:
|
78
83
|
|
79
84
|
``` ruby
|
80
|
-
def
|
81
|
-
@post = Post.
|
85
|
+
def update
|
86
|
+
@post = Post.find(params[:id])
|
82
87
|
authorize @post
|
83
|
-
if @post.
|
88
|
+
if @post.update(post_params)
|
84
89
|
redirect_to @post
|
85
90
|
else
|
86
|
-
render :
|
91
|
+
render :edit
|
87
92
|
end
|
88
93
|
end
|
89
94
|
```
|
@@ -91,11 +96,11 @@ end
|
|
91
96
|
The authorize method automatically infers that `Post` will have a matching
|
92
97
|
`PostPolicy` class, and instantiates this class, handing in the current user
|
93
98
|
and the given record. It then infers from the action name, that it should call
|
94
|
-
`
|
99
|
+
`update?` on this instance of the policy. In this case, you can imagine that
|
95
100
|
`authorize` would have done something like this:
|
96
101
|
|
97
102
|
``` ruby
|
98
|
-
raise "not authorized" unless PostPolicy.new(current_user, @post).
|
103
|
+
raise "not authorized" unless PostPolicy.new(current_user, @post).update?
|
99
104
|
```
|
100
105
|
|
101
106
|
You can pass a second argument to `authorize` if the name of the permission you
|
@@ -115,8 +120,8 @@ method in both the view and controller. This is especially useful for
|
|
115
120
|
conditionally showing links or buttons in the view:
|
116
121
|
|
117
122
|
``` erb
|
118
|
-
<% if policy(@post).
|
119
|
-
<%= link_to "
|
123
|
+
<% if policy(@post).update? %>
|
124
|
+
<%= link_to "Edit post", edit_post_path(@post) %>
|
120
125
|
<% end %>
|
121
126
|
```
|
122
127
|
|
@@ -124,16 +129,16 @@ conditionally showing links or buttons in the view:
|
|
124
129
|
|
125
130
|
Pundit adds a method called `verify_authorized` to your controllers. This
|
126
131
|
method will raise an exception if `authorize` has not yet been called. You
|
127
|
-
should run this method in an `
|
132
|
+
should run this method in an `after_action` to ensure that you haven't
|
128
133
|
forgotten to authorize the action. For example:
|
129
134
|
|
130
135
|
``` ruby
|
131
136
|
class ApplicationController < ActionController::Base
|
132
|
-
|
137
|
+
after_action :verify_authorized, :except => :index
|
133
138
|
end
|
134
139
|
```
|
135
140
|
|
136
|
-
Likewise,
|
141
|
+
Likewise, Pundit also adds `verify_policy_scoped` to your controller. This
|
137
142
|
will raise an exception in the vein of `verify_authorized`. However it tracks
|
138
143
|
if `policy_scoped` is used instead of `authorize`. This is mostly useful for
|
139
144
|
controller actions like `index` which find collections with a scope and don't
|
@@ -141,7 +146,7 @@ authorize individual instances.
|
|
141
146
|
|
142
147
|
``` ruby
|
143
148
|
class ApplicationController < ActionController::Base
|
144
|
-
|
149
|
+
after_action :verify_policy_scoped, :only => :index
|
145
150
|
end
|
146
151
|
```
|
147
152
|
|
@@ -152,18 +157,18 @@ particular user has access to. When using Pundit, you are expected to
|
|
152
157
|
define a class called a policy scope. It can look something like this:
|
153
158
|
|
154
159
|
``` ruby
|
155
|
-
|
156
|
-
|
160
|
+
PostPolicy = Struct.new(:user, :post) do
|
161
|
+
self::Scope = Struct.new(:user, :scope) do
|
157
162
|
def resolve
|
158
163
|
if user.admin?
|
159
|
-
scope
|
164
|
+
scope.all
|
160
165
|
else
|
161
166
|
scope.where(:published => true)
|
162
167
|
end
|
163
168
|
end
|
164
169
|
end
|
165
170
|
|
166
|
-
def
|
171
|
+
def update?
|
167
172
|
user.admin? or not post.published?
|
168
173
|
end
|
169
174
|
end
|
@@ -215,7 +220,7 @@ class, instead of letting Pundit infer it. This can be done like so:
|
|
215
220
|
``` ruby
|
216
221
|
class Post
|
217
222
|
def self.policy_class
|
218
|
-
|
223
|
+
PostablePolicy
|
219
224
|
end
|
220
225
|
end
|
221
226
|
```
|
@@ -264,6 +269,26 @@ class ApplicationPolicy
|
|
264
269
|
end
|
265
270
|
```
|
266
271
|
|
272
|
+
## Rescuing a denied Authorization in Rails
|
273
|
+
|
274
|
+
Pundit raises a `Pundit::NotAuthorizedError` you can [rescue_from](http://guides.rubyonrails.org/action_controller_overview.html#rescue-from) in your `ApplicationController`. You can customize the `user_not_authorized` method in every controller.
|
275
|
+
|
276
|
+
```ruby
|
277
|
+
class ApplicationController < ActionController::Base
|
278
|
+
protect_from_forgery
|
279
|
+
include Pundit
|
280
|
+
|
281
|
+
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
|
282
|
+
|
283
|
+
private
|
284
|
+
|
285
|
+
def user_not_authorized
|
286
|
+
flash[:error] = "You are not authorized to perform this action."
|
287
|
+
redirect_to request.headers["Referer"] || root_path
|
288
|
+
end
|
289
|
+
end
|
290
|
+
```
|
291
|
+
|
267
292
|
## Manually retrieving policies and scopes
|
268
293
|
|
269
294
|
Sometimes you want to retrieve a policy for a record outside the controller or
|
@@ -282,40 +307,62 @@ Pundit.policy_scope(user, Post)
|
|
282
307
|
The bang methods will raise an exception if the policy does not exist, whereas
|
283
308
|
those without the bang will return nil.
|
284
309
|
|
285
|
-
## Pundit
|
310
|
+
## Customize Pundit user
|
286
311
|
|
287
|
-
In
|
288
|
-
|
289
|
-
|
312
|
+
In some cases your controller might not have access to `current_user`, or your
|
313
|
+
`current_user` is not the method that should be invoked by Pundit. Simply
|
314
|
+
define a method in your controller called `pundit_user`.
|
290
315
|
|
291
316
|
```ruby
|
292
|
-
|
317
|
+
def pundit_user
|
318
|
+
User.find_by_other_means
|
319
|
+
end
|
320
|
+
```
|
321
|
+
|
322
|
+
## Strong parameters
|
323
|
+
|
324
|
+
In Rails 4 (or Rails 3.2 with the
|
325
|
+
[strong_parameters](https://github.com/rails/strong_parameters) gem),
|
326
|
+
mass-assignment protection is handled in the controller.
|
327
|
+
Pundit helps you permit different users to set different attributes. Don't
|
328
|
+
forget to provide your policy an instance of object or a class so correct
|
329
|
+
permissions could be loaded.
|
330
|
+
|
331
|
+
```ruby
|
332
|
+
# app/policies/post_policy.rb
|
333
|
+
class PostPolicy < ApplicationPolicy
|
293
334
|
def permitted_attributes
|
294
335
|
if user.admin? || user.owner_of?(post)
|
295
|
-
[:title, :body]
|
336
|
+
[:title, :body, :tag_list]
|
296
337
|
else
|
297
|
-
[:
|
338
|
+
[:tag_list]
|
298
339
|
end
|
299
340
|
end
|
300
341
|
end
|
301
342
|
|
343
|
+
# app/controllers/posts_controller.rb
|
302
344
|
class PostsController < ApplicationController
|
303
345
|
def update
|
304
|
-
|
305
|
-
if @post.
|
306
|
-
|
346
|
+
@post = Post.find(params[:id])
|
347
|
+
if @post.update(post_params)
|
348
|
+
redirect_to @post
|
349
|
+
else
|
350
|
+
render :edit
|
351
|
+
end
|
307
352
|
end
|
308
353
|
|
309
354
|
private
|
310
355
|
|
311
|
-
def
|
312
|
-
params.require(:post).permit(policy(@post).permitted_attributes)
|
356
|
+
def post_params
|
357
|
+
params.require(:post).permit(*policy(@post || Post).permitted_attributes)
|
313
358
|
end
|
314
359
|
end
|
315
360
|
```
|
316
361
|
|
317
362
|
## RSpec
|
318
363
|
|
364
|
+
### Policy Specs
|
365
|
+
|
319
366
|
Pundit includes a mini-DSL for writing expressive tests for your policies in RSpec.
|
320
367
|
Require `pundit/rspec` in your `spec_helper.rb`:
|
321
368
|
|
@@ -329,22 +376,55 @@ Then put your policy specs in `spec/policies`, and make them look somewhat like
|
|
329
376
|
describe PostPolicy do
|
330
377
|
subject { PostPolicy }
|
331
378
|
|
332
|
-
permissions :
|
379
|
+
permissions :update? do
|
333
380
|
it "denies access if post is published" do
|
334
|
-
|
381
|
+
expect(subject).not_to permit(User.new(:admin => false), Post.new(:published => true))
|
335
382
|
end
|
336
383
|
|
337
384
|
it "grants access if post is published and user is an admin" do
|
338
|
-
|
385
|
+
expect(subject).to permit(User.new(:admin => true), Post.new(:published => true))
|
339
386
|
end
|
340
387
|
|
341
388
|
it "grants access if post is unpublished" do
|
342
|
-
|
389
|
+
expect(subject).to permit(User.new(:admin => false), Post.new(:published => false))
|
343
390
|
end
|
344
391
|
end
|
345
392
|
end
|
346
393
|
```
|
347
394
|
|
395
|
+
An alternative approach to Pundit policy specs is scoping them to a user context as outlined in this
|
396
|
+
[excellent post](http://thunderboltlabs.com/blog/2013/03/27/testing-pundit-policies-with-rspec/).
|
397
|
+
|
398
|
+
### View Specs
|
399
|
+
|
400
|
+
When writing view specs, you'll notice that the policy helper is not available
|
401
|
+
and views under test that use it will fail. Thankfully, it's very easy to stub
|
402
|
+
out the policy to have it return whatever is appropriate for the spec.
|
403
|
+
|
404
|
+
``` ruby
|
405
|
+
describe "users/show" do
|
406
|
+
before(:each) do
|
407
|
+
user = assign(:user, build_stubbed(:user))
|
408
|
+
controller.stub(:current_user).and_return user
|
409
|
+
end
|
410
|
+
|
411
|
+
it "renders the destroy action" do
|
412
|
+
allow(view).to receive(:policy).and_return double(edit?: false, destroy?: true)
|
413
|
+
|
414
|
+
render
|
415
|
+
expect(rendered).to match 'Destroy'
|
416
|
+
end
|
417
|
+
end
|
418
|
+
```
|
419
|
+
|
420
|
+
This technique enables easy unit testing of tricky conditionaly view logic
|
421
|
+
based on what is or is not authorized.
|
422
|
+
|
423
|
+
# External Resources
|
424
|
+
|
425
|
+
- [Migrating to Pundit from CanCan](http://blog.carbonfive.com/2013/10/21/migrating-to-pundit-from-cancan/)
|
426
|
+
- [Testing Pundit Policies with RSpec](http://thunderboltlabs.com/blog/2013/03/27/testing-pundit-policies-with-rspec/)
|
427
|
+
|
348
428
|
# License
|
349
429
|
|
350
430
|
Licensed under the MIT license, see the separate LICENSE.txt file.
|
data/Rakefile
CHANGED
data/lib/pundit.rb
CHANGED
@@ -12,8 +12,8 @@ module Pundit
|
|
12
12
|
|
13
13
|
class << self
|
14
14
|
def policy_scope(user, scope)
|
15
|
-
|
16
|
-
|
15
|
+
policy_scope = PolicyFinder.new(scope).scope
|
16
|
+
policy_scope.new(user, scope).resolve if policy_scope
|
17
17
|
end
|
18
18
|
|
19
19
|
def policy_scope!(user, scope)
|
@@ -21,8 +21,8 @@ module Pundit
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def policy(user, record)
|
24
|
-
|
25
|
-
|
24
|
+
policy = PolicyFinder.new(record).policy
|
25
|
+
policy.new(user, record) if policy
|
26
26
|
end
|
27
27
|
|
28
28
|
def policy!(user, record)
|
@@ -34,11 +34,13 @@ module Pundit
|
|
34
34
|
if respond_to?(:helper_method)
|
35
35
|
helper_method :policy_scope
|
36
36
|
helper_method :policy
|
37
|
+
helper_method :pundit_user
|
37
38
|
end
|
38
39
|
if respond_to?(:hide_action)
|
39
40
|
hide_action :authorize
|
40
41
|
hide_action :verify_authorized
|
41
42
|
hide_action :verify_policy_scoped
|
43
|
+
hide_action :pundit_user
|
42
44
|
end
|
43
45
|
end
|
44
46
|
|
@@ -61,10 +63,16 @@ module Pundit
|
|
61
63
|
|
62
64
|
def policy_scope(scope)
|
63
65
|
@_policy_scoped = true
|
64
|
-
Pundit.policy_scope!(
|
66
|
+
@policy_scope or Pundit.policy_scope!(pundit_user, scope)
|
65
67
|
end
|
68
|
+
attr_writer :policy_scope
|
66
69
|
|
67
70
|
def policy(record)
|
68
|
-
Pundit.policy!(
|
71
|
+
@policy or Pundit.policy!(pundit_user, record)
|
72
|
+
end
|
73
|
+
attr_writer :policy
|
74
|
+
|
75
|
+
def pundit_user
|
76
|
+
current_user
|
69
77
|
end
|
70
78
|
end
|
data/lib/pundit/rspec.rb
CHANGED
@@ -4,10 +4,14 @@ module Pundit
|
|
4
4
|
extend ::RSpec::Matchers::DSL
|
5
5
|
|
6
6
|
matcher :permit do |user, record|
|
7
|
-
|
7
|
+
match_for_should do |policy|
|
8
8
|
permissions.all? { |permission| policy.new(user, record).public_send(permission) }
|
9
9
|
end
|
10
10
|
|
11
|
+
match_for_should_not do |policy|
|
12
|
+
permissions.none? { |permission| policy.new(user, record).public_send(permission) }
|
13
|
+
end
|
14
|
+
|
11
15
|
failure_message_for_should do |policy|
|
12
16
|
"Expected #{policy} to grant #{permissions.to_sentence} on #{record} but it didn't"
|
13
17
|
end
|
data/lib/pundit/version.rb
CHANGED
data/pundit.gemspec
CHANGED
@@ -10,7 +10,8 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.email = ["jonas.nicklas@gmail.com", "dev@elabs.se"]
|
11
11
|
gem.description = %q{Object oriented authorization for Rails applications}
|
12
12
|
gem.summary = %q{OO authorization for Rails}
|
13
|
-
gem.homepage = "
|
13
|
+
gem.homepage = "https://github.com/elabs/pundit"
|
14
|
+
gem.license = "MIT"
|
14
15
|
|
15
16
|
gem.files = `git ls-files`.split($/)
|
16
17
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
@@ -19,6 +20,7 @@ Gem::Specification.new do |gem|
|
|
19
20
|
|
20
21
|
gem.add_dependency "activesupport", ">= 3.0.0"
|
21
22
|
gem.add_development_dependency "activerecord", ">= 3.0.0"
|
23
|
+
gem.add_development_dependency "bundler", "~> 1.3"
|
22
24
|
gem.add_development_dependency "rspec", "~>2.0"
|
23
25
|
gem.add_development_dependency "pry"
|
24
26
|
gem.add_development_dependency "rake"
|
data/spec/pundit_spec.rb
CHANGED
@@ -56,11 +56,11 @@ class ArticleTag
|
|
56
56
|
end
|
57
57
|
|
58
58
|
describe Pundit do
|
59
|
-
let(:user) {
|
59
|
+
let(:user) { double }
|
60
60
|
let(:post) { Post.new(user) }
|
61
61
|
let(:comment) { Comment.new }
|
62
62
|
let(:article) { Article.new }
|
63
|
-
let(:controller) {
|
63
|
+
let(:controller) { double(:current_user => user, :params => { :action => "update" }).tap { |c| c.extend(Pundit) } }
|
64
64
|
let(:artificial_blog) { ArtificialBlog.new }
|
65
65
|
let(:article_tag) { ArticleTag.new }
|
66
66
|
|
@@ -226,6 +226,12 @@ describe Pundit do
|
|
226
226
|
end
|
227
227
|
end
|
228
228
|
|
229
|
+
describe "#pundit_user" do
|
230
|
+
it 'returns the same thing as current_user' do
|
231
|
+
controller.pundit_user.should eq controller.current_user
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
229
235
|
describe ".policy" do
|
230
236
|
it "returns an instantiated policy" do
|
231
237
|
policy = controller.policy(post)
|
@@ -236,6 +242,13 @@ describe Pundit do
|
|
236
242
|
it "throws an exception if the given policy can't be found" do
|
237
243
|
expect { controller.policy(article) }.to raise_error(Pundit::NotDefinedError)
|
238
244
|
end
|
245
|
+
|
246
|
+
it "allows policy to be injected" do
|
247
|
+
new_policy = OpenStruct.new
|
248
|
+
controller.policy = new_policy
|
249
|
+
|
250
|
+
controller.policy(post).should == new_policy
|
251
|
+
end
|
239
252
|
end
|
240
253
|
|
241
254
|
describe ".policy_scope" do
|
@@ -246,5 +259,12 @@ describe Pundit do
|
|
246
259
|
it "throws an exception if the given policy can't be found" do
|
247
260
|
expect { controller.policy_scope(Article) }.to raise_error(Pundit::NotDefinedError)
|
248
261
|
end
|
262
|
+
|
263
|
+
it "allows policy_scope to be injected" do
|
264
|
+
new_scope = OpenStruct.new
|
265
|
+
controller.policy_scope = new_scope
|
266
|
+
|
267
|
+
controller.policy_scope(post).should == new_scope
|
268
|
+
end
|
249
269
|
end
|
250
270
|
end
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pundit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jonas Nicklas
|
@@ -10,44 +9,53 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2014-02-07 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: activesupport
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - '>='
|
21
19
|
- !ruby/object:Gem::Version
|
22
20
|
version: 3.0.0
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
|
-
- -
|
25
|
+
- - '>='
|
29
26
|
- !ruby/object:Gem::Version
|
30
27
|
version: 3.0.0
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
29
|
name: activerecord
|
33
30
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
31
|
requirements:
|
36
|
-
- -
|
32
|
+
- - '>='
|
37
33
|
- !ruby/object:Gem::Version
|
38
34
|
version: 3.0.0
|
39
35
|
type: :development
|
40
36
|
prerelease: false
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
38
|
requirements:
|
44
|
-
- -
|
39
|
+
- - '>='
|
45
40
|
- !ruby/object:Gem::Version
|
46
41
|
version: 3.0.0
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: bundler
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ~>
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '1.3'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '1.3'
|
47
56
|
- !ruby/object:Gem::Dependency
|
48
57
|
name: rspec
|
49
58
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
59
|
requirements:
|
52
60
|
- - ~>
|
53
61
|
- !ruby/object:Gem::Version
|
@@ -55,7 +63,6 @@ dependencies:
|
|
55
63
|
type: :development
|
56
64
|
prerelease: false
|
57
65
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
66
|
requirements:
|
60
67
|
- - ~>
|
61
68
|
- !ruby/object:Gem::Version
|
@@ -63,49 +70,43 @@ dependencies:
|
|
63
70
|
- !ruby/object:Gem::Dependency
|
64
71
|
name: pry
|
65
72
|
requirement: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
73
|
requirements:
|
68
|
-
- -
|
74
|
+
- - '>='
|
69
75
|
- !ruby/object:Gem::Version
|
70
76
|
version: '0'
|
71
77
|
type: :development
|
72
78
|
prerelease: false
|
73
79
|
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
80
|
requirements:
|
76
|
-
- -
|
81
|
+
- - '>='
|
77
82
|
- !ruby/object:Gem::Version
|
78
83
|
version: '0'
|
79
84
|
- !ruby/object:Gem::Dependency
|
80
85
|
name: rake
|
81
86
|
requirement: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
87
|
requirements:
|
84
|
-
- -
|
88
|
+
- - '>='
|
85
89
|
- !ruby/object:Gem::Version
|
86
90
|
version: '0'
|
87
91
|
type: :development
|
88
92
|
prerelease: false
|
89
93
|
version_requirements: !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
94
|
requirements:
|
92
|
-
- -
|
95
|
+
- - '>='
|
93
96
|
- !ruby/object:Gem::Version
|
94
97
|
version: '0'
|
95
98
|
- !ruby/object:Gem::Dependency
|
96
99
|
name: yard
|
97
100
|
requirement: !ruby/object:Gem::Requirement
|
98
|
-
none: false
|
99
101
|
requirements:
|
100
|
-
- -
|
102
|
+
- - '>='
|
101
103
|
- !ruby/object:Gem::Version
|
102
104
|
version: '0'
|
103
105
|
type: :development
|
104
106
|
prerelease: false
|
105
107
|
version_requirements: !ruby/object:Gem::Requirement
|
106
|
-
none: false
|
107
108
|
requirements:
|
108
|
-
- -
|
109
|
+
- - '>='
|
109
110
|
- !ruby/object:Gem::Version
|
110
111
|
version: '0'
|
111
112
|
description: Object oriented authorization for Rails applications
|
@@ -134,29 +135,29 @@ files:
|
|
134
135
|
- lib/pundit/version.rb
|
135
136
|
- pundit.gemspec
|
136
137
|
- spec/pundit_spec.rb
|
137
|
-
homepage:
|
138
|
-
licenses:
|
138
|
+
homepage: https://github.com/elabs/pundit
|
139
|
+
licenses:
|
140
|
+
- MIT
|
141
|
+
metadata: {}
|
139
142
|
post_install_message:
|
140
143
|
rdoc_options: []
|
141
144
|
require_paths:
|
142
145
|
- lib
|
143
146
|
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
-
none: false
|
145
147
|
requirements:
|
146
|
-
- -
|
148
|
+
- - '>='
|
147
149
|
- !ruby/object:Gem::Version
|
148
150
|
version: '0'
|
149
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
|
-
none: false
|
151
152
|
requirements:
|
152
|
-
- -
|
153
|
+
- - '>='
|
153
154
|
- !ruby/object:Gem::Version
|
154
155
|
version: '0'
|
155
156
|
requirements: []
|
156
157
|
rubyforge_project:
|
157
|
-
rubygems_version:
|
158
|
+
rubygems_version: 2.0.3
|
158
159
|
signing_key:
|
159
|
-
specification_version:
|
160
|
+
specification_version: 4
|
160
161
|
summary: OO authorization for Rails
|
161
162
|
test_files:
|
162
163
|
- spec/pundit_spec.rb
|