sanity icon indicating copy to clipboard operation
sanity copied to clipboard

Presentation tool crashes with Contributor role

Open Onurfesci opened this issue 6 months ago • 0 comments

Describe the bug Can the Contributor role not use the Presentation tool? I assume it should work like the Structure tool? This is forcing us to give everyone Editor permissions because naturally people want to edit visually. This is making the Contributor role pretty much redundant in our org. Is this a bug or am I missing something here?

It is crashing as a result of this request failing:

https://{projectId}.[api.sanity.io/v2023-11-09/data/mutate/production?tag=sanity.studio.sanity.preview-url-secret&returnIds=true&visibility=sync](http://api.sanity.io/v2023-11-09/data/mutate/production?tag=sanity.studio.sanity.preview-url-secret&returnIds=true&visibility=sync)

[
  {
    "createOrReplace": {
      "_id": "sanity-preview-url-secret.9ae3b630-8b31-4592-b116-3394e03f1843",
      "_type": "sanity.previewUrlSecret"
    }
  },
  {
    "patch": {
      "id": "sanity-preview-url-secret.9ae3b630-8b31-4592-b116-3394e03f1843",
      "set": {
        "secret": "YmRlMDE4ZDRiZDY4NTU2Y2U1N2EwMWEyMDU4ZTE2YWQ",
        "source": "@sanity/presentation",
        "studioUrl": "https://aspirelending.co.uk/studio/presentation/aspire-lending.legal/941b5c54-525c-4fb9-a08e-a20ee08d41a5?preview=/legal/new-legal-doc",
        "userId": "pQmXD374k"
      }
    }
  }
]

Response:

{
  "description": "transaction failed: Insufficient permissions; permission \"create\" required",
  "items": [
    {
      "error": {
        "description": "Insufficient permissions; permission \"create\" required",
        "permission": "create",
        "type": "insufficientPermissionsError"
      },
      "index": 0
    }
  ],
  "type": "mutationError"
}

Why is Sanity checking for these permissions before rendering the presentation tool? The Contributor role should definitely have preview/draft permissions. If the Presentation tool just rendered regardless of permissions, I feel like there wouldn't be an issue.

To Reproduce

Steps to reproduce the behavior:

  1. Go to Presentation tab as a Contributor role within any Studio
  2. See error

Expected behavior Contributor role should be able to use Presentation tool for live editing.

Screenshots image image

Which versions of Sanity are you using?

@sanity/cli (global)        3.52.4 (up to date)
@sanity/icons                3.3.1 (up to date)
@sanity/image-url            1.0.2 (up to date)
@sanity/preview-url-secret  1.6.19 (up to date)
@sanity/react-loader        1.10.5 (up to date)
@sanity/ui                   2.8.8 (up to date)
@sanity/vision              3.52.4 (up to date)
sanity                      3.52.4 (up to date)

What operating system are you using? Mac OS

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

Additional context I haven't been able to get a reply in the #help channel for this. I would really appreciate someone from Sanity to help out or give some insight about this issue. Thank you!

Onurfesci avatar Aug 13 '24 22:08 Onurfesci