{% load permission_tags %}
{% load navigation_tags %}
{% load acl_tags %}

{% with link.permissions as permissions %}
    {% check_permissions request.user permissions %}
    {% check_access permissions request.user object %}

    {% if permission or access %}
        {% if as_li %}
            <li class="{% if forloop.first and li_class_first %}{{ li_class_first }} {% endif %}{% if link.active and li_class_active %}{{ li_class_active }}{% endif %}">
        {% endif %}

            {% include 'generic_link_instance.html' %}

        {% if as_li %}
            </li>
        {% endif %}
    {% endif %}
{% endwith %}
