Go Behind the Experience to see how Tecovas brings the West to life with Sanity 🤠 July 18th

Discussion about creating custom roles and permissions in Sanity for a non-profit client.

7 replies
Last updated: Oct 7, 2021
Hi guys I have a question about Sanity's roles and plans. I have used Sanity for a number of projects and really love how flexible it makes the websites I build, however it seems surprisingly rigid in this area. I have a new build coming up for client who requires a few different levels of permissions within the studio when editing content.
• Administrator (can edit everything)
• Editor (can create, edit and publish documents)
• Author (can edit and publish certain documents but can't edit navigation or add new pages)
They have also asked for users to be able to be limited to certain areas of the cms.

It seems like creating these roles and the relevant permissions might be possible using Sanity's
Roles but I was surprised to see this functionality is limited to the enterprise plan. The client is a not for profit and are ok paying $99p/m but there's no way they'll be able to afford over $1000 p/m. I'm hoping there's a way around this (I've been looking at workflows ?) as it would be a deal breaker for the client, which is a shame as Sanity will be so perfect for the rest of the site.
Oct 6, 2021, 12:36 AM
Hey Rachel, ah yes, that's awesome thank you, I'll apply for it. I couldn't see anything about whether it included Custom Roles though?
Oct 6, 2021, 7:45 PM
Oh, actually, you're right. There are no custom roles included in the non-profit plan. One option to avoid this would be to render a different custom desk structure for the editors that you only want to be able to access certain documents. You'd have to build off of something like this and get the current user from the userStore to limit the structure further. There's an example of using the userStore in this initial value template example . Note that these users would still be able to access all documents through the API or searchbar, though.
Oct 6, 2021, 8:00 PM
Ah yep, cool I was looking at something like this. I was thinking I'd also be able to customise the document actions for certain users too? In order to limit their ability to create new pages, but still allow them to edit existing ones?
With regards to the search bar - is it possible to just turn that off for some users?
Oct 6, 2021, 8:03 PM
Ah yep, cool I was looking at something like this. I was thinking I'd also be able to customise the document actions for certain users too? In order to limit their ability to create new pages, but still allow them to edit existing ones?
With regards to the search bar - is it possible to just turn that off for some users?
Oct 6, 2021, 8:03 PM
You may be able to hack-ily hide the search bar using CSS overrides . But It can be a pain to find the right thing to target. With limiting new pages, you can configure the new document menu to only show specific types. A custom document action that prevents certain users from publishing might be an option as well!
Oct 6, 2021, 8:54 PM
You may be able to hack-ily hide the search bar using CSS overrides . But It can be a pain to find the right thing to target. With limiting new pages, you can configure the new document menu to only show specific types. A custom document action that prevents certain users from publishing might be an option as well!
Oct 6, 2021, 8:54 PM
Ok cool – thanks very much Rachael, I think this will cover what I need.
Oct 7, 2021, 11:02 PM

Sanity– build remarkable experiences at scale

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

Was this answer helpful?