authoreyes 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7be13cd0becb63d94264c6dfb29cbe2dd27aef29
4
- data.tar.gz: d01d1328cf588685dbd013b12a2479988d21eb88
3
+ metadata.gz: c1dc136555358596966e3eb54461fe3a71c25b2b
4
+ data.tar.gz: 62cf57373a6d2493860091397218b3b0bcd8905f
5
5
  SHA512:
6
- metadata.gz: f8deb67b53bfe0082cb034b72d02a8319b6903c901eed415f1c9eab5effad1b0e4618ba9e347f1aad0dd1098114cd0921df9977732de1ce73ea4f7977340da16
7
- data.tar.gz: ad6eef6945afbf09c4efc5822184d7fff1b5d009ba875beb6988999497ee5bb74a581d46428fc124235f09bab19040b9fbccd6843dd113f30a2a524c44a0f76e
6
+ metadata.gz: f9cc27ec75107eb10cb3432e2045f43a61358faecfb2806f43a79b7eefd9ce6d0e8e51689466ed8d1b499297413d15cc62bfbef66019d2af70712a5867503446
7
+ data.tar.gz: cd3df859d89cc113376578dfb14b4f13c9f551ed9151f07e668ed28ecd1d17142929ec6dc4abe2a3dca6391ee1f66119ac4c8cd8eaf7e749e7a3bb4bd4f9d6c1
data/.gitignore CHANGED
@@ -10,4 +10,4 @@
10
10
  /test/dummy/tmp/
11
11
  /test/dummy/log/
12
12
  *.gem
13
- *.log
13
+ **.log
data/README.md CHANGED
@@ -3,8 +3,6 @@
3
3
  [![Gem Version](https://badge.fury.io/rb/authoreyes.svg)](https://badge.fury.io/rb/authoreyes) [![Build Status](https://travis-ci.org/tektite-software/authoreyes.svg?branch=master)](https://travis-ci.org/tektite-software/authoreyes) [![Dependency Status](https://gemnasium.com/badges/github.com/tektite-software/authoreyes.svg)](https://gemnasium.com/github.com/tektite-software/authoreyes)
4
4
  [![Code Climate](https://codeclimate.com/github/tektite-software/authoreyes/badges/gpa.svg)](https://codeclimate.com/github/tektite-software/authoreyes) [![Test Coverage](https://codeclimate.com/github/tektite-software/authoreyes/badges/coverage.svg)](https://codeclimate.com/github/tektite-software/authoreyes/coverage) [![Inline docs](http://inch-ci.org/github/tektite-software/authoreyes.svg?branch=master)](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!__ Although authorization functionality _does_ work, you will need to do a few things to actually use it in your application...
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
 
@@ -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
- puts e
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
@@ -1,3 +1,3 @@
1
1
  module Authoreyes
2
- VERSION = '0.2.2'.freeze
2
+ VERSION = '0.2.3'.freeze
3
3
  end
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.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-01-26 00:00:00.000000000 Z
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.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.