ae_declarative_authorization 1.3.0 → 1.5.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e11a2b5e7153658db82ba4882cf04c2dc4f7e1ec22d21908365af7a860de466
|
4
|
+
data.tar.gz: 01cc82ce6c960d11af9199fa142334de736b7957fd8b30dd81a95822964bca64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9c061d3055fdf6d84d81699a53e653e67bb42f6162dd4c27eac31e473d145e9cb14268cbe886114ba781428aafd179be2ea9449ba7b9e79ddbc4c2dfd3f6734
|
7
|
+
data.tar.gz: 708873a0ad5ab828bb8615d211b41d5a80cab0af1e4b7a985be167ef61267a6eba1add3f63b059677c5c9c212a31c891739c7200ab321b64e32bb2e0c9d8655b
|
@@ -19,5 +19,5 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
20
20
|
|
21
21
|
spec.add_dependency('blockenspiel', ['>= 0.5', '< 1'])
|
22
|
-
spec.add_dependency('rails', ['>= 6.1', '< 7.
|
22
|
+
spec.add_dependency('rails', ['>= 6.1', '< 7.3'])
|
23
23
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module DeclAuth
|
6
|
+
# Enforces placing all `before_action` statements prior to the first `filter_access_to` statement.
|
7
|
+
# This ensures that any data required by the access filters is available before the filter is applied.
|
8
|
+
# See the documentation above the `filter_access_to` method in Authorization::Controller::DSL for more information
|
9
|
+
#
|
10
|
+
# @example
|
11
|
+
# # bad
|
12
|
+
# before_action: :do_something
|
13
|
+
# filter_access_to :all
|
14
|
+
# before_action :find_object
|
15
|
+
#
|
16
|
+
# # good
|
17
|
+
# before_action: :do_something
|
18
|
+
# before_action :find_object
|
19
|
+
#
|
20
|
+
# filter_access_to :all
|
21
|
+
#
|
22
|
+
class BeforeActionsPrecedeAccessFilter < RuboCop::Cop::Base
|
23
|
+
def_node_search :before_actions, '(send nil? :before_action ...)'
|
24
|
+
def_node_search :access_filters, '(send nil? :filter_access_to ...)'
|
25
|
+
|
26
|
+
MSG = '`:filter_access_to` statements should be placed after all other `:before_action` statements.'
|
27
|
+
|
28
|
+
def on_class(node)
|
29
|
+
before_actions = before_actions(node)
|
30
|
+
access_filters = access_filters(node)
|
31
|
+
|
32
|
+
return if before_actions.count.zero? || access_filters.count.zero?
|
33
|
+
|
34
|
+
last_before_action = before_actions.to_a.last
|
35
|
+
first_access_filter = access_filters.to_a.first
|
36
|
+
|
37
|
+
return if last_before_action.sibling_index < first_access_filter.sibling_index
|
38
|
+
|
39
|
+
add_offense(access_filters.first, message: MSG)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ae_declarative_authorization
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AppFolio
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-01-17 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: blockenspiel
|
@@ -39,7 +38,7 @@ dependencies:
|
|
39
38
|
version: '6.1'
|
40
39
|
- - "<"
|
41
40
|
- !ruby/object:Gem::Version
|
42
|
-
version: '7.
|
41
|
+
version: '7.3'
|
43
42
|
type: :runtime
|
44
43
|
prerelease: false
|
45
44
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -49,7 +48,7 @@ dependencies:
|
|
49
48
|
version: '6.1'
|
50
49
|
- - "<"
|
51
50
|
- !ruby/object:Gem::Version
|
52
|
-
version: '7.
|
51
|
+
version: '7.3'
|
53
52
|
description: Rails gem for maintainable authorization based on readable authorization
|
54
53
|
rules.
|
55
54
|
email: opensource@appfolio.com
|
@@ -77,13 +76,13 @@ files:
|
|
77
76
|
- lib/generators/authorization/install/install_generator.rb
|
78
77
|
- lib/generators/authorization/rules/rules_generator.rb
|
79
78
|
- lib/generators/authorization/rules/templates/authorization_rules.rb
|
79
|
+
- lib/rubocop/cop/decl_auth/before_actions_precede_access_filter.rb
|
80
80
|
- lib/tasks/authorization_tasks.rake
|
81
81
|
homepage: https://github.com/appfolio/ae_declarative_authorization
|
82
82
|
licenses:
|
83
83
|
- MIT
|
84
84
|
metadata:
|
85
85
|
allowed_push_host: https://rubygems.org
|
86
|
-
post_install_message:
|
87
86
|
rdoc_options: []
|
88
87
|
require_paths:
|
89
88
|
- lib
|
@@ -98,8 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
97
|
- !ruby/object:Gem::Version
|
99
98
|
version: '0'
|
100
99
|
requirements: []
|
101
|
-
rubygems_version: 3.
|
102
|
-
signing_key:
|
100
|
+
rubygems_version: 3.6.3
|
103
101
|
specification_version: 4
|
104
102
|
summary: Rails gem for maintainable authorization based on readable authorization
|
105
103
|
rules.
|