isomorfeus-policy 2.2.11 → 2.3.0
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
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: eccb98c21b316ad237fc89e12a604b31f13bc88ee93593bbd6475fde76c7334b
|
|
4
|
+
data.tar.gz: 5979273f753edd3ed9d2481dc1628e7c7d88bf39082b8c62bf8e53edde07cd17
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d8d1c6f399fc9f289141b29b2ed45ce3f5e6b02b178e8b67df8b02ed0701d9c19aeb66c142c3eb89bb7116bb11243727cf3a1bab9f36735aac6c7f7a814e685e
|
|
7
|
+
data.tar.gz: c5f42917c669c736a2c3bed66c0d1f3139af15e4b8467396d64c8708d34c7fcdbb0a00dbabf8d15bb11a71c634ffd40999cf3c39c5b71a7a5e31796b47783601
|
data/lib/isomorfeus-policy.rb
CHANGED
|
@@ -11,9 +11,6 @@ else
|
|
|
11
11
|
require 'isomorfeus_policy/lucid_policy/helper'
|
|
12
12
|
require 'isomorfeus_policy/lucid_policy/mixin'
|
|
13
13
|
require 'isomorfeus_policy/lucid_policy/base'
|
|
14
|
-
require 'isomorfeus_policy/lucid_authorization/mixin'
|
|
15
|
-
require 'isomorfeus_policy/lucid_authorization/base'
|
|
16
|
-
require 'isomorfeus_policy/anonymous'
|
|
17
14
|
require 'iso_opal'
|
|
18
15
|
|
|
19
16
|
Opal.append_path(__dir__.untaint) unless IsoOpal.paths_include?(__dir__.untaint)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: isomorfeus-policy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jan Biedermann
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-03-
|
|
11
|
+
date: 2022-03-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: opal
|
|
@@ -30,28 +30,28 @@ dependencies:
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 0.14.
|
|
33
|
+
version: 0.14.21
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 0.14.
|
|
40
|
+
version: 0.14.21
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: isomorfeus-preact
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: 10.6.
|
|
47
|
+
version: 10.6.60
|
|
48
48
|
type: :runtime
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: 10.6.
|
|
54
|
+
version: 10.6.60
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: isomorfeus-redux
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -72,14 +72,14 @@ dependencies:
|
|
|
72
72
|
requirements:
|
|
73
73
|
- - '='
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: 2.
|
|
75
|
+
version: 2.3.0
|
|
76
76
|
type: :development
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
80
|
- - '='
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: 2.
|
|
82
|
+
version: 2.3.0
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
84
|
name: rake
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -119,9 +119,6 @@ files:
|
|
|
119
119
|
- lib/isomorfeus-policy.rb
|
|
120
120
|
- lib/isomorfeus/policy/config.rb
|
|
121
121
|
- lib/isomorfeus/policy/version.rb
|
|
122
|
-
- lib/isomorfeus_policy/anonymous.rb
|
|
123
|
-
- lib/isomorfeus_policy/lucid_authorization/base.rb
|
|
124
|
-
- lib/isomorfeus_policy/lucid_authorization/mixin.rb
|
|
125
122
|
- lib/isomorfeus_policy/lucid_policy/base.rb
|
|
126
123
|
- lib/isomorfeus_policy/lucid_policy/exception.rb
|
|
127
124
|
- lib/isomorfeus_policy/lucid_policy/helper.rb
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
module LucidAuthorization
|
|
2
|
-
module Mixin
|
|
3
|
-
def record_authorization_reason
|
|
4
|
-
@_isomorfeus_record_authorization_reason = true
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
def stop_to_record_authorization_reason
|
|
8
|
-
@_isomorfeus_record_authorization_reason = false
|
|
9
|
-
@_isomorfeus_authorization_reason = nil
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def authorization_reason
|
|
13
|
-
@_isomorfeus_authorization_reason
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def authorized?(target_class, target_method = nil, props = nil)
|
|
17
|
-
begin
|
|
18
|
-
class_name = self.class.name
|
|
19
|
-
class_name = class_name.split('>::').last if class_name.start_with?('#<')
|
|
20
|
-
policy_class = Isomorfeus.cached_policy_class("#{class_name}Policy")
|
|
21
|
-
rescue ::NameError
|
|
22
|
-
policy_class = nil
|
|
23
|
-
end
|
|
24
|
-
return false unless policy_class
|
|
25
|
-
policy_instance = policy_class.new(self, @_isomorfeus_record_authorization_reason)
|
|
26
|
-
result = policy_instance.authorized?(target_class, target_method, props)
|
|
27
|
-
@_isomorfeus_authorization_reason = policy_instance.reason
|
|
28
|
-
result
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def authorized!(target_class, target_method = nil, props = nil)
|
|
32
|
-
class_name = self.class.name
|
|
33
|
-
class_name = class_name.split('>::').last if class_name.start_with?('#<')
|
|
34
|
-
policy_class = Isomorfeus.cached_policy_class("#{class_name}Policy")
|
|
35
|
-
Isomorfeus.raise_error(error_class: LucidPolicy::Exception, message: "#{self}: policy class #{class_name}Policy not found!") unless policy_class
|
|
36
|
-
policy_instance = policy_class.new(self, @_isomorfeus_record_authorization_reason)
|
|
37
|
-
result = policy_instance.authorized!(target_class, target_method, props)
|
|
38
|
-
@_isomorfeus_authorization_reason = policy_instance.reason
|
|
39
|
-
result
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|