Describe the bug
I logged in as a user with read-only permissions (Viewer role). I still have the option to upload a new media file and delete one. When I perform any of those actions, it throws an error.
To Reproduce
Steps to reproduce the behavior:
Create a user and assign Viewer role to it.
Upload any media asset through the Upload assets button on the top-right corner.
It would throw an error: TypeError: Cannot set properties of undefined (setting 'error')
Then click on any media and delete it through the Delete button on the bottom-left corner.
It would set the media in a constant loading state and throw an error: Insufficient permissions: permission "create" required
Expected behavior
Either the button should be disabled as it is across the rest of Sanity (or) some way to pass user permissions as part of the config
Screenshots
Plugin and environment information:
Plugin version
"sanity-plugin-media": "^2.2.5"
Sanity version
@sanity/cli (global) 3.50.0 (latest: 3.52.0)
@sanity/color 3.0.6 (up to date)
@sanity/color-input 3.1.1 (up to date)
@sanity/document-internationalization 3.0.0 (up to date)
@sanity/form-builder 2.36.2 (up to date)
@sanity/icons 3.3.0 (latest: 3.3.1)
@sanity/image-url 1.0.2 (up to date)
@sanity/language-filter 4.0.2 (up to date)
@sanity/ui 2.6.8 (latest: 2.8.8)
@sanity/util 3.50.0 (latest: 3.52.0)
@sanity/vision 3.50.0 (latest: 3.52.0)
@sanity/webhook 4.0.4 (up to date)
sanity 3.50.0 (latest: 3.52.0)
Describe the bug I logged in as a user with read-only permissions (Viewer role). I still have the option to upload a new media file and delete one. When I perform any of those actions, it throws an error.
To Reproduce Steps to reproduce the behavior:
Viewer
role to it.Upload assets
button on the top-right corner.TypeError: Cannot set properties of undefined (setting 'error')
Delete
button on the bottom-left corner.Insufficient permissions: permission "create" required
Expected behavior Either the button should be disabled as it is across the rest of Sanity (or) some way to pass user permissions as part of the config
Screenshots
Plugin and environment information: