Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC/v3] Presets in Permissions #10112

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 40 additions & 0 deletions rfcs/Presets in Permissions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Presets in Permissions

As a part of command permissions, we want to be able to control what values for an argument a particular role can pass.

The following changes are proposed to the metadata.

For command permissions, allow specifying a set of argument values which will be preset. Arguments which have been preset no longer get generated in the GraphQL schema.

```yaml
kind: CommandPermissions
version: v1
definition:
  commandName: delete_user
  permissions:
    - role: user
      allowExecution: true
      argumentPresets:
        - argument: user_id
          value:
            sessionVariable: x-hasura-user-id
```

A similar change would be required for model arguments / ModelPermissions.

Also, for supporting complex input objects, we will allow input presets in TypePermissions as well

```yaml
kind: TypePermissions
version: v1
definition:
  typeName: DeleteUserInput
  permissions:
    - role: user
      input:
        fieldPresets:
          - field: is_frozen
            value:
              literal: false
```
Any field which has been preset will not be generated in the GraphQL schema. If all fields of a type have been preset then the parent field / argument will not be generated.