I needed to add image upload to a custom role, so that an author role could add a profile picture

4 replies
Last updated: Sep 30, 2020
Hope this helps someone else. I needed to add image upload to a custom role, so that an author role could add a profile picture. It needed:
 {
          filter: '_id in path("**")',
          permissions: ['read', 'create', 'update'],
 },

Sep 29, 2020, 3:01 AM
Thanks for sharing back Jesse! 🙌
Quick note: the above gives the permissions to any
_id
matching that path, so also non-image documents. This could be just fine depending on what you have in mind for the custom role. However, if you’d like to target images more specifically, you could also try a filter like this:
{
  filter: '_type == "sanity.imageAsset"',
  permissions: ['read', 'create', 'update'],
},
Sep 29, 2020, 5:34 AM
ah!! sanity. prefix !!!
Sep 30, 2020, 2:14 AM
thanks
user M
Sep 30, 2020, 2:14 AM
i was so close
Sep 30, 2020, 2:15 AM

Sanity.io – build remarkable experiences at scale

Sanity is a customizable solution that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Categorized in