action_policy-graphql 0.1.0.rc1 → 0.1.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: 3c8a905655156e38c918dc3b222dff1d8642d61416892b3ce89bf033adc08dcf
4
- data.tar.gz: 4d9994c62eb097299b2e7199dd656cb64d859983b6da0778929ba86bc21f58b8
3
+ metadata.gz: ed3c7c65dee9c9745ebd0725e1468e5c08ed74366af2f6bd834e0f7bc1fd267f
4
+ data.tar.gz: 2f95fe87eda87024dc848c091889e4455166730fe54e19bfe00866e5d75c3844
5
5
  SHA512:
6
- metadata.gz: bc7c087373d6ddf13d6f659a923ee786589d79861fb11f772104e4e5ae3a262d6160a55062340fda17c3729f3ece2461fdd25cc2f55412c2119e73374241cad1
7
- data.tar.gz: 1ee3ad7f30ad9a37ed728fe8bde93d2405d0e57cc26aae78a204930e22abedd40d3b3381a061da7904eeb21f6af4023423627fa8533e7776d80b646fe5d77af6
6
+ metadata.gz: f1df5623160ccf7c75a2d454b538bb0bbceae39f78a6ca4d2099c77cfada08bedcdd2ec3ad33a66443bb5977f08527bf6a08b60ae645ecf05140e0e2a783a481
7
+ data.tar.gz: f908810cf5bc1e35151badd82c038910bc6176ab158232e9403533d6801fdf060a5607f0419653b71b8846e51dc86f6697b8d7ce860d525337873f11971314f4
data/CHANGELOG.md CHANGED
@@ -1,4 +1,6 @@
1
- ## 0.1.0 (unreleased)
1
+ ## master (unreleased)
2
+
3
+ ## 0.1.0 (2019-05-20)
2
4
 
3
5
  - Initial version. ([@palkan][])
4
6
 
data/README.md CHANGED
@@ -50,7 +50,7 @@ end
50
50
 
51
51
  You can add authorization to the fields by specifying the `authorize: *` option:
52
52
 
53
- ```
53
+ ```ruby
54
54
  field :home, Home, null: false, authorize: true do
55
55
  argument :id, ID, required: true
56
56
  end
@@ -75,7 +75,7 @@ end
75
75
 
76
76
  You can customize the authorization options, e.g. `authorize: {to: :preview?, with: CustomPolicy}`.
77
77
 
78
- ### `authorized_scope`
78
+ ### `authorized_scope: *`
79
79
 
80
80
  You can add `authorized_scope: true` option to the field (list or _connection_ field) to
81
81
  apply the corresponding policy rules to the data:
@@ -119,8 +119,8 @@ Then the client could perform the following query:
119
119
  message
120
120
  # detailed information about the decline reasons; null if value is true
121
121
  reasons {
122
- details # JSON-encoded hash of the form { "community/event" => [:privacy_off?] }
123
- fullMessages # Array of human-readable reasons
122
+ details # JSON-encoded hash of the failure reasons (e.g., {"event" => [:seats_available?]})
123
+ fullMessages # Array of human-readable reasons (e.g., ["This event is sold out"])
124
124
  }
125
125
  }
126
126
 
@@ -3,6 +3,11 @@
3
3
  require "action_policy/graphql/types/authorization_result"
4
4
 
5
5
  module ActionPolicy
6
+ unless "".respond_to?(:then)
7
+ require "action_policy/ext/yield_self_then"
8
+ using ActionPolicy::Ext::YieldSelfThen
9
+ end
10
+
6
11
  module GraphQL
7
12
  # Add DSL to add policy rules as fields
8
13
  #
@@ -22,7 +27,7 @@ module ActionPolicy
22
27
  end
23
28
 
24
29
  def allowance_to(rule, target = object, **options)
25
- policy_for(record: target, **options).yield_self do |policy|
30
+ policy_for(record: target, **options).then do |policy|
26
31
  policy.apply(authorization_rule_for(policy, rule))
27
32
  policy.result
28
33
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActionPolicy
4
4
  module GraphQL
5
- VERSION = "0.1.0.rc1"
5
+ VERSION = "0.1.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_policy-graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.rc1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
@@ -184,9 +184,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
184
184
  version: 2.4.0
185
185
  required_rubygems_version: !ruby/object:Gem::Requirement
186
186
  requirements:
187
- - - ">"
187
+ - - ">="
188
188
  - !ruby/object:Gem::Version
189
- version: 1.3.1
189
+ version: '0'
190
190
  requirements: []
191
191
  rubygems_version: 3.0.3
192
192
  signing_key: