Revoking Access from a Group

Problem

You need to revoke a group’s access to a content item.

Solution

from posit import connect

CONTENT_GUID = "c92da1ad-9c48-420f-8e2a-dcd2d58f9723"
GROUP_GUID = "286d77ab-cc4d-430d-848d-67c8179de942"

client = connect.Client()

# Remove a single permission using a GUID
client.content.get(CONTENT_GUID).permissions.destroy(GROUP_GUID)

# Remove a single permission using a Group object
group = client.groups.get(GROUP_GUID)
client.content.get(CONTENT_GUID).permissions.destroy(group)

# Confirm new permissions
client.content.get(CONTENT_GUID).permissions.find()
library(connectapi)

CONTENT_GUID <- "c92da1ad-9c48-420f-8e2a-dcd2d58f9723"
GROUP_GUID <- "286d77ab-cc4d-430d-848d-67c8179de942"

client <- connect()

# For the specified content item remove the desired group
content <- content_item(client, CONTENT_GUID)
content_delete_group(content, GROUP_GUID)

# Confirm new permissions
get_content_permissions(content)