ibrain-core 0.2.3 → 0.2.7
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: 4cac7d792f031d619eb2b5c038fdfc79d418ab1ade813d6b0e152b69a6d455cc
|
4
|
+
data.tar.gz: 50c8c54f553d9e06f67b84a2bbb37c535cf556d0f100982ca249fb6cd924ebc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b71f8954bd35b5c1c3ca9a8c55014396bcca1f973d1a46a7767c325486070d9db57df268ea3dbf65a96848e7b1c2c14576de15e4e24cce82e0273e7627d5cab9
|
7
|
+
data.tar.gz: 23126f7c61e570aa257aaa30197c408f9726aced6b94068b00d94d089d63884ca4ea8a5356b662e45c8b6564318497d52ac0a5f5844dd70b5b988bad5679fede
|
@@ -4,10 +4,10 @@ module Ibrain
|
|
4
4
|
class BaseSchema < ::GraphQL::Schema
|
5
5
|
use GraphQL::Batch
|
6
6
|
|
7
|
-
use GraphQL::Guard.new(
|
8
|
-
|
9
|
-
|
10
|
-
)
|
7
|
+
# use GraphQL::Guard.new(
|
8
|
+
# policy_object: ::Ibrain::Config.graphql_policy.safe_constantize,
|
9
|
+
# not_authorized: ->(type, field) { raise IbrainErrors::PermissionError.new("You not have permission to access #{type}.#{field}") }
|
10
|
+
# )
|
11
11
|
|
12
12
|
# Union and Interface Resolution
|
13
13
|
def self.resolve_type(_abstract_type, _obj, _ctx)
|
@@ -3,11 +3,10 @@
|
|
3
3
|
module Ibrain
|
4
4
|
module Extentions
|
5
5
|
class Roles < GraphQL::Schema::FieldExtension
|
6
|
-
def after_resolve(object:,
|
6
|
+
def after_resolve(object:, value:, **_rest)
|
7
7
|
raise IbrainErrors::PermissionError.new("You not have permission to access #{field&.name}") if is_invalid_role(object)
|
8
8
|
|
9
|
-
|
10
|
-
yield(object, arguments, rest)
|
9
|
+
value
|
11
10
|
end
|
12
11
|
|
13
12
|
private
|
@@ -20,6 +19,8 @@ module Ibrain
|
|
20
19
|
return if roles.blank?
|
21
20
|
return true if current_user.blank?
|
22
21
|
return false if roles.include?(role)
|
22
|
+
|
23
|
+
true
|
23
24
|
end
|
24
25
|
end
|
25
26
|
end
|
@@ -3,6 +3,8 @@
|
|
3
3
|
module Ibrain
|
4
4
|
module Resolvers
|
5
5
|
class BaseResolver < GraphQL::Schema::Resolver
|
6
|
+
argument_class ::Ibrain::Types::BaseArgument
|
7
|
+
|
6
8
|
argument :filter, Ibrain::Types::FilterType, required: false, default_value: nil
|
7
9
|
argument :limit, Int, required: false, default_value: 10
|
8
10
|
argument :offset, Int, required: false, default_value: 0
|
data/lib/ibrain/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ibrain-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tai Nguyen Van
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord-session_store
|