
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeYes, you can hide dashboard items, menu items, and schema pages from users based on their role or email! This is a powerful feature for customizing the Studio experience based on user permissions.
First, you'll want to set up custom roles (available on Enterprise plans) to control what content users can access. Custom roles use GROQ filters to define which documents users can see and edit.
You can customize what appears in the Studio using the Structure Builder API based on user context. The Structure Builder receives a context object that includes currentUser information:
import type {StructureResolver} from 'sanity/structure'
export const structure: StructureResolver = (S, context) => {
const user = context?.currentUser
const roles = user?.roles.map((r) => r.name)
// Check if user has specific role
const isEditor = roles?.includes('editor')
return S.list()
.id('root')
.title('Content')
.items([
// Always show articles
S.documentTypeListItem('article').title('Articles'),
// Only show settings for non-editors
...(!isEditor ? [
S.documentTypeListItem('settings').title('Settings')
] : [])
])
}The currentUser object provides:
email: User's email addressid: User IDname: User's nameroles: Array of role objects with name and titleYou can also use the userHasRole() helper function:
import {userHasRole} from 'sanity'
if (userHasRole(currentUser, 'editor')) {
// Hide certain items
}You can filter based on email directly:
const isSpecificUser = user?.email === 'editor@example.com'You can also control which document types appear in the "Create" menu:
// In sanity.config.ts
export default defineConfig({
document: {
newDocumentOptions: (prev, {currentUser}) => {
const roles = currentUser?.roles.map(r => r.name)
// Remove certain types for editors
if (roles?.includes('editor')) {
return prev.filter(item =>
!['settings', 'config'].includes(item.templateId)
)
}
return prev
}
}
})You can even hide entire tools/plugins based on role:
plugins: [
media(),
{
name: 'conditional-tools',
tools: (prev, {currentUser}) =>
userHasRole(currentUser, 'editor')
? prev.filter((tool) => tool.name !== 'media')
: prev
}
]Check out the Studio customizations lesson for detailed examples and the custom roles documentation for setting up proper permissions.
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store