prisma / prisma-admin-feedback

Feedback for Prisma Admin (currently in invite-only preview)
6 stars 1 forks source link

Prisma Console is not allowing me to add permissions to a user #124

Closed WebRuin closed 5 years ago

WebRuin commented 5 years ago

I am trying to add permissions to a user in the Prisma Console. And here are the steps I am trying to take.

  1. I click the three dots next to above and to the right of the permissions field
  2. I click "Add an item"
  3. I click and choose the permission I want
  4. I see "1 Unconfirmed change"
  5. I click "Save to draft"
  6. I notice nothing changed.

This is in my schema.graphql

type User {
  id: ID!
  name: String!
  email: String!
  permissions: [Permission!]!
}

This is the enum for my USER

enum Permission {
  ADMIN
  USER
  BATHROOMCREATE
  BATHROOMUPDATE
  BATHROOMDELETE
  PERMISSIONUPDATE
}

I have combed through my code a hundred times and see no bugs that would cause this. Please help or fix this if it is a bug.

This may also help: Prisma Forum Thread on this topic

WebRuin commented 5 years ago

Confused

sdnts commented 5 years ago

Hi @WebRuin, we've just a released a new version where I can't seem to reproduce this, which leads me to believe this should be fixed now.

Unfortunately, this is a breaking change, so you'd have to re-deploy your service using prisma deploy again. If you run into issues, you can read more about the release and the changes here

Can you let me know after if you still see this?

WebRuin commented 5 years ago

1) I updated my syntax and added the new required fields:

datamodel.prisma

enum Permission {
  ADMIN
  USER
  BATHROOMCREATE
  BATHROOMUPDATE
  BATHROOMDELETE
  PERMISSIONUPDATE
}

type User {
  id: ID! @id
  updatedAt: DateTime! @updatedAt
  createdAt: DateTime! @createdAt
  name: String!
  email: String! @unique
  password: String!
  resetToken: String
  resetTokenExpiry: String
  permissions: [Permission] @scalarList(strategy: RELATION)
}

schema.graphql

type User {
  id: ID!
  name: String!
  email: String!
  permissions: [Permission!]!
}

2) I redeployed with prisma deploy --force

3) I deleted all my users (dev so not a huge deal)

4) I created a new user

Sadly I can still not add permissions to users. The console shows " 1 Unconfirmed change", but the new perm is not added

WebRuin commented 5 years ago

Here is my code

sdnts commented 5 years ago

@WebRuin I tried the datamodel you're using (thanks for that!), and tried creating a user with permissions, and then tried adding permissions to an existing user, but it worked both times :(

Do you see any errors in the UI after you hit Save Changes? Can you see if there are any requests in the DevTools Network tab that failed? I'm guessing the mutation is rejected by the server, which is why changes aren't showing up. There should also be a log in the DevTools console which is the actual mutation string that's sent to the Prisma server. Can you send me that as well?

Also, I couldn't see a docker-compose file in the repo you've attached. Is that not committed or are you using our demo servers? If you are using Docker, why version of the Prisma image (I'm on 1.31) and connector are you using (I'm using MySQL). This is just to make sure we're on the same environment!

WebRuin commented 5 years ago

I am using the demo servers for now.

Here is an error I see in the console just after clicking a new permission:

TypeError: Cannot read property 'splice' of undefined
    at listActions.js:45
    at Object.L [as default] (immer.module.js:719)
    at i (listActions.js:43)
    at Object.t.listActions (listActions.js:33)
    at produceIF.js:27
    at Array.forEach (<anonymous>)
    at Proxy.<anonymous> (produceIF.js:13)
    at immer.module.js:398
    at Object.L [as default] (immer.module.js:723)
    at Object.t.produceIF (produceIF.js:12)
    at sagas.js:79
    at sagas.js:24
    at Object.next (sagas.js:5)
    at M (proc.js:311)
    at w (proc.js:388)
    at proc.js:699
    at N (proc.js:435)
    at M (proc.js:315)
    at w (proc.js:388)
    at proc.js:699
    at N (proc.js:435)
    at M (proc.js:315)
    at e (proc.js:270)
    at L (proc.js:554)
    at N (proc.js:435)
    at M (proc.js:315)
    at w (proc.js:388)
    at proc.js:593
    at N (proc.js:435)
    at M (proc.js:315)
    at w (proc.js:388)
    at i (proc.js:466)
    at Object.put (channel.js:73)
    at channel.js:161
    at Array.<anonymous> (channel.js:182)
    at Object.emit (channel.js:26)
    at middleware.js:67
    at dispatch (applyMiddleware.js:35)
    at utils.js:250
    at proc.js:489
    at i (scheduler.js:19)
    at s (scheduler.js:60)
    at t.a (scheduler.js:33)
    at Array.<anonymous> (channel.js:185)
    at Object.emit (channel.js:26)
    at middleware.js:67
    at i.(anonymous function) (https://app.prisma.io/static/js/main.d6268a63.js:1:2587702)
    at t.addNewItem (ListField.js:60)
    at n.onSelect (Input.js:75)
    at onClick (ListInput.js:41)

I am trying to add PERMISSIONUPDATE. I get these after clicking Save Changes:

{data: {updateUserData_0: {id: "cjuooc4jtbsjo0b12qhl9f7z2", __typename: "User"}}}
data: {updateUserData_0: {id: "cjuooc4jtbsjo0b12qhl9f7z2", __typename: "User"}}
updateUserData_0: {id: "cjuooc4jtbsjo0b12qhl9f7z2", __typename: "User"}
id: "cjuooc4jtbsjo0b12qhl9f7z2"
__typename: "User"

data: {users: [{id: "cjuooc4jtbsjo0b12qhl9f7z2", name: "Tim Smith", email: "tim.smith.hdg@gmail.com",…}],…} count: {aggregate: {count: 1, typename: "AggregateUser"}, typename: "UserConnection"} aggregate: {count: 1, typename: "AggregateUser"} count: 1 typename: "AggregateUser" typename: "UserConnection" users: [{id: "cjuooc4jtbsjo0b12qhl9f7z2", name: "Tim Smith", email: "tim.smith.hdg@gmail.com",…}] 0: {id: "cjuooc4jtbsjo0b12qhl9f7z2", name: "Tim Smith", email: "tim.smith.hdg@gmail.com",…} email: "tim.smith.hdg@gmail.com" id: "cjuooc4jtbsjo0b12qhl9f7z2" name: "Tim Smith" id: "cjuooc4jtbsjo0b12qhl9f7z2" typename: "User"

data: {users: [{id: "cjuooc4jtbsjo0b12qhl9f7z2", name: "Tim Smith", email: "tim.smith.hdg@gmail.com",…}],…} count: {aggregate: {count: 1, typename: "AggregateUser"}, typename: "UserConnection"} aggregate: {count: 1, typename: "AggregateUser"} count: 1 typename: "AggregateUser" typename: "UserConnection" users: [{id: "cjuooc4jtbsjo0b12qhl9f7z2", name: "Tim Smith", email: "tim.smith.hdg@gmail.com",…}] 0: {id: "cjuooc4jtbsjo0b12qhl9f7z2", name: "Tim Smith", email: "tim.smith.hdg@gmail.com",…} email: "tim.smith.hdg@gmail.com" id: "cjuooc4jtbsjo0b12qhl9f7z2" name: "Tim Smith" id: "cjuooc4jtbsjo0b12qhl9f7z2" typename: "User"

WebRuin commented 5 years ago

Not sure what changed, but it is working now! Thank you!

sdnts commented 5 years ago

Oh that's weird, but I'm glad this is resolved!

mephysto commented 4 years ago

I'd like to add that I also ran into this issue. It wasn't working on Chrome (Version 77.0.3865.120 (Official Build) (64-bit), on MacOS Catalina, adblockers were turned off).

But then I tried on Safari it did work. So added in here in case someone runs into it.

pablopunk commented 4 years ago

@mephysto same thing here. Chrome (Windows 10) is not working but it did work fine on Firefox

aaronmarkle commented 4 years ago

Adding to the list that this was not working in Chrome Version 79.0.3945.130 (Official Build) (64-bit), but worked for me when I used Safari.

pascaloliv commented 4 years ago

Thanks @mephysto Same problem here using Prisma console on app.prisma.io.

With OS: mac os 10.15.3 Chrome: build 80.0.3987.149

It works using Safari 13.0.5. 👍

louisotto commented 4 years ago

Chrome 80.0.3987.163 on Mac still doesn't work.

davizp commented 4 years ago

I have the same issue on Chrome Version 83.0.4103.97 (Official Build) (64-bit), it works on Safari.

prisma-error

davizp commented 4 years ago

I know how to fix it on Chrome. I did the following:

  1. Deleted the local storage under the prisma domain (https://app.prisma.io/): image

  2. Reload the page and it should work.

prisma-solution

cschweipert commented 3 years ago

This fixed it for me too!! Thanks.