Commit Graph

2754 Commits

Author SHA1 Message Date
Rikin Kachhia
8357142001 docs: add v2.0 upgrade related docs
- add [page](https://deploy-preview-814--hasura-docs-mono.netlify.app/graphql/core/databases/connect-db.html) on connecting databases
- add [page](https://deploy-preview-814--hasura-docs-mono.netlify.app/graphql/cloud/projects/move-project-v2.html) to move 1.3 cloud projects to 2.0
- add [section](https://deploy-preview-814--hasura-docs-mono.netlify.app/graphql/core/migrations/upgrade-v3.html#continue-using-config-v2) on continue using config v2 with v2.0 projects

GitOrigin-RevId: 5353466425f1c33d987037b739213a30e87e0efa
2021-03-08 15:43:35 +00:00
Aravind K P
f6ca551df4 cli: support mssql sources
GitOrigin-RevId: 4b1a63c8dc342ae4001b16c4b1dce282092d5c6f
2021-03-08 12:00:34 +00:00
Karthikeyan Chinnakonda
92026b769f [Preview] Inherited roles for postgres read queries
fixes #3868

docker image - `hasura/graphql-engine:inherited-roles-preview-48b73a2de`

Note:

To be able to use the inherited roles feature, the graphql-engine should be started with the env variable `HASURA_GRAPHQL_EXPERIMENTAL_FEATURES` set to `inherited_roles`.

Introduction
------------

This PR implements the idea of multiple roles as presented in this [paper](https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/FGALanguageICDE07.pdf). The multiple roles feature in this PR can be used via inherited roles. An inherited role is a role which can be created by combining multiple singular roles. For example, if there are two roles `author` and `editor` configured in the graphql-engine, then we can create a inherited role with the name of `combined_author_editor` role which will combine the select permissions of the `author` and `editor` roles and then make GraphQL queries using the `combined_author_editor`.

How are select permissions of different roles are combined?
------------------------------------------------------------

A select permission includes 5 things:

1. Columns accessible to the role
2. Row selection filter
3. Limit
4. Allow aggregation
5. Scalar computed fields accessible to the role

 Suppose there are two roles, `role1` gives access to the `address` column with row filter `P1` and `role2` gives access to both the `address` and the `phone` column with row filter `P2` and we create a new role `combined_roles` which combines `role1` and `role2`.

Let's say the following GraphQL query is queried with the `combined_roles` role.

```graphql
query {
   employees {
     address
     phone
   }
}
```

This will translate to the following SQL query:

```sql

 select
    (case when (P1 or P2) then address else null end) as address,
    (case when P2 then phone else null end) as phone
 from employee
 where (P1 or P2)
```

The other parameters of the select permission will be combined in the following manner:

1. Limit - Minimum of the limits will be the limit of the inherited role
2. Allow aggregations - If any of the role allows aggregation, then the inherited role will allow aggregation
3. Scalar computed fields - same as table column fields, as in the above example

APIs for inherited roles:
----------------------

1. `add_inherited_role`

`add_inherited_role` is the [metadata API](https://hasura.io/docs/1.0/graphql/core/api-reference/index.html#schema-metadata-api) to create a new inherited role. It accepts two arguments

`role_name`: the name of the inherited role to be added (String)
`role_set`: list of roles that need to be combined (Array of Strings)

Example:

```json
{
  "type": "add_inherited_role",
  "args": {
      "role_name":"combined_user",
      "role_set":[
          "user",
          "user1"
      ]
  }
}
```

After adding the inherited role, the inherited role can be used like single roles like earlier

Note:

An inherited role can only be created with non-inherited/singular roles.

2. `drop_inherited_role`

The `drop_inherited_role` API accepts the name of the inherited role and drops it from the metadata. It accepts a single argument:

`role_name`: name of the inherited role to be dropped

Example:

```json

{
  "type": "drop_inherited_role",
  "args": {
      "role_name":"combined_user"
  }
}
```

Metadata
---------

The derived roles metadata will be included under the `experimental_features` key while exporting the metadata.

```json
{
  "experimental_features": {
    "derived_roles": [
      {
        "role_name": "manager_is_employee_too",
        "role_set": [
          "employee",
          "manager"
        ]
      }
    ]
  }
}
```

Scope
------

Only postgres queries and subscriptions are supported in this PR.

Important points:
-----------------

1. All columns exposed to an inherited role will be marked as `nullable`, this is done so that cell value nullification can be done.

TODOs
-------

- [ ] Tests
   - [ ] Test a GraphQL query running with a inherited role without enabling inherited roles in experimental features
   - [] Tests for aggregate queries, limit, computed fields, functions, subscriptions (?)
   - [ ] Introspection test with a inherited role (nullability changes in a inherited role)
- [ ] Docs
- [ ] Changelog

Co-authored-by: Vamshi Surabhi <6562944+0x777@users.noreply.github.com>
GitOrigin-RevId: 3b8ee1e11f5ceca80fe294f8c074d42fbccfec63
2021-03-08 11:15:10 +00:00
Kali Vara Purushotham Santhati
34b611ae43 cli: fix extension of generated seeds file
close https://github.com/hasura/graphql-engine/issues/6422

GitOrigin-RevId: 2cbf4a64598e7ef8866cedb46686a8ec4642a63d
2021-03-08 08:30:17 +00:00
Aravind K P
3bfa6834a8 cli: add precondition checks for config v3 update command
GitOrigin-RevId: 62f786ea8fc8d14deb0e78bbbdc2467b7a4e0e9e
2021-03-08 06:58:49 +00:00
Naveen Naidu
f55df228fe Server: Add Event Trigger Metrics
- [x] **Event Triggers Metrics**
  - [x] Distribution of size of event trigger fetches / Number of events fetched in the last `event trigger fetch`
  - [x] Event Triggers: Number of event trigger HTTP workers in process
  - [x]  Event Triggers: Avg event trigger lock time (if an event has been fetched but not processed because http worker is not free)

#### Sample response
The metrics can be viewed from the `/dev/ekg` endpoint

```json
{
"num_events_fetched":{
      "max":0,
      "mean":0,
      "count":1,
      "min":0,
      "variance":null,
      "type":"d",
      "sum":0
   },
 "num_event_trigger_http_workers":{
      "type":"g",
      "val":0
   },
"event_lock_time":{
      "max":0,
      "mean":0,
      "count":0,
      "min":0,
      "variance":0,
      "type":"d",
      "sum":0
   },
```

#### Todo
- [ ]  Group similar metrics together (Eg: Group all the metrics related to Event trigger, How do we do it??)

Closes: https://github.com/hasura/graphql-engine-mono/issues/202
GitOrigin-RevId: bada11d871272b04c8a09d006d9d037a8464a472
2021-03-07 05:25:24 +00:00
Antoine Leblanc
5a1f71b3bc server/mssql: fix parsing of text column values
GitOrigin-RevId: c4692cdc254af074f70cdceb78c7dc6211e7e084
2021-03-05 18:33:16 +00:00
Kali Vara Purushotham Santhati
6d04f587b4 cli: follow symlinks in migrations directory
GitOrigin-RevId: 66840f2b087be3c7660115c5e7158574997f0292
2021-03-05 17:14:17 +00:00
Aravind K P
0f307fd0a4 docs: add pre update checklist for config v3 update
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: f97c38530ad608372d7e6f7fef4045e08e3b7acb
2021-03-05 16:29:56 +00:00
Sameer Kolhar
78785ae513 server: fix fromJSON for RemoteSchemaPermsCtx
GitOrigin-RevId: a0a6d50a39ffbc7fab0a303b50c3e2c485954773
2021-03-05 13:26:57 +00:00
Kali Vara Purushotham Santhati
f998fc089e cli: add API docs
Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: 1cbcba2d458d82814703682c63b1f0f7bf6226bc
2021-03-05 11:57:55 +00:00
Rakesh Emmadi
edf5a0661e server: support mssql views
GitOrigin-RevId: 50e2fc1d64a67a9284ae62d2401ca6f9627ebdab
2021-03-05 10:53:38 +00:00
Sameer Kolhar
642c950827 server: fix ToJSON instance of RemoteSchemaPermsCtx
GitOrigin-RevId: 7e8ffa747bb645ce6b606ef38a16120f420832bf
2021-03-05 07:47:00 +00:00
Aravind K P
c8e08e2804 cli: support rest endpoints
GitOrigin-RevId: cd32497fb751489d9b17e91e30e18772f7fa07ec
2021-03-05 03:22:59 +00:00
Rikin Kachhia
fa90e9d004 docs: update feature version support notes
GitOrigin-RevId: 4627c876b2771c84602f4bfaa1ab0646b2650f12
2021-03-04 19:21:21 +00:00
Sameer Kolhar
ee56b741d8 server: add is_remote_schema_permissions_enabled to config API
GitOrigin-RevId: 7129d0fba25edc2450c74140335df9398154ce52
2021-03-04 16:22:31 +00:00
Tirumarai Selvan
d1d8cc0a40 tag release v2.0.0-alpha.3 (#790)
GitOrigin-RevId: 7b61e8190d07ebe45ff96ee5209992dfc3c53b93
2021-03-04 14:30:32 +00:00
Vishnu Bharathi
0c8dce35e4 ci: avoids doing backport release commit
GitOrigin-RevId: 5aa89862f0427bdc3ab1aa84ba8041286786fcb0
2021-03-04 12:45:08 +00:00
Lyndon Maydwell
cb85d62078 docs: add info on variable interpretation for primitive URL variables
Additional documentation for REST queries with respect to how url template variables and query variables are interpreted.

* Route variables and Query parameters are interpreted as scalars according to the variables types in the associated query and passed as JSON data through the query variables:
   * Missing nullable variables are interpreted as NULL
   * Boolean variables are interpreted as Bools
   * Boolean flags without values e.g. ``/api/rest/myquery?mybool`` are interpreted as True for boolean variables
   * String variables are interpreted as literal Strings
   * UUID variables are interpreted as strings
   * ID variables are interpreted as strings
   * Number, Int, Float, and Double variables are interpreted as Numbers
   * All other types or mismatches currently report variable type errors

---

### Kodiak commit message

Documentation for variable interpretation for primitive URL variables

#### Commit title
Documentation for variable interpretation for primitive URL variables

Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: 2d90facd0e644e275fe752dc393f066fb71490c5
2021-03-04 10:38:51 +00:00
Karthikeyan Chinnakonda
f2199c4174 fix the changelog of static console assets fix (#771)
GitOrigin-RevId: 9516a41c3f615b1ef5264a7c902adf153ae85c00
2021-03-04 06:50:35 +00:00
hasura-bot
da3c9f2c53 minor typo fixes (#165)
Co-authored-by: Colby Thomas <coloradocolby@gmail.com>
GITHUB_PR_NUMBER: 6311
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/6311

Co-authored-by: Colby Thomas <coloradocolby@gmail.com>
Co-authored-by: Vamshi Surabhi <0x777@users.noreply.github.com>
GitOrigin-RevId: 946665878fb9199d067ad1bd981de9525e86a0ae
2021-03-04 06:36:15 +00:00
hasura-bot
564184ef95 docs: use same userId in login example (#127)
Co-authored-by: Tobias Törnros <t.tornros@gmail.com>
GITHUB_PR_NUMBER: 6270
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/6270

Co-authored-by: Tobias Törnros <t.tornros@gmail.com>
Co-authored-by: Vamshi Surabhi <0x777@users.noreply.github.com>
GitOrigin-RevId: 3eed6b2cb413911a407a2a6ecf3e400d2d0919ab
2021-03-04 06:31:59 +00:00
Vamshi Surabhi
ab1ccfdbcd rfc: permissions layer on functions (#384)
GitOrigin-RevId: 1eb01e0d4579298478cdb3d1f2669d902e466c48
2021-03-04 04:08:09 +00:00
Vamshi Surabhi
95fe9be148 rfc: optimistic concurrency control for metadata changes (#480)
GitOrigin-RevId: 9b6f10138777e1d078cad37b0325b9973566c0a0
2021-03-04 04:08:03 +00:00
Aleksandra Sikora
c763494005 console: fix deleting remote relationship
GitOrigin-RevId: 31839bb8c4e26cc760bc3d9cbfbb0bd04c027d9b
2021-03-03 15:24:53 +00:00
Vijay Prasanna
968b573171 console: add relationship tab for mssql tables
GitOrigin-RevId: dc55849c9c38834481fc855e5242f7bf0d3a5e6e
2021-03-03 14:18:38 +00:00
Vladimir Ciobanu
d5ff1acf2d better handling for one-to-one relationships
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: 1bb5bc0c4ac8109ee1d20563d23cf98e0906a483
2021-03-03 13:02:59 +00:00
Karthikeyan Chinnakonda
15ed0cf536 server: document the remote joins architecture
GitOrigin-RevId: f142908fa3dd3b0cb8887521c639be4a017e606a
2021-03-03 11:47:13 +00:00
Vijay Prasanna
42f5d66015 console: fix adding new function doesn't update sidebar content
Co-authored-by: Aleksandra Sikora <9019397+beerose@users.noreply.github.com>
GitOrigin-RevId: 5c2e0366f50b46846d05be84d4256bd406cf8829
2021-03-03 10:29:22 +00:00
Praveen Durairaju
917670db36 update brand assets
GitOrigin-RevId: df68cc9d4141e1e5c29dd33509c90f91c03744dd
2021-03-03 09:00:49 +00:00
Vladimir Ciobanu
d4d02c08d8 update ci-info-hs for cabal 3.4 (#747)
Co-authored-by: Vamshi Surabhi <0x777@users.noreply.github.com>
GitOrigin-RevId: 29bed5510b971572bf545e588065bbe1b5743d2c
2021-03-03 07:02:42 +00:00
David Overton
456b6d5664 Tests for metadata resource version
GitOrigin-RevId: c1db1355ef8c6617db8179c8c50ba2bd91f7062f
2021-03-03 04:41:02 +00:00
hasura-bot
28db360098 Fix typo in response-caching.rst (#734)
Co-authored-by: chrismcc <chrisvariety@users.noreply.github.com>
GITHUB_PR_NUMBER: 6623
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/6623

Co-authored-by: chrismcc <chrisvariety@users.noreply.github.com>
Co-authored-by: Vamshi Surabhi <0x777@users.noreply.github.com>
GitOrigin-RevId: 5169da9bfa2052ca5f11b25e29d2b5660d93c473
2021-03-03 03:59:13 +00:00
Rikin Kachhia
eab2bdf85c docs: remove version indicator
GitOrigin-RevId: a3b4c9ce1a2f14543cb22c344ecc0465a585449a
2021-03-02 17:34:13 +00:00
Karthikeyan Chinnakonda
d2418383bf server: add https remote schema tests
GitOrigin-RevId: 9e9e66248f956174dc8197adeb7a48da12e53dac
2021-03-02 16:52:47 +00:00
Karthikeyan Chinnakonda
f2724c97b4 build: fix the packaging of the static console assets
GitOrigin-RevId: 01a6e4f15366476f01ca355f1013712e24bb4a3b
2021-03-02 13:23:53 +00:00
Praveen Durairaju
101d76096f docs: add trailing slash to blog links, update header link
GitOrigin-RevId: e1fb08d1f0123df7e9717e3e56c24ea37f759408
2021-03-02 09:27:14 +00:00
Praveen Durairaju
a5c02ab405 community: update sample apps to use hasura cloud and v3 migrations/metadata
GitOrigin-RevId: c3858e4ed2f3d544f797ee159bd03b458d9cf82e
2021-03-02 08:32:37 +00:00
Vishnu Bharathi
bf76de3ab6 ci: exits in case of an error in Makefile, refactor cli-migrations-v2 image in accordance with hge base image
Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: 484147cb31becf6742620219d1c2b96a66bdb667
2021-03-02 07:26:30 +00:00
David Overton
e4c8d560c5 Fix/missing source error
GitOrigin-RevId: 074f4eb2d13a2c8ab002a355c6734eed257482d3
2021-03-02 04:27:29 +00:00
Vladimir Ciobanu
88ce387919 docs: add note about recovering existentially quantified type info
This should be merged after #686

GitOrigin-RevId: a372ca475a9c4a182b4819310634d4c3985225ab
2021-03-01 22:31:55 +00:00
Vladimir Ciobanu
ddbc497506 docs: add note on existentials and references to it
Added a note on existentials. I plan to create a subsequent PR with a note on how we use the singletons trick to recover the type inside an existential.

GitOrigin-RevId: 1f227d859dcc384b4ac7e103053f643f879827d1
2021-03-01 21:38:50 +00:00
Abby Sassel
01cb59919f docs: changelog & server documentation improvements
GitOrigin-RevId: e6a5e464acb5492ab7a592362fff2bac6528dfaa
2021-03-01 20:53:43 +00:00
Abhijeet Singh Khangarot
afd70e9952 console: data sidebar routing fix
GitOrigin-RevId: c3aadc392c38b9f9a1ea18298c58eaa98a4e1d66
2021-03-01 20:07:36 +00:00
Praveen Durairaju
0ff26100bf update docs link to avoid redirects
GitOrigin-RevId: 1f2a1d21bfb9b2908d56305fa2dfb69270deafdf
2021-03-01 18:51:18 +00:00
Anon Ray
5b916eaaa6 docs: add pg source config details
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
GitOrigin-RevId: e0a4f7c268763dcd95f3d002ea13b929a5beef33
2021-03-01 15:34:02 +00:00
Sooraj
48efc72b02 console: update oss-console-build resources and terser config
Co-authored-by: Vishnu Bharathi <4211715+scriptnull@users.noreply.github.com>
GitOrigin-RevId: ceab8597216b44082916ae1d7293f4c3ee0ab0f9
2021-03-01 13:58:00 +00:00
Sooraj
581d4a0691 console: support connection string without username
GitOrigin-RevId: 66b56d1280e0efad41dd7785f2f73942484ea99e
2021-03-01 12:25:56 +00:00
Sameer Kolhar
f8c5f1b634 console: fix adding allowed query (#721)
GitOrigin-RevId: 8acee7ce4eb4a4fce02cb219f53126daf6ca1158
2021-03-01 11:34:15 +00:00
Vamshi Surabhi
e9f85ce6e6 mssql: connection pooling
GitOrigin-RevId: c1a6509f19a903724ce2b770ae23cbd925b537f8
2021-02-25 18:16:52 +00:00