server-client-python
server-client-python copied to clipboard
Delete default permissions does not take in a list
Regular permission delete method takes in a singular PermissionRule object, or a list of them. It will delete all the permissions included in the list.
Default permissions delete method only accepts a singular PermissionRule object. It will only delete 1 set of rules maximum. See sample, line 75-79.
Code comments currently in permissions_endpoint show that delete_permissions can take either a single rule or a list. We should update delete_default_permissions to do the same. # Delete is the only endpoint that doesn't take a list of rules # so let's fake it to keep it consistent
There's quite a few methods to update:
Hi there, first time responder, long time user of tsc here and i want to start with you guys are awesome and very much appreciate your work here. I was working through this recently and noticed that to fix it, all that seems to be needed is to apply the same signature and loop logic that is done on the delete permissions method in the permissions endpoint to the default_permissions_endpoint.
first just update the signature, then add the check and outer loop.
def delete_default_permission(self, resource: BaseItem, rules: Union[PermissionsRule,List[PermissionsRule]], content_type: Resource) -> None:
# applying fix so that delete default endpoint can handle a list of rules like the delete permissions endpoint does
if isinstance(rules,PermissionsRule):
rules = [rules]
for rule in rules:
for capability, mode in rule.capabilities.items():...`