Skip to content

Instantly share code, notes, and snippets.

@runeb
Created November 13, 2019 17:00
Show Gist options
  • Save runeb/6df439900232e34d7009bfd0cd44c3bc to your computer and use it in GitHub Desktop.
Save runeb/6df439900232e34d7009bfd0cd44c3bc to your computer and use it in GitHub Desktop.
const sanityClient = require('@sanity/client')
const client = sanityClient({
projectId: 'your-project-id',
dataset: 'production',
token: 'token-with-create-session-rights',
useCdn: false
})
const accessDocument = {
"_id": "_.groups.staff_writer",
"_type": "system.group",
"_rev": "wzDKrHcEddnCsDSCdb6KHZ",
"_createdAt": "2017-12-12T11:46:55Z",
"_updatedAt": "2017-12-12T11:46:55Z",
"grants": [
{
"filter": "_type == 'categories'",
"permissions": ["read", "create"]
},
{
"filter": "_type == 'post'",
"permissions": ["read", "update", "create"]
}
],
"members": ["e-a-user-id", "e-another-user-id"]
}
client.createOrReplace(accessDocument).then(() => console.log('Access document updated'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment