isomorfeus-policy 1.0.0.zeta14 → 1.0.0.zeta15

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: 75b49ed298fc43bd590fb70fde0a851903e19adecd9b6e6e32264919e7d8475d
4
- data.tar.gz: 43340fb8cc360b1cf8ed845f396644491b86dd6e32abefb25cb2bb8241028a37
3
+ metadata.gz: 2b477f3f31e2323b8f7eac7b703dd6d8b880724a927275bde5b5606b97500a38
4
+ data.tar.gz: c4390e71d95762abf1b7f7ba1de67811b278c916435d5077ec5d50311611f051
5
5
  SHA512:
6
- metadata.gz: f2f15cc61ce807b1fc1223b06a11306effda294f1ddfeb64f9e74cc8a9c5c15e24d7c405e13f9fab2285c5b7c0c3a51a500649ac8b07dae842608ae73afccf2a
7
- data.tar.gz: 1c66ab777153fdb2dee44f812a42eb8ae28c0b5c607964d49379ad05624b71fc92ce4c122a8e1d4752d321434881afb787f515eed6157f505f550cbaaaa38079
6
+ metadata.gz: 98005c635f35c415dbb3bfea9ab19b326cb84d9eb04970a2447b09bed7841dc142935f40275714cd80796a9b677b290bdc2412943a69f9ce0f93e12cdd7cb373
7
+ data.tar.gz: 28a5c6a4c11a8d23df23c30263172cce0e1c248a753432c0987b93ee5aebe9f8f92494f01c933914fb5c890f3033f8d8e1658df588f2be6873f6a0cab25e5836
@@ -1,6 +1,6 @@
1
1
  require 'isomorfeus-react'
2
2
  require 'isomorfeus/policy/config'
3
- require 'isomorfeus/props_proxy'
3
+ require 'lucid_props'
4
4
 
5
5
  if RUBY_ENGINE == 'opal'
6
6
  Isomorfeus.zeitwerk.push_dir('isomorfeus_policy')
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  module Policy
3
- VERSION = '1.0.0.zeta14'
3
+ VERSION = '1.0.0.zeta15'
4
4
  end
5
5
  end
@@ -1,6 +1,10 @@
1
1
  class Anonymous
2
2
  include LucidAuthorization::Mixin
3
3
 
4
+ def anonymous?
5
+ true
6
+ end
7
+
4
8
  def key
5
9
  'anonymous'
6
10
  end
@@ -91,7 +91,7 @@ module LucidPolicy
91
91
 
92
92
  rules = self.class.authorization_rules
93
93
 
94
- props = Isomorfeus::PropsProxy.new(props) unless props.class == Isomorfeus::PropsProxy
94
+ props = LucidProps.new(props) unless props.class == LucidProps
95
95
 
96
96
  condition_result = true
97
97
  rules[:conditions].each do |condition|
@@ -0,0 +1,95 @@
1
+ class LucidProps
2
+ def initialize(props_hash)
3
+ props_hash = {} unless props_hash
4
+ @props_hash = props_hash
5
+ end
6
+
7
+ def any?
8
+ @props_hash.keys.size > 0
9
+ end
10
+
11
+ def to_h
12
+ @props_hash
13
+ end
14
+
15
+ def to_transport
16
+ {}.merge(@props_hash)
17
+ end
18
+
19
+ if RUBY_ENGINE == 'opal'
20
+ def [](prop_name)
21
+ @props_hash[prop_name]
22
+ end
23
+
24
+ def []=(prop_name, value)
25
+ @props_hash[prop_name] = value
26
+ end
27
+
28
+ def key?(prop_name)
29
+ @props_hash.key?(prop_name)
30
+ end
31
+
32
+ def keys
33
+ @props_hash.keys
34
+ end
35
+
36
+ def method_missing(prop_name, *args, &block)
37
+ return @props_hash[prop_name] if @props_hash.key?(prop_name)
38
+ super(prop_name, *args, &block)
39
+ end
40
+
41
+ def set(prop_name, value)
42
+ @props_hash[prop_name] = value
43
+ end
44
+
45
+ def to_json
46
+ JSON.dump(to_transport)
47
+ end
48
+
49
+ def to_n
50
+ @props_hash.to_n
51
+ end
52
+ else # RUBY_ENGINE
53
+ def [](prop_name)
54
+ name = prop_name.to_sym
55
+ return @props_hash[name] if @props_hash.key?(name)
56
+ name = prop_name.to_s
57
+ return @props_hash[name] if @props_hash.key?(name)
58
+ nil
59
+ end
60
+
61
+ def []=(prop_name, value)
62
+ @props_hash[prop_name.to_sym] = value
63
+ end
64
+
65
+ def key?(prop_name)
66
+ @props_hash.key?(prop_name.to_sym) || @props_hash.key?(prop_name.to_s)
67
+ end
68
+
69
+ def keys
70
+ @props_hash.keys.map(&:to_sym)
71
+ end
72
+
73
+ def method_missing(prop_name, *args, &block)
74
+ name = prop_name.to_sym
75
+ return @props_hash[name] if @props_hash.key?(name)
76
+ name = prop_name.to_s
77
+ return @props_hash[name] if @props_hash.key?(name)
78
+ super(prop_name, *args, &block)
79
+ end
80
+
81
+ def set(prop_name, value)
82
+ @props_hash[prop_name.to_sym] = value
83
+ end
84
+
85
+ def to_json
86
+ Oj.dump(to_transport, mode: :strict)
87
+ end
88
+
89
+ def to_n
90
+ @props_hash
91
+ end
92
+ end # RUBY_ENGINE
93
+
94
+ alias_method :has_key?, :key?
95
+ end
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: 1.0.0.zeta14
4
+ version: 1.0.0.zeta15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-28 00:00:00.000000000 Z
11
+ date: 2020-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 16.12.14
33
+ version: 16.12.17
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: 16.12.14
40
+ version: 16.12.17
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: isomorfeus-redux
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 1.0.0.zeta14
61
+ version: 1.0.0.zeta15
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 1.0.0.zeta14
68
+ version: 1.0.0.zeta15
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: opal-webpack-loader
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -119,7 +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/props_proxy.rb
123
122
  - lib/isomorfeus_policy/anonymous.rb
