Graphcool / graphcool-framework

Apache License 2.0
1.78k stars 130 forks source link

Local simple endpoint does not expose permission schema #440

Open marktani opened 6 years ago

marktani commented 6 years ago

Issue by marktani Thursday Dec 21, 2017 at 14:09 GMT Originally opened as https://github.com/graphcool/prisma/issues/1439


Current behavior

Local simple endpoint does not expose permission schema

Reproduction

graphcool init

Replace the wildcard permission in graphcool.yml with this:

permissions:
  - operation: "User.read"
graphcool deploy # choose local
curl 'http://localhost:60000/simple/v1/__SERVICE_ID__/permissions' -H 'Origin: file://' -H 'Accept-Encoding: gzip, deflate, br' -H 'Content-Type: application/json' -H 'Accept: */*' -H 'Connection: keep-alive' -H 'DNT: 1' --data-binary '{"query":"query {\n  SomeUserExists\n}","variables":""}' --compressed -H 'Authorization: Bearer __TOKEN__'

Where __SERVICE_ID__ is the service id and __TOKEN__ is the platform token from ~/.graphcoolrc.

Response:

{
  "code": 3008,
  "requestId": "local:simple:cjbgk7pxj003g0186u59ldoie",
  "error": "Insufficient permissions for this query"
}

Expected behavior?

Query should be evaluated and either true or false is returned.

Workaround

A possible work around for now is to deploy a dummy service with the same schema remotely, because the available permissions only depend on the schema.

Anujraval24 commented 5 years ago

what is the fix ? @marktani