ae_declarative_authorization 0.10.2 → 0.11.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +3 -11
- data/.ruby-version +1 -1
- data/Appraisals +18 -23
- data/Gemfile +3 -1
- data/declarative_authorization.gemspec +1 -1
- data/lib/declarative_authorization/controller/grape.rb +15 -4
- data/lib/declarative_authorization/controller_permission.rb +1 -5
- data/lib/declarative_authorization/version.rb +1 -1
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cdac3b23cd265e87af2b4fa946cd3420d3f72383da302c63cc3178aa0a5d4aa5
|
4
|
+
data.tar.gz: cd5cf8ca8959bf0fa6fb388e997fe4bea2835d9abdc94b71213a03eb107e0af2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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-
|
17
|
+
test-ruby-263:
|
24
18
|
docker:
|
25
|
-
- image: circleci/ruby:2.6.
|
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-
|
28
|
+
- test-ruby-263:
|
37
29
|
context: appfolio_test_context
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.6.3
|
data/Appraisals
CHANGED
@@ -1,31 +1,26 @@
|
|
1
|
-
|
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
|
-
|
4
|
+
case RUBY_VERSION
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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
@@ -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
|
-
|
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
|
-
|
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
|
-
|
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
|
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.
|
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:
|
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: '
|
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: '
|
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:
|
104
|
+
version: 1.3.1
|
105
105
|
requirements: []
|
106
|
-
|
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
|