ibrain-core 0.1.7 → 0.1.8
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48487077f193996a5756c2c1e000b4ff5df6bd8e8364b557edcdfc0958a625aa
|
4
|
+
data.tar.gz: ab5e00f8d7c86202c0b13b53d808b26bb9cc60bbd7480e1ee0c012a3e4795df5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 869c5f04e5b7dd23aa84c4159909c63c9913e10dc4c3a1c2832d2a566fd8a2f5dfe52f1a10628695f64b6fdbe8a1d7fec955c38511868c592e6b48c99bb3b682
|
7
|
+
data.tar.gz: ccb1c397c1493b1d788af86f3dca9a368150165825e8ed82af04b06b481a96ed66e376ce3c3f53a6ce2a183f2bf80af83446a7b719d7a66b4e5d0a151251a2d5
|
@@ -2,6 +2,15 @@
|
|
2
2
|
|
3
3
|
module Ibrain
|
4
4
|
class GraphqlController < Ibrain::BaseController
|
5
|
+
include Devise::Controllers::ScopedViews
|
6
|
+
|
7
|
+
before_action :authenticate_user!, unless: :skip_operations
|
8
|
+
before_action :map_user_class_to_request
|
9
|
+
|
10
|
+
helpers = %w(resource scope_name resource_name signed_in_resource
|
11
|
+
resource_class resource_params devise_mapping)
|
12
|
+
helper_method(*helpers)
|
13
|
+
|
5
14
|
def execute
|
6
15
|
query, variables, operation_name = normalize_entity
|
7
16
|
|
@@ -10,7 +19,9 @@ module Ibrain
|
|
10
19
|
variables: variables,
|
11
20
|
context: {
|
12
21
|
session: session,
|
13
|
-
current_user: try_ibrain_current_user
|
22
|
+
current_user: try_ibrain_current_user,
|
23
|
+
controller: self,
|
24
|
+
request: request
|
14
25
|
},
|
15
26
|
operation_name: operation_name
|
16
27
|
)
|
@@ -51,5 +62,11 @@ module Ibrain
|
|
51
62
|
def schema
|
52
63
|
Ibrain::Config.graphql_schema.safe_constantize
|
53
64
|
end
|
65
|
+
|
66
|
+
def map_user_class_to_request
|
67
|
+
return if request.env['devise.mapping'].present?
|
68
|
+
|
69
|
+
request.env['devise.mapping'] = Ibrain.user_class
|
70
|
+
end
|
54
71
|
end
|
55
72
|
end
|
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.1.
|
4
|
+
version: 0.1.8
|
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:
|
11
|
+
date: 2022-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord-session_store
|