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

Enable Relationships on Fields not visible to Role #10598

Open
olmohake opened this issue Nov 14, 2024 · 1 comment
Open

Enable Relationships on Fields not visible to Role #10598

olmohake opened this issue Nov 14, 2024 · 1 comment
Labels
k/enhancement New feature or improve an existing feature

Comments

@olmohake
Copy link

c/v3-console

Is your proposal related to a problem?

I have a user table with id, stripe_customer_id etc and a relationship to stripe getCustomersCustomer and GetPaymentMethods.
The relationship are defined as follows:

---
kind: Relationship
version: v1
definition:
  name: customer
  sourceType: User
  target:
    command:
      name: GetCustomersCustomer
  mapping:
    - source:
        fieldPath:
          - fieldName: stripeId
      target:
        argument: 
          argumentName: id

---
kind: Relationship
version: v1
definition:
  name: payment_methods
  sourceType: User
  target:
    command:
      name: GetPaymentMethods
  mapping:
    - source:
        fieldPath:
          - fieldName: stripeId
      target:
        argument: 
          argumentName: customer

to enable the following query:

{
  user{
    id
    customer{
      invoiceSettings{
        defaultPaymentMethod
      }
      
    }
  }
}

As soon as i remove stripe_customer_id from the list of a allowedField the relationships are removed as well.

Describe the solution you'd like

If a role has the permission to view a subset of an ObjectType and the permission to call a Command, a relationship from ObjectType to Command should be accessible for the role, even if the role has no permission to access the field the relationship is based on directly .

I don't want to expose the stripe_customer_id to the user, but using it in the query-engine to resolve the related data should still be supported.

Alternatives

Call commands with argumentPresets based on session variables.

@olmohake olmohake added the k/enhancement New feature or improve an existing feature label Nov 14, 2024
@robertjdominguez
Copy link
Contributor

@olmohake — just to call out your alternative, have you tried implementing ArgumentPresets as documented?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
k/enhancement New feature or improve an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants