graphql-engine/server/tests-py/queries/graphql_mutation/update/permissions/setup_mssql.yaml
Rakesh Emmadi f00404e0f6 server/mssql: update mutation, SQL generation and execution
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3059
GitOrigin-RevId: 4ed0cbf54ac2a7103cb2b7adc97b2dfdf9994c4f
2021-12-15 13:56:34 +00:00

91 lines
1.7 KiB
YAML

type: bulk
args:
- type: mssql_track_table
args:
source: mssql
table:
name: author
- type: mssql_track_table
args:
source: mssql
table:
name: article
#Object relationship article <-> author
- type: mssql_create_object_relationship
args:
source: mssql
table: article
name: author
using:
foreign_key_constraint_on: author_id
#Array relationship author <-> article
- type: mssql_create_array_relationship
args:
source: mssql
table: author
name: articles
using:
foreign_key_constraint_on:
table: article
column: author_id
#Author select permission for user
- type: mssql_create_select_permission
args:
source: mssql
table: author
role: user
permission:
columns: [id, name]
filter:
id: X-HASURA-USER-ID
#Author update permission for user
- type: mssql_create_update_permission
args:
source: mssql
table: author
role: user
permission:
columns:
- name
filter:
id: X-Hasura-User-Id
#Article select permission for user
- type: mssql_create_select_permission
args:
source: mssql
table: article
role: user
permission:
columns: '*'
filter:
$or:
- author_id: X-HASURA-USER-ID
- is_published: 1
#Article update permission for user
#Allow modifications only on unpublished articles
- type: mssql_create_update_permission
args:
source: mssql
table: article
role: user
permission:
columns:
- title
- content
- is_published
- published_on
filter:
$and:
- author_id: X-HASURA-USER-ID
- is_published: 0
check:
is_published: 0