Sample: Modify Permissions
This sample demonstrates how to modify permissions that are automatically updated as part of the standard post-publish step the SDK performs. To perform a separate permission update, with full control over the update logic, see the update permissions post-publish hook sample.
Permission transformers are registered for the IPermissionSet
type and runs for all content types that support permissions, as well as project default permissions for all content types.
Transformer Class
To modify permissions in Python, you can use the following transformer class:
from tableau_migration import (
ContentTransformerBase,
GranteeType,
IPermissionSet
)
class ModifyPermissionsTransformer(ContentTransformerBase[IPermissionSet]):
def transform(self, item_to_transform: IPermissionSet) -> IPermissionSet:
filtered_grantees = [g for g in item_to_transform.grantee_capabilities if g.grantee_type != GranteeType.GROUP]
return item_to_transform
Registration
plan_builder.transformers.add(ModifyPermissionsTransformer)
See hook registration for more details.