def METHOD_NAME(self, node: Dir, final_component: str, rule: FilesystemAccessRule) -> None:
    assert final_component != '', 'Must not have trailing slashes in rule path'
    if isinstance(rule, ExactFile):
        new_node = node.subpath_map.setdefault(final_component, File())
        assert isinstance(new_node, File), "Can't add ExactFile: Dir rule exists"
    else:
        new_node = node.subpath_map.setdefault(final_component, Dir())
        assert isinstance(new_node, Dir), "Can't add rule: File rule exists"
        self._finalize_directory_rule(new_node, rule)