124
123
  - lib/isomorfeus_policy/lucid_authorization/base.rb
125
124
  - lib/isomorfeus_policy/lucid_authorization/mixin.rb
@@ -127,6 +126,7 @@ files:
127
126
  - lib/isomorfeus_policy/lucid_policy/exception.rb
128
127
  - lib/isomorfeus_policy/lucid_policy/helper.rb
129
128
  - lib/isomorfeus_policy/lucid_policy/mixin.rb
129
+ - lib/lucid_props.rb
130
130
  homepage: http://isomorfeus.com
131
131
  licenses:
132
132
  - MIT
@@ -1,91 +0,0 @@
1
- module Isomorfeus
2
- class PropsProxy
3
- def initialize(props_hash)
4
- props_hash = {} unless props_hash
5
- @props_hash = props_hash
6
- end
7
-
8
- def any?
9
- @props_hash.keys.size > 0
10
- end
11
-
12
- if RUBY_ENGINE == 'opal'
13
- def [](prop_name)
14
- @props_hash[prop_name]
15
- end
16
-
17
- def []=(prop_name, value)
18
- @props_hash[prop_name] = value
19
- end
20
-
21
- def key?(prop_name)
22
- @props_hash.key?(prop_name)
23
- end
24
-
25
- def keys
26
- @props_hash.keys
27
- end
28
-
29
- def method_missing(prop_name, *args, &block)
30
- return @props_hash[prop_name] if @props_hash.key?(prop_name)
31
- super(prop_name, *args, &block)
32
- end
33
-
34
- def set(prop_name, value)
35
- @props_hash[prop_name] = value
36
- end
37
-
38
- def to_json
39
- JSON.dump(to_transport)
40
- end
41
-
42
- def to_transport
43
- transport_hash = {}.merge(@props_hash)
44
- transport_hash
45
- end
46
- else # RUBY_ENGINE
47
- def [](prop_name)
48
- name = prop_name.to_sym
49
- return @props_hash[name] if @props_hash.key?(name)
50
- name = prop_name.to_s
51
- return @props_hash[name] if @props_hash.key?(name)
52
- nil
53
- end
54
-
55
- def []=(prop_name, value)
56
- @props_hash[prop_name.to_sym] = value
57
- end
58
-
59
- def key?(prop_name)
60
- @props_hash.key?(prop_name.to_sym) || @props_hash.key?(prop_name.to_s)
61
- end
62
-
63
- def keys
64
- @props_hash.keys.map(&:to_sym)
65
- end
66
-
67
- def method_missing(prop_name, *args, &block)
68
- name = prop_name.to_sym
69
- return @props_hash[name] if @props_hash.key?(name)
70
- name = prop_name.to_s
71
- return @props_hash[name] if @props_hash.key?(name)
72
- super(prop_name, *args, &block)
73
- end
74
-
75
- def set(prop_name, value)
76
- @props_hash[prop_name.to_sym] = value
77
- end
78
-
79
- def to_json
80
- Oj.dump(to_transport, mode: :strict)
81
- end
82
-
83
- def to_transport
84
- transport_hash = {}.merge(@props_hash)
85
- transport_hash
86
- end
87
- end # RUBY_ENGINE
88
-
89
- alias_method :has_key?, :key?
90
- end
91
- end