-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Revoking Access from Group #338
Labels
sdk
Used for automation
Comments
Proposed recipe; from posit import connect
#### User-defined inputs ####
# 1. specify the guid for the content item
content_guid = "CONTENT_GUID_HERE"
# 2. specify either the principal_guid or group name prefix
principal_guid = "USER_OR_GROUP_GUID_HERE"
group_name_prefix = "GROUP_NAME_PREFIX_HERE"
############################
client = connect.Client()
# Remove a single permission by principal_guid
client.content.get(content_guid).permissions.destroy(principal_guid)
# Remove by user (if principal_guid is a user)
user = client.users.get(principal_guid)
client.content.get(content_guid).permissions.destroy(user)
# Remove by group (if principal_guid is a group)
group = client.groups.get(principal_guid)
client.content.get(content_guid).permissions.destroy(group)
# Remove all groups with a matching prefix name
groups = client.groups.find(prefix=group_name_prefix)
client.content.get(content_guid).permissions.destroy(*groups)
# Confirm new permissions
client.content.get(content_guid).permissions.find() |
Nice! Let's use |
For consistency, we can replace and/or deprecate
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Related Recipe Issue: https://github.com/rstudio/connect/issues/28826
Current recipe code: https://docs.posit.co/connect/cookbook/content-access-controls/revoking-access-from-a-group/
The text was updated successfully, but these errors were encountered: