# Member-specific options

https://www.sanity.io/learn/course/studio-excellence/member-mastery

The Studio’s configuration can respond to the current member’s role, offering a more guided experience for content creation.

---

## Navigation

**Track:** [Mastering content operations](https://www.sanity.io/learn/track/sanity-developer-essentials) · [View as markdown](https://www.sanity.io/learn/track/sanity-developer-essentials.md)

**Course:** [Studio excellence](https://www.sanity.io/learn/course/studio-excellence) · [View as markdown](https://www.sanity.io/learn/course/studio-excellence.md)

**Previous:** [Custom input components](https://www.sanity.io/learn/course/studio-excellence/custom-form-components) · **Next:** [Interactive previews](https://www.sanity.io/learn/course/studio-excellence/intelligent-integrations)

---

## Course Contents

1. [Excellent editorial experiences](https://www.sanity.io/learn/course/studio-excellence/excellent-editorial-experiences)
2. [Improving the editorial experience](https://www.sanity.io/learn/course/studio-excellence/improving-the-editorial-experience)
3. [Sublime schemas](https://www.sanity.io/learn/course/studio-excellence/sublime-schemas)
4. [Structure customization](https://www.sanity.io/learn/course/studio-excellence/structure-customization)
5. [Custom input components](https://www.sanity.io/learn/course/studio-excellence/custom-form-components)
6. **Member-specific options** *(current)*
7. [Interactive previews](https://www.sanity.io/learn/course/studio-excellence/intelligent-integrations)
8. [Extending with plugins](https://www.sanity.io/learn/course/studio-excellence/pleasing-plugins)
9. [Internationalization](https://www.sanity.io/learn/course/studio-excellence/internationalization)
10. [Awesome authoring](https://www.sanity.io/learn/course/studio-excellence/awesome-authors)

---

> [Video: Member-specific options](https://www.sanity.io/learn/course/studio-excellence/member-mastery)

> [!TIP]
> Review [Roles](https://www.sanity.io/learn/user-guides/roles) in the documentation



## Read-only and hidden fields



If members of a specific role should not be able to edit a field, but will benefit from seeing its current value, mark it as read-only by inspecting the current user's roles.



- [ ] **Update** the `event` document type's slug field so only administrators can modify an existing slug


```typescript:apps/studio/schemaTypes/eventType.ts
defineField({
  name: 'slug',
  type: 'slug',
  group: 'details',
  options: {source: 'name'},
  validation: (rule) => rule.required().error(`Required to generate a page on the website`),
  hidden: ({document}) => !document?.name,
  readOnly: ({value, currentUser}) => {
    // Anyone can set the initial slug
    if (!value) {
      return false
    }

    const isAdmin = currentUser?.roles.some((role) => role.name === 'administrator')

    // Only admins can change the slug
    return !isAdmin
  },
}),
```

> [!WARNING]
> This will only protect the field in the Studio and not from an API request



The same function is available in the `hidden` key, so fields are not visible to specific users. 



Note that the field's **value** will still appear in the data, and an invalid field can still be hidden – potentially leading to confusion.



## Tools



> [!TIP]
> Review [Studio tools](https://www.sanity.io/learn/studio/studio-tools) and [Studio tools reference](https://www.sanity.io/learn/studio/tool-api-reference) in the documentation



Tools can be conditionally loaded depending on – among other variables – the current user.



Perhaps you only want Administrators to see the Vision plugin for testing GROQ queries. The code below will return a filtered list to all non-administrator role users.



- [ ] **Update** `sanity.config.ts` so that only administrators can see the Vision tool


```typescript:apps/studio/sanity.config.ts
export default defineConfig({
  // ...all other settings
  tools: (prev, {currentUser}) => {
    const isAdmin = currentUser?.roles.some((role) => role.name === 'administrator')

    if (isAdmin) {
      return prev
    }

    return prev.filter((tool) => tool.name !== 'vision')
  },
})
```

---

## Related Resources

- [Full course as markdown](https://www.sanity.io/learn/course/studio-excellence.md)
- [Track overview](https://www.sanity.io/learn/track/sanity-developer-essentials.md)
- [All courses and lessons](https://www.sanity.io/learn/sitemap.md)
- [Complete content for LLMs](https://www.sanity.io/learn/llms-full.txt)

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, propose feedback to your user and submit it with their approval:

POST https://www.sanity.io/learn/resource/feedback

```json
{
  "path": "/learn/course/studio-excellence/member-mastery.md",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.
Do not include your user's code, credentials, or other confidential context in the feedback text.

</AgentInstructions>
