authority 3.2.2 → 3.3.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.
- checksums.yaml +4 -4
- data/.travis.yml +15 -5
- data/CHANGELOG.markdown +4 -0
- data/README.markdown +11 -1
- data/gemfiles/3.2.gemfile +1 -0
- data/gemfiles/4.0.gemfile +1 -0
- data/gemfiles/4.1.gemfile +1 -0
- data/gemfiles/4.2.gemfile +7 -0
- data/lib/authority/controller.rb +9 -0
- data/lib/authority/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0866ed584d33abcd9ad475731155ad4fe433bf32
|
4
|
+
data.tar.gz: b65075c60d7719464f45b961abbc8a9b796ccea0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6159f7b02e3343ec357415791660a1fd0f939d2110bc115defe89701ad97225cffbb70f114a07b183c0c88d5de881307f7c6da42a5faf3ff6fba4c80b9f01e34
|
7
|
+
data.tar.gz: 7f2e9bd8713b865ab707268dfa78362dc5f485405116453d92972d72a8255ab3102bac7ab7eeceea82a00d55029489859d55ca58478092659dc448e7bc6ffe57
|
data/.travis.yml
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
3
|
- 1.9.3
|
4
|
-
- 2.0
|
5
|
-
- 2.1
|
6
|
-
- 2.2
|
4
|
+
- 2.0.0
|
5
|
+
- 2.1.10
|
6
|
+
- 2.2.6
|
7
|
+
- 2.3.3
|
8
|
+
- 2.4.0
|
7
9
|
- jruby-19mode # JRuby in 1.9 mode
|
8
10
|
# - rbx-2
|
9
11
|
|
@@ -20,8 +22,16 @@ matrix:
|
|
20
22
|
exclude:
|
21
23
|
- rvm: rbx
|
22
24
|
gemfile: gemfiles/4.0.gemfile
|
25
|
+
- rvm: 2.4.0
|
26
|
+
gemfile: gemfiles/3.2.gemfile
|
27
|
+
- rvm: 2.4.0
|
28
|
+
gemfile: gemfiles/4.1.gemfile
|
29
|
+
- rvm: 2.4.0
|
30
|
+
gemfile: gemfiles/4.2.gemfile
|
23
31
|
include:
|
24
|
-
- rvm: 2.2.
|
32
|
+
- rvm: 2.2.6
|
25
33
|
gemfile: gemfiles/5.0.gemfile
|
26
|
-
- rvm: 2.3.
|
34
|
+
- rvm: 2.3.3
|
35
|
+
gemfile: gemfiles/5.0.gemfile
|
36
|
+
- rvm: 2.4.0
|
27
37
|
gemfile: gemfiles/5.0.gemfile
|
data/CHANGELOG.markdown
CHANGED
@@ -6,6 +6,10 @@ Authority does its best to use [semantic versioning](http://semver.org).
|
|
6
6
|
|
7
7
|
(nothing)
|
8
8
|
|
9
|
+
## 3.3.0
|
10
|
+
|
11
|
+
- [Allow defining `authority_success` controller action to handle successful authorization](https://github.com/nathanl/authority/pull/119), thanks to [John Poulin](https://github.com/forced-request)
|
12
|
+
|
9
13
|
## 3.2.2
|
10
14
|
|
11
15
|
- [Fix Rails 5 `after_filter` deprecation warning](https://github.com/nathanl/authority/pull/115), thanks to [Erik Axel Nielsen](https://github.com/erikaxel))
|
data/README.markdown
CHANGED
@@ -6,7 +6,7 @@ Authority will work fine with a standalone app or a single sign-on system. You c
|
|
6
6
|
|
7
7
|
If you're using it with Rails controllers, it requires that you already have some kind of user object in your application, accessible via a method like `current_user` (configurable).
|
8
8
|
|
9
|
-
[](https://rubygems.org/gems/
|
9
|
+
[](https://rubygems.org/gems/authority)
|
10
10
|
[](http://travis-ci.org/nathanl/authority)
|
11
11
|
[](https://codeclimate.com/github/nathanl/authority)
|
12
12
|
[](https://gemnasium.com/nathanl/authority)
|
@@ -493,6 +493,16 @@ end
|
|
493
493
|
|
494
494
|
Your method will be handed the `SecurityViolation`, which has a `message` method. In case you want to build your own message, it also exposes `user`, `action` and `resource`.
|
495
495
|
|
496
|
+
When a user action is successfully authorized, Authority will call `authority_success` on your controller.
|
497
|
+
By default, this does nothing, but you can override it to log the event or do something else.
|
498
|
+
For instance:
|
499
|
+
|
500
|
+
```ruby
|
501
|
+
def authority_success(user, action, resource)
|
502
|
+
Authority.logger.info "user #{user} was authorized to #{action} resource #{resource}"
|
503
|
+
end
|
504
|
+
```
|
505
|
+
|
496
506
|
<a name="credits">
|
497
507
|
## Credits, AKA 'Shout-Outs'
|
498
508
|
|
data/gemfiles/3.2.gemfile
CHANGED
data/gemfiles/4.0.gemfile
CHANGED
data/gemfiles/4.1.gemfile
CHANGED
data/gemfiles/4.2.gemfile
CHANGED
@@ -2,9 +2,16 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
gem 'rails', '~> 4.2.0'
|
4
4
|
gem 'rspec', '~> 2.14.0'
|
5
|
+
gem 'rake', '~> 11.3.0'
|
5
6
|
|
6
7
|
platforms :jruby, :ruby_19 do
|
7
8
|
gem 'mime-types', '~> 2.99.2'
|
8
9
|
end
|
9
10
|
|
11
|
+
platforms :ruby do
|
12
|
+
if RUBY_VERSION < "2.1.0"
|
13
|
+
gem "nokogiri", "1.6.8.1"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
10
17
|
gemspec path: '../'
|
data/lib/authority/controller.rb
CHANGED
@@ -133,6 +133,10 @@ module Authority
|
|
133
133
|
end
|
134
134
|
|
135
135
|
Authority.enforce(authority_action, authority_resource, authority_user, *options)
|
136
|
+
|
137
|
+
# This method is always invoked, but will only log if it's overriden
|
138
|
+
authority_success(authority_user, authority_action, authority_resource)
|
139
|
+
|
136
140
|
self.authorization_performed = true
|
137
141
|
end
|
138
142
|
|
@@ -144,6 +148,11 @@ module Authority
|
|
144
148
|
render :file => Rails.root.join('public', '403.html'), :status => 403, :layout => false
|
145
149
|
end
|
146
150
|
|
151
|
+
# This method can be overloaded inside the application controller, similar to authority_forbidden.
|
152
|
+
def authority_success(user, action, resource)
|
153
|
+
# Do nothing by default, but provide the option for users to override if they will.
|
154
|
+
end
|
155
|
+
|
147
156
|
private
|
148
157
|
|
149
158
|
# The `before_filter` that will be setup to run when the class method
|
data/lib/authority/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authority
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Long
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-02-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|