Could anyone please check why a Permissions Query ...
# prisma-whats-new
m
Could anyone please check why a Permissions Query is failing. Permissions Query is: query ($user_id: ID!) { SomeUserExists( filter: { id: $user_id role: MANAGER } ) }
d
I can't see any reason why that would fail, assuming the authenticated user has role set to MANAGER
Have you checked by doing a simple query for the authenticated user:
query{ user{ id role } }
to check which user it thinks you are trying to run things as?
m
yep…did that
finds the user without a problem
d
could you post the schema for the User type and the role enum?
m
enum Role { USER TRAINER MANAGER }
type User implements Node { auth0UserId: String @isUnique birthdate: DateTime! createdAt: DateTime! createdEvents: [Event!]! @relation(name: “CreatedEventOnUser”) email: String! @isUnique eventRegistrations: [EventRegistration!]! @relation(name: “EventRegistrationOnUser”) id: ID! @isUnique ledEvents: [Event!]! @relation(name: “LedEventOnUser”) name: String! phone: String! @isUnique role: Role! @defaultValue(value: USER) ticketPurchaseRegistrations: [TicketPurchaseRegistration!]! @relation(name: “TicketPurchaseRegistrationOnUser”) ticketPurchases: [TicketPurchase!]! @relation(name: “TicketPurchaseOnUser”) updatedAt: DateTime! }
this query fails in the playground as well..where i can choose which user is the one who does the request
d
you could try running a normal query similar to your permission query in the playground:
query{ allUsers(filter{id"[YOUR_USER_ID]" role:MANAGER}){ id role } }
That will check whether your permission query should be able to find a result
What does your Role enum schema look like?
(testing a permissions query as a standard query can also give more useful error messages sometimes)
m
enum Role { USER TRAINER MANAGER }
is what the role looks like
and the standard query responds with a user id and role
d
In which case I'm at a loss I'm afraid - I can't replicate the issue using a similar schema and permission query
Do you definitely have no other permission queries that could be firing? (e.g. read on the type you are trying to create or on a relationship or type if your create mutation includes nested mutations)