ae_declarative_authorization 0.10.2 → 0.11.0.pre1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 380a434297fb196dcfbf059509ee1a50cd7835d2
4
- data.tar.gz: db8af9fcb8906a699ba3a2e602d7a83446772074
2
+ SHA256:
3
+ metadata.gz: cdac3b23cd265e87af2b4fa946cd3420d3f72383da302c63cc3178aa0a5d4aa5
4
+ data.tar.gz: cd5cf8ca8959bf0fa6fb388e997fe4bea2835d9abdc94b71213a03eb107e0af2
5
5
  SHA512:
6
- metadata.gz: fdf1b43b12a93c790af306c1a4c1158f6e7c6205bba57c0b39582481b7f2314d57c69893fef313871929e63c943211cde5d2a07a9f9ec5495f8f2da87f0fb12d
7
- data.tar.gz: 4241e224613130471ea25351cc5b50204d1730f6986a8aa17302905ac17599b373a5df59ef5a51ad18cb116df109ae71dce7adcb6e488ec4ed53b4bf1dae7be4
6
+ metadata.gz: a3c6d73c6af0ec42ac5881323ab4d926e74253ec658234dec0866aa74052e689db6f51e289e4d5a9f75bfb2f4defb0b3fa52a45d93b1a74a25ec0ec079320af3
7
+ data.tar.gz: 67ea6f76363ab72f6fac1139482e4f22ce295591198e96c6cd7fc1657ace2c35a8ea63bcd32351e500851469b50e3d84f22a2a37ecd48fdb90fd2647c892faa7
data/.circleci/config.yml CHANGED
@@ -8,30 +8,22 @@ commands:
8
8
  - run: bundle exec appraisal rake test
9
9
 
10
10
  jobs:
11
- test-ruby-233:
12
- docker:
13
- - image: circleci/ruby:2.3.3
14
- steps:
15
- - bundle_install_and_test
16
-
17
11
  test-ruby-253:
18
12
  docker:
19
13
  - image: circleci/ruby:2.5.3
20
14
  steps:
21
15
  - bundle_install_and_test
22
16
 
23
- test-ruby-262:
17
+ test-ruby-263:
24
18
  docker:
25
- - image: circleci/ruby:2.6.2
19
+ - image: circleci/ruby:2.6.3
26
20
  steps:
27
21
  - bundle_install_and_test
28
22
 
29
23
  workflows:
30
24
  rc:
31
25
  jobs:
32
- - test-ruby-233:
33
- context: appfolio_test_context
34
26
  - test-ruby-253:
35
27
  context: appfolio_test_context
36
- - test-ruby-262:
28
+ - test-ruby-263:
37
29
  context: appfolio_test_context
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.3.3
1
+ ruby-2.6.3
data/Appraisals CHANGED
@@ -1,31 +1,26 @@
1
- case RUBY_VERSION
1
+ RAILS_VERSIONS = ['5.2.2.1', '6.0.2.1']
2
+ GRAPE_VERSIONS = ['1.1.0', '1.2.3', '1.3.0']
2
3
 
3
- when '2.3.3', '2.5.3', '2.6.2' then
4
+ case RUBY_VERSION
4
5
 
5
- appraise "ruby-#{RUBY_VERSION}-rails507" do
6
- gem 'rails', '5.0.7'
7
- gem 'grape', '1.1.0'
8
- gem 'rails-controller-testing'
9
- end
6
+ when '2.5.3', '2.6.3' then
7
+ RAILS_VERSIONS.product(GRAPE_VERSIONS).each do |rails_version, grape_version|
8
+ appraise "ruby-#{RUBY_VERSION}-rails#{rails_version}-grape#{grape_version}" do
9
+ gem 'rails', rails_version
10
+ gem 'grape', grape_version
10
11
 
11
- appraise "ruby-#{RUBY_VERSION}-rails516" do
12
- gem 'rails', '5.1.6'
13
- gem 'grape', '1.2.3'
14
- gem 'rails-controller-testing'
15
- end
12
+ if Gem::Version.new(grape_version) < Gem::Version.new('1.3.0')
13
+ # https://github.com/ruby-grape/grape/pull/1956
14
+ gem "rack", "< 2.1.0"
15
+ end
16
16
 
17
- appraise "ruby-#{RUBY_VERSION}-rails521" do
18
- gem 'rails', '5.2.1'
19
- gem 'grape', '1.2.3'
20
- gem 'rails-controller-testing'
17
+ if Gem::Version.new(rails_version) >= Gem::Version.new('6')
18
+ gem 'sqlite3', '~> 1.4'
19
+ else
20
+ gem 'sqlite3', '~> 1.3.0'
21
+ end
22
+ end
21
23
  end
22
-
23
- appraise "ruby-#{RUBY_VERSION}-rails522" do
24
- gem 'rails', '5.2.2'
25
- gem 'grape', '1.2.3'
26
- gem 'rails-controller-testing'
27
- end
28
-
29
24
  else
30
25
  raise "Unsupported Ruby version #{RUBY_VERSION}"
31
26
 
data/Gemfile CHANGED
@@ -4,4 +4,6 @@ gemspec
4
4
 
5
5
  gem 'appraisal', '~> 2.1'
6
6
  gem 'mocha', '~> 1.0', require: false
7
- gem 'sqlite3', '~> 1.3.0'
7
+ gem 'sprockets', '< 4'
8
+
9
+ gem 'rails-controller-testing'
@@ -20,5 +20,5 @@ Gem::Specification.new do |s|
20
20
  s.require_paths = ['lib']
21
21
 
22
22
  s.add_dependency(%q<blockenspiel>, ['~> 0.5.0'])
23
- s.add_dependency(%q<rails>, ['>= 4.2.5.2', '< 6'])
23
+ s.add_dependency(%q<rails>, ['>= 4.2.5.2', '< 7'])
24
24
  end
@@ -37,6 +37,12 @@ module Authorization
37
37
  end
38
38
 
39
39
  def filter_access_filter # :nodoc:
40
+ begin
41
+ route
42
+ rescue
43
+ # Acceessing route raises an exception when the response is a 405 MethodNotAllowed
44
+ return
45
+ end
40
46
  unless allowed?("#{request.request_method} #{route.origin}")
41
47
  if respond_to?(:permission_denied, true)
42
48
  # permission_denied needs to render or redirect
@@ -51,13 +57,18 @@ module Authorization
51
57
  ::Rails.logger
52
58
  end
53
59
 
54
- protected
55
-
56
60
  def api_class
57
61
  if options[:for].respond_to?(:base)
58
- options[:for].base # Grape >= 1.2.0 controller
62
+ # Grape >= 1.2.0 endpoint
63
+ # Authorization::Controller::Grape can be included into either Grape::API
64
+ # or Grape::API::Instance, so we need to check both.
65
+ [
66
+ options[:for],
67
+ options[:for].base
68
+ ].detect { |api| api.respond_to?(:decl_auth_context) }
59
69
  else
60
- options[:for] # Grape < 1.2.0 controller
70
+ # Grape < 1.2.0 endpoint
71
+ options[:for]
61
72
  end
62
73
  end
63
74
  end
@@ -68,11 +68,7 @@ module Authorization
68
68
 
69
69
  def controller_class(contr)
70
70
  if defined?(Grape) && contr.class < Grape::Endpoint
71
- if contr.options[:for].respond_to?(:base)
72
- contr.options[:for].base # Grape >= 1.2.0 controller
73
- else
74
- contr.options[:for] # Grape < 1.2.0 controller
75
- end
71
+ contr.api_class
76
72
  else
77
73
  contr.class # Rails controller
78
74
  end
@@ -1,3 +1,3 @@
1
1
  module DeclarativeAuthorization
2
- VERSION = '0.10.2'.freeze
2
+ VERSION = '0.11.0.pre1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ae_declarative_authorization
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.2
4
+ version: 0.11.0.pre1
5
5
  platform: ruby
6
6
  authors:
7
7
  - AppFolio
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-07-18 00:00:00.000000000 Z
12
+ date: 2020-02-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: blockenspiel
@@ -34,7 +34,7 @@ dependencies:
34
34
  version: 4.2.5.2
35
35
  - - "<"
36
36
  - !ruby/object:Gem::Version
37
- version: '6'
37
+ version: '7'
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -44,7 +44,7 @@ dependencies:
44
44
  version: 4.2.5.2
45
45
  - - "<"
46
46
  - !ruby/object:Gem::Version
47
- version: '6'
47
+ version: '7'
48
48
  description: ae_declarative_authorization is a Rails gem for maintainable authorization
49
49
  based on readable authorization rules.
50
50
  email: dev@appfolio.com
@@ -99,12 +99,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
99
99
  version: '0'
100
100
  required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - ">="
102
+ - - ">"
103
103
  - !ruby/object:Gem::Version
104
- version: '0'
104
+ version: 1.3.1
105
105
  requirements: []
106
- rubyforge_project:
107
- rubygems_version: 2.5.2
106
+ rubygems_version: 3.0.6
108
107
  signing_key:
109
108
  specification_version: 4
110
109
  summary: ae_declarative_authorization is a Rails gem for maintainable authorization