Creating a UML permission field with preset values in Sanity Studio

34 replies
Last updated: Oct 12, 2021
how would you recommend creating a UML permission field called permission that has 4 preset values corresponding to [public, private, protected, package] ? In the schema
Oct 12, 2021, 8:10 AM
you can use something like :_experimental_actions: [ /*'create', 'update', 'delete', 'publish*/
],
Oct 12, 2021, 12:20 PM
thanks for both options - the second one is required by my LRM schemas
Oct 12, 2021, 6:31 PM
p.s. what is this ticket thingo?
Oct 12, 2021, 6:32 PM
It's the way track tickets within Slack. We have a write-up on it here !
Oct 12, 2021, 6:33 PM
Neat. And a sanity powered bot is also fascinating!?
Oct 12, 2021, 6:34 PM
That's one of the coolest things about Sanity to me. Because of the APIs and how unopinionated it is about how your content is used you can do some really cool stuff!
Oct 12, 2021, 6:44 PM
I have a bot project on the back-burner, perhaps I’ll fast track it.
Oct 12, 2021, 6:46 PM
p.s. I think you might want to put this answer in the snippets part of the sanity site. Perhaps also add it to the schema docs.
Oct 12, 2021, 6:58 PM
p.s. I think you might want to put this answer in the snippets part of the sanity site. Perhaps also add it to the schema docs.
Oct 12, 2021, 6:58 PM
I've been thinking about that for the last few weeks, actually. Determining which schema to use for which purpose can sometimes be a bit opaque when you're new to the Studio. These things are documented, but it's usually buried in the middle of optional parameters and can be very easily overlooked. We need to either provide a guide in the Getting Started section or supplement the existing docs with more examples that are easier to understand.
Oct 12, 2021, 7:04 PM
I leaned mostly from the schemas created by the cli,
Oct 12, 2021, 7:05 PM
Ah, like one of the options you can select when you bootstrap a new project with
sanity init
?
Oct 12, 2021, 7:05 PM
but I also read the schema docs a few times
Oct 12, 2021, 7:06 PM
yes
Oct 12, 2021, 7:06 PM
Got it. I wonder if creating an option for some sort of 'everything' studio that has all of these examples would also be helpful in that case.
Oct 12, 2021, 7:06 PM
It would
Oct 12, 2021, 7:07 PM
I kind of made one like that
Oct 12, 2021, 7:07 PM
Thank you for the feedback! It's super helpful!
Oct 12, 2021, 7:07 PM
I then started over to learn about template integration
Oct 12, 2021, 7:08 PM
but I got tons of schemas in that studio.
Oct 12, 2021, 7:08 PM
there was some interesting localization examples in the e-commerce one
Oct 12, 2021, 7:09 PM
I have a list of questions in faqs within helpArticles in that datasets.
Oct 12, 2021, 7:10 PM
Here are a couple:
Oct 12, 2021, 7:13 PM
1. can I set options to show the category document type as a nested tree (extra points for a filter control). I guess the media plugins do it with custom react code.
Oct 12, 2021, 7:14 PM
2. When I have a reference field (say to a category) and the category does not exist could I add an option to create it (in a model dialog window perhaps)?
Oct 12, 2021, 7:16 PM
2. When I have a reference field (say to a category) and the category does not exist could I add an option to create it (in a model dialog window perhaps)?
Oct 12, 2021, 7:16 PM
For your second question, the answer is 'soon'! It's one of our most requested features and we are actively looking for a solution. For your first, I think I'm not understanding it correctly, can you elaborate so that hopefully I get it 🙂 ?
Oct 12, 2021, 7:20 PM
great
Oct 12, 2021, 7:21 PM
I have a category schema with a reference field called patent. (which I got from the docs I think)
Oct 12, 2021, 7:21 PM
I’d like to have a better editing experience with this category document - I’d like to see children under their parent using a tree or nested lists instead of a list (in the second column of the desk)
Oct 12, 2021, 7:23 PM
and I’d like to filter by children of design pattern (used in the pattern catalog) or by children of fullStack (used in the post)
Oct 12, 2021, 7:26 PM
I know it is possible to filter in a reference field.
Oct 12, 2021, 7:26 PM
and I’d like to filter by children of design pattern (used in the pattern catalog) or by children of fullStack (used in the post)
Oct 12, 2021, 7:26 PM
something like:
Oct 12, 2021, 7:30 PM

Sanity– build remarkable experiences at scale

The Sanity Composable Content Cloud is the 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?