avo 2.18.0 → 2.18.1
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.
Potentially problematic release.
This version of avo might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/config/master.key +1 -0
- data/lib/avo/services/authorization_clients/nil_client.rb +37 -0
- data/lib/avo/services/authorization_service.rb +11 -1
- data/lib/avo/version.rb +1 -1
- data/lib/avo.rb +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7079bc6f71897afdcc083d49d88255d5a3e903e130a9c054e069976dc9038bc0
|
4
|
+
data.tar.gz: c618bf337578ddc521f6be2c92eb1c1bfc76f4e7956c5f4a7393e31326f49f02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b32f335e16778be0647bd74c1579f5842d01b74c836655040d165e64bcb5325a7f23b43bb01a31f455af6f58ae3ecac968cb301e8737d4d36734f2ea1d88dcd
|
7
|
+
data.tar.gz: c9a37f010a3b138f64f7f10d31b077a94f06d48539bffb635f6b6e0d35d2d56b76d2b25cd34e31e189fbf72911a91b52910bb341391a13edff6b6c79cac3c48f
|
data/Gemfile.lock
CHANGED
data/config/master.key
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2aeb23d82b909d9c6b5abb62f7058c2a
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Avo
|
2
|
+
module Services
|
3
|
+
module AuthorizationClients
|
4
|
+
class NilClient
|
5
|
+
def authorize(user, record, action, policy_class: nil)
|
6
|
+
true
|
7
|
+
end
|
8
|
+
|
9
|
+
def policy(user, record)
|
10
|
+
NilPolicy.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def policy!(user, record)
|
14
|
+
NilPolicy.new
|
15
|
+
end
|
16
|
+
|
17
|
+
def apply_policy(user, model, policy_class: nil)
|
18
|
+
model
|
19
|
+
end
|
20
|
+
|
21
|
+
class NilPolicy
|
22
|
+
def initialize(user = nil, record = nil)
|
23
|
+
end
|
24
|
+
# rubocop:enable Style/RedundantInitialize
|
25
|
+
|
26
|
+
def method_missing(method, *args, &block)
|
27
|
+
self
|
28
|
+
end
|
29
|
+
|
30
|
+
def respond_to_missing?
|
31
|
+
true
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -9,8 +9,12 @@ module Avo
|
|
9
9
|
def client
|
10
10
|
client = Avo.configuration.authorization_client
|
11
11
|
|
12
|
+
client = nil if Avo::App.license.lacks(:authorization)
|
13
|
+
|
12
14
|
klass = case client
|
13
|
-
when
|
15
|
+
when nil
|
16
|
+
nil_client
|
17
|
+
when :pundit
|
14
18
|
pundit_client
|
15
19
|
else
|
16
20
|
if client.is_a?(String)
|
@@ -92,8 +96,14 @@ module Avo
|
|
92
96
|
end
|
93
97
|
|
94
98
|
def pundit_client
|
99
|
+
raise Avo::MissingGemError.new("Please add `gem 'pundit'` to your Gemfile.") unless defined?(Pundit)
|
100
|
+
|
95
101
|
Avo::Services::AuthorizationClients::PunditClient
|
96
102
|
end
|
103
|
+
|
104
|
+
def nil_client
|
105
|
+
Avo::Services::AuthorizationClients::NilClient
|
106
|
+
end
|
97
107
|
end
|
98
108
|
|
99
109
|
def initialize(user = nil, record = nil, policy_class: nil)
|
data/lib/avo/version.rb
CHANGED
data/lib/avo.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.18.
|
4
|
+
version: 2.18.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Marin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-11-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -1708,6 +1708,7 @@ files:
|
|
1708
1708
|
- config/credentials.yml.enc
|
1709
1709
|
- config/i18n-tasks.yml
|
1710
1710
|
- config/initializers/pagy.rb
|
1711
|
+
- config/master.key
|
1711
1712
|
- config/routes.rb
|
1712
1713
|
- config/spring.rb
|
1713
1714
|
- db/factories.rb
|
@@ -1828,6 +1829,7 @@ files:
|
|
1828
1829
|
- lib/avo/resources/controls/execution_context.rb
|
1829
1830
|
- lib/avo/resources/controls/items_holder.rb
|
1830
1831
|
- lib/avo/resources/controls/link_to.rb
|
1832
|
+
- lib/avo/services/authorization_clients/nil_client.rb
|
1831
1833
|
- lib/avo/services/authorization_clients/pundit_client.rb
|
1832
1834
|
- lib/avo/services/authorization_service.rb
|
1833
1835
|
- lib/avo/services/encryption_service.rb
|