Revoking Access from a Group
Problem
You need to revoke a group’s access to a content item.
Solution
from posit import connect
= "c92da1ad-9c48-420f-8e2a-dcd2d58f9723"
CONTENT_GUID = "286d77ab-cc4d-430d-848d-67c8179de942"
GROUP_GUID
= connect.Client()
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
= client.groups.get(GROUP_GUID)
group
client.content.get(CONTENT_GUID).permissions.destroy(group)
# Confirm new permissions
client.content.get(CONTENT_GUID).permissions.find()
library(connectapi)
<- "c92da1ad-9c48-420f-8e2a-dcd2d58f9723"
CONTENT_GUID <- "286d77ab-cc4d-430d-848d-67c8179de942"
GROUP_GUID
<- connect()
client
# For the specified content item remove the desired group
<- content_item(client, CONTENT_GUID)
content content_delete_group(content, GROUP_GUID)
# Confirm new permissions
get_content_permissions(content)