sanity-io / sanity-plugin-internationalized-array

A plugin to register array fields with a custom input component to store field values in multiple languages, queryable by using the language ID as an array `_key`.
MIT License
43 stars 11 forks source link

Insufficient permissions: permission "create/update" required #74

Open hari-houdini opened 3 months ago

hari-houdini commented 3 months ago

Describe the bug

When a user has read-only permissions - ("Viewer") role or if the field is read-only, the user can still click on options to create an internationalized string/text for a new locale. But because of the restrictions, it would throw an error.

To Reproduce

Steps to reproduce the behaviour:

  1. Create a user and assign Viewer role to it.
  2. Create aninternationalizedArrayString type field.
  3. When you click on any of the configured languages, it would throw an error

Expected behaviour

Either user should not be able to click it or user should not be able to see the buttons at all to create more localised strings

Screenshots Screenshot 2024-07-22 at 13 56 08 Screenshot 2024-07-22 at 13 56 15

Which versions of Sanity are you using?

@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)

What operating system are you using?

MacOS Sonoma Version 14.5

Which versions of Node.js / npm are you running?

npm 10.1.0 node v20.9.0