authoreyes 0.2.2 → 0.2.3
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/.gitignore +1 -1
- data/README.md +3 -4
- data/lib/authoreyes.rb +2 -1
- data/lib/authoreyes/helpers/in_controller.rb +2 -2
- data/lib/authoreyes/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1dc136555358596966e3eb54461fe3a71c25b2b
|
4
|
+
data.tar.gz: 62cf57373a6d2493860091397218b3b0bcd8905f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9cc27ec75107eb10cb3432e2045f43a61358faecfb2806f43a79b7eefd9ce6d0e8e51689466ed8d1b499297413d15cc62bfbef66019d2af70712a5867503446
|
7
|
+
data.tar.gz: cd3df859d89cc113376578dfb14b4f13c9f551ed9151f07e668ed28ecd1d17142929ec6dc4abe2a3dca6391ee1f66119ac4c8cd8eaf7e749e7a3bb4bd4f9d6c1
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -3,8 +3,6 @@
|
|
3
3
|
[](https://badge.fury.io/rb/authoreyes) [](https://travis-ci.org/tektite-software/authoreyes) [](https://gemnasium.com/github.com/tektite-software/authoreyes)
|
4
4
|
[](https://codeclimate.com/github/tektite-software/authoreyes) [](https://codeclimate.com/github/tektite-software/authoreyes/coverage) [](http://inch-ci.org/github/tektite-software/authoreyes)
|
5
5
|
|
6
|
-
#### Warning! This gem is an alpha!
|
7
|
-
|
8
6
|
_Authoreyes_ (pronounced "authorize") is intended to be a modern, Rails 5 compatible replacement for [Declarative Authorization](https://github.com/stffn/declarative_authorization/).
|
9
7
|
|
10
8
|
## Installation
|
@@ -27,11 +25,12 @@ Or install it yourself as:
|
|
27
25
|
|
28
26
|
For Rails authorization in Rails versions 4 and below, please use [Declarative Authorization](https://github.com/stffn/declarative_authorization) or one of its forks.
|
29
27
|
|
30
|
-
__Warning! This gem is not finished!__
|
28
|
+
__Warning! This gem is not finished!__
|
31
29
|
|
32
30
|
At this point, to use Authoreyes, you must do the following:
|
33
|
-
1. Add an `authorization_rules.rb` file. See the included one for an example.
|
31
|
+
1. Add an `authorization_rules.rb` file. See the included one for an example. The syntax is the same as Declarative Authorization, so you can look at their examples too.
|
34
32
|
2. Define privileges for every single action you want to be accessed. As of now, Authoreyes has only one mode: authorize everything.
|
33
|
+
3. Done! Authoreyes will do its job.
|
35
34
|
|
36
35
|
If you want to customize authorization behavior, in your ApplicationController override Authoreyes's `redirect_if_unauthorized` before_action and `set_unauthorized_status_code` after_action. See `lib/authoreyes/helpers/in_controller` for details.
|
37
36
|
|
data/lib/authoreyes.rb
CHANGED
@@ -10,7 +10,8 @@ module Authoreyes
|
|
10
10
|
config.after_initialize do
|
11
11
|
require 'authoreyes/helpers/in_controller'
|
12
12
|
|
13
|
-
# Include Controller helpers
|
13
|
+
# Include Controller helpers not already sent to specific parts
|
14
|
+
# of ActionController (e.g., permitted_to?, etc.)
|
14
15
|
ActionController::Metal.include Authoreyes::Helpers::InController
|
15
16
|
end
|
16
17
|
end
|
@@ -21,7 +21,7 @@ module Authoreyes
|
|
21
21
|
permitted_to! action_name
|
22
22
|
rescue Authoreyes::Authorization::NotAuthorized => e
|
23
23
|
session[:request_unauthorized] = true
|
24
|
-
|
24
|
+
Rails.logger.warn "[Authoreyes] #{e}"
|
25
25
|
redirect_back fallback_location: root_path,
|
26
26
|
status: :found,
|
27
27
|
alert: 'You are not allowed to do that.'
|
@@ -38,7 +38,7 @@ module Authoreyes
|
|
38
38
|
ActionController::Metal.send(:define_method, :authorization_object) do
|
39
39
|
if params[:id].present?
|
40
40
|
begin
|
41
|
-
controller_name.singularize.capitalize.constantize.find(params[:id])
|
41
|
+
controller_name.singularize.camelcase.capitalize.constantize.find(params[:id])
|
42
42
|
rescue NameError
|
43
43
|
logger.warn '[Authoreyes] Could not interpolate object!'
|
44
44
|
end
|
data/lib/authoreyes/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authoreyes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tektite Software
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-03-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -170,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
170
|
version: '0'
|
171
171
|
requirements: []
|
172
172
|
rubyforge_project:
|
173
|
-
rubygems_version: 2.6.
|
173
|
+
rubygems_version: 2.6.10
|
174
174
|
signing_key:
|
175
175
|
specification_version: 4
|
176
176
|
summary: A modern authorization plugin for Rails.
|