mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-17 12:31:52 +03:00
f967a4b22e
Fixes https://github.com/hasura/graphql-engine/issues/6385 In the v1.3.4-beta.2 version, the SQL generated for a query action containing relationship and configured with permissions parsed the `x-hasura-user-id` session variable value through the `hasura.user` postgres setting instead of passing the session variables as an JSON object to the query as it was in v1.3.3. This PR fixes the SQL generation to that of v1.3.3 Co-authored-by: Rakesh Emmadi <12475069+rakeshkky@users.noreply.github.com> GitOrigin-RevId: 838ba812f89b51df7fcead81b9d3c2885dfa39b4
130 lines
2.4 KiB
YAML
130 lines
2.4 KiB
YAML
type: bulk
|
|
args:
|
|
|
|
- type: run_sql
|
|
args:
|
|
sql: |
|
|
CREATE TABLE "user"(
|
|
id SERIAL PRIMARY KEY,
|
|
name TEXT NOT NULL,
|
|
email TEXT NOT NULL,
|
|
is_admin BOOLEAN NOT NULL DEFAULT false
|
|
);
|
|
|
|
- type: track_table
|
|
args:
|
|
name: user
|
|
schema: public
|
|
|
|
- type: set_custom_types
|
|
args:
|
|
input_objects:
|
|
- name: UserInput
|
|
fields:
|
|
- name: name
|
|
type: String!
|
|
- name: email
|
|
type: String!
|
|
|
|
- name: InObject
|
|
fields:
|
|
- name: id
|
|
type: ID
|
|
- name: name
|
|
type: String
|
|
- name: age
|
|
type: Int
|
|
|
|
objects:
|
|
- name: UserId
|
|
fields:
|
|
- name: id
|
|
type: Int!
|
|
relationships:
|
|
- name: user
|
|
type: object
|
|
remote_table: user
|
|
field_mapping:
|
|
id: id
|
|
|
|
- name: OutObject
|
|
fields:
|
|
- name: id
|
|
type: ID! # For issue https://github.com/hasura/graphql-engine/issues/4061
|
|
- name: name
|
|
type: String
|
|
|
|
- type: create_action
|
|
args:
|
|
name: create_user
|
|
definition:
|
|
kind: synchronous
|
|
arguments:
|
|
- name: email
|
|
type: String!
|
|
- name: name
|
|
type: String!
|
|
output_type: UserId
|
|
handler: http://127.0.0.1:5593/create-user
|
|
|
|
- type: create_action
|
|
args:
|
|
name: create_users
|
|
definition:
|
|
kind: synchronous
|
|
arguments:
|
|
- name: users
|
|
type: '[UserInput!]!'
|
|
output_type: '[UserId]'
|
|
handler: http://127.0.0.1:5593/create-users
|
|
|
|
- type: create_action
|
|
args:
|
|
name: mirror
|
|
definition:
|
|
kind: synchronous
|
|
arguments:
|
|
- name: arg
|
|
type: InObject!
|
|
output_type: OutObject
|
|
handler: http://127.0.0.1:5593/mirror-action
|
|
|
|
- type: create_action
|
|
args:
|
|
name: get_user_by_email
|
|
definition:
|
|
type: query
|
|
arguments:
|
|
- name: email
|
|
type: String!
|
|
output_type: UserId!
|
|
handler: http://127.0.0.1:5593/get-user-by-email
|
|
|
|
- type: create_action
|
|
args:
|
|
name: get_users_by_email
|
|
definition:
|
|
type: query
|
|
arguments:
|
|
- name: email
|
|
type: String!
|
|
output_type: '[UserId]!'
|
|
handler: http://127.0.0.1:5593/get-users-by-email
|
|
|
|
- type: create_select_permission
|
|
args:
|
|
table: user
|
|
role: user
|
|
permission:
|
|
columns:
|
|
- id
|
|
- name
|
|
- email
|
|
filter:
|
|
id: X-Hasura-User-Id
|
|
|
|
- type: create_action_permission
|
|
args:
|
|
action: get_user_by_email
|
|
role: user
|