def remove_permissions()

in ees_network_drive/enterprise_search_wrapper.py [0:0]


    def remove_permissions(self, permission):
        """Removes one or more permissions from an existing set of permissions
        :param permission: dictionary containing permission of perticular user
        """
        try:
            if self.version >= ENTERPRISE_V8:
                user_name = permission["external_user_properties"][0]["attribute_value"]
                self.workplace_search_client.delete_external_identity(
                    content_source_id=self.ws_source, external_user_id=user_name
                )
            else:
                user_name = permission["user"]
                self.workplace_search_client.remove_user_permissions(
                    content_source_id=self.ws_source,
                    user=user_name,
                    body={"permissions": permission["permissions"]},
                )
            self.logger.info("Successfully removed the permissions from the workplace.")
        except Exception as exception:
            self.logger.exception(
                f"Error while removing the permissions from the workplace. Error: {exception}"
            )