def METHOD_NAME(self, nodes, with_ancestor=False, flat=False):
    """ 获取节点的授权规则 """
    nodes = self.convert_to_queryset_if_need(nodes, Node)
    if with_ancestor:
        nodes = Node.get_ancestor_queryset(nodes)
    node_ids = nodes.values_list('id', flat=True).distinct()
    relations = AssetPermission.nodes.through.objects.filter(node_id__in=node_ids)
    perm_ids = relations.values_list('assetpermission_id', flat=True).distinct()
    perms = self.get_permissions(ids=perm_ids)
    if flat:
        return perms.values_list('id', flat=True)
    return perms