ae_declarative_authorization 0.11.0.pre1 → 0.13.0.rc1

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
  SHA256:
3
- metadata.gz: cdac3b23cd265e87af2b4fa946cd3420d3f72383da302c63cc3178aa0a5d4aa5
4
- data.tar.gz: cd5cf8ca8959bf0fa6fb388e997fe4bea2835d9abdc94b71213a03eb107e0af2
3
+ metadata.gz: ad3ef30f4d813634f2a7860abb0a4997327721a6e44a84e968ccadd947ed8eef
4
+ data.tar.gz: 16fb83330aa6bc86d81db1f2386b8e67be4a474a37779e43e520bd99d932b0cc
5
5
  SHA512:
6
- metadata.gz: a3c6d73c6af0ec42ac5881323ab4d926e74253ec658234dec0866aa74052e689db6f51e289e4d5a9f75bfb2f4defb0b3fa52a45d93b1a74a25ec0ec079320af3
7
- data.tar.gz: 67ea6f76363ab72f6fac1139482e4f22ce295591198e96c6cd7fc1657ace2c35a8ea63bcd32351e500851469b50e3d84f22a2a37ecd48fdb90fd2647c892faa7
6
+ metadata.gz: 89a71106a13ee9372778dd77068794e7c25d583ab3aedc51dc912d64e9fe8edc513fd7bd615b17b5c0735d3232ab8db8455f6e55bd4dc310608c994dbd9ca177
7
+ data.tar.gz: dd2e1a0b8d094b51d8374c6da470a7fde9ed837ca4e5e8f395e56515bfaa3ea9eb151223ca5de54658453013ee8dd304683a7dba64eab8d83b64bfacf80c6b6f
@@ -175,6 +175,9 @@ module Authorization
175
175
 
176
176
  user, roles, privileges = user_roles_privleges_from_options(privilege, options)
177
177
 
178
+ callback = Rails.application.config.try(:ae_declarative_authorization_permit_callback)
179
+ callback.call(controller: options[:controller], privilege: privilege) if callback && options.include?(:controller)
180
+
178
181
  return true if roles.is_a?(Hash) && !(roles.keys & omnipotent_roles).empty?
179
182
 
180
183
  # find a authorization rule that matches for at least one of the roles and
@@ -29,7 +29,8 @@ module Authorization
29
29
  :user => contr.send(:current_user),
30
30
  :object => object,
31
31
  :skip_attribute_test => !@attribute_check,
32
- :context => @context || controller_class(contr).decl_auth_context)
32
+ :context => @context || controller_class(contr).decl_auth_context,
33
+ :controller => contr)
33
34
  end
34
35
 
35
36
  def remove_actions(actions)
@@ -155,8 +155,14 @@ module DeclarativeAuthorization
155
155
  alias :access_tests_not_required :this_is_an_abstract_controller_so_it_needs_no_access_tests
156
156
 
157
157
  def all_public_actions
158
- actions = controller_class.public_instance_methods(false)
159
- actions += controller_class.superclass.public_instance_methods(false)
158
+ actions = []
159
+ if defined?(Grape) && [Grape::API, Grape::API::Instance].any? { |base| controller_class < base }
160
+ actions += controller_class.routes.map { |api| "#{api.request_method} #{api.origin}" }
161
+ else
162
+ actions += controller_class.public_instance_methods(false)
163
+ actions += controller_class.superclass.public_instance_methods(false)
164
+ end
165
+
160
166
  actions.reject! do |method|
161
167
  method =~ /^_/ ||
162
168
  method =~ /^rescue_action/ ||
@@ -1,3 +1,3 @@
1
1
  module DeclarativeAuthorization
2
- VERSION = '0.11.0.pre1'.freeze
2
+ VERSION = '0.13.0.rc1'.freeze
3
3
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ae_declarative_authorization
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0.pre1
4
+ version: 0.13.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - AppFolio
8
8
  - Steffen Bartsch
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-02-12 00:00:00.000000000 Z
12
+ date: 2020-11-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: blockenspiel
@@ -88,7 +88,7 @@ homepage: http://github.com/appfolio/ae_declarative_authorization
88
88
  licenses:
89
89
  - MIT
90
90
  metadata: {}
91
- post_install_message:
91
+ post_install_message:
92
92
  rdoc_options: []
93
93
  require_paths:
94
94
  - lib
@@ -103,8 +103,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  - !ruby/object:Gem::Version
104
104
  version: 1.3.1
105
105
  requirements: []
106
- rubygems_version: 3.0.6
107
- signing_key:
106
+ rubygems_version: 3.0.3
107
+ signing_key:
108
108
  specification_version: 4
109
109
  summary: ae_declarative_authorization is a Rails gem for maintainable authorization
110
110
  based on readable authorization rules.