这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@rikinsk-zz
Copy link

Description

Affected components

  • Console

Related Issues

Solution and Design

Steps to test and verify

Limitations, known bugs & workarounds

@netlify
Copy link

netlify bot commented Apr 15, 2019

Deploy preview for hasura-docs ready!

Built with commit 4346269

https://deploy-preview-2009--hasura-docs.netlify.com

@rikinsk-zz rikinsk-zz merged commit 5626a30 into hasura:master Apr 15, 2019
@hasura-bot
Copy link
Contributor

Review app https://hge-ci-pull-2009.herokuapp.com is deleted

@rikinsk-zz rikinsk-zz deleted the console-permissions branch April 15, 2019 13:27
polRk pushed a commit to polRk/graphql-engine that referenced this pull request Feb 12, 2020
hasura-bot pushed a commit that referenced this pull request Jul 23, 2025
<!-- The PR description should answer 2 important questions: -->

### What

In hasura/v3-engine#1954 we started using
`authorization_rules` internally for type output permissions. Here, we
do the same for select permissions for models, using
`authorization_rules` in `plan` to calculate:
- can we select from this `Model`?
- are there any filters we need to apply?
- are we allowed to do subscriptions with it?
- which argument presets do we need?
- which relational mutations are we allowed (`update`, `delete`,
`insert`)?

### Performance

Benchmarks is measured against current `main`.

`Total Execution Time` is a bit slower for simpler queries, but faster
for more complex queries, particularly those using relationships.

This tracks with the changes as:
- we cache the results of evaluating `Conditions` to optimise for
running `x-hasura-role == foo` checks over and over again, but we are
still doing more work than a simple map lookup.
- when collecting filters for `ModelPermissions`, we return
`Vec<&ModelPredicate>` and pass that around, only cloning them when
actually needed. This reduces a bunch of unnecessary cloning,
particularly where relationships are concerned, as we'd check a user
could access the model underneath a relationship but never use the
filters for anything else.

```
simple_select/bench_execute/Total Execution time
                        time:   [648.73 µs 659.03 µs 669.90 µs]
                        change: [+11.312% +14.294% +17.206%] (p = 0.00 < 0.05)
                        Performance has regressed.

select_many/bench_execute/Total Execution time
                        time:   [608.95 µs 619.06 µs 629.69 µs]
                        change: [+8.5431% +10.842% +13.304%] (p = 0.00 < 0.05)
                        Performance has regressed.

select_many_where/bench_execute/Total Execution time
                        time:   [1.2079 ms 1.2287 ms 1.2506 ms]
                        change: [+0.0203% +2.1676% +4.6082%] (p = 0.05 < 0.05)
                        Change within noise threshold.

object_relationship/bench_execute/Total Execution time
                        time:   [831.13 µs 843.36 µs 855.92 µs]
                        change: [-0.4508% +1.6093% +3.5083%] (p = 0.12 > 0.05)
                        No change in performance detected.

array_relationship/bench_execute/Total Execution time
                        time:   [779.65 µs 792.49 µs 806.21 µs]
                        change: [-17.943% -15.474% -12.910%] (p = 0.00 < 0.05)
                        Performance has improved.

relay_node_field/bench_execute/Total Execution time
                        time:   [605.03 µs 614.19 µs 623.73 µs]
                        change: [-29.244% -26.453% -23.661%] (p = 0.00 < 0.05)
                        Performance has improved.
```

---------

Co-authored-by: Brandon Simmons <brandon.m.simmons@gmail.com>
V3_GIT_ORIGIN_REV_ID: 6d96e5ccbdd6c095112c58cda430ce30b01b3544
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants