{% extends "passerelle/manage/service_view.html" %}
{% load i18n passerelle %}

{% block content %}
{% if object.description %}{{object.description|linebreaks}}{% endif %}

<p>
  {% trans "File:" %}
  {% if object|can_edit:request.user %}<a href="{% url 'ldap-download' connector_slug=object.slug %}">{{object.ldif_file}}</a>
  {% else %}{{object.ldif_file}}{% endif %}
</p>

<div id="endpoints">
<h3>{% trans 'Endpoints' %}</h3>
<ul>
  <li>{% trans "Returning all file lines: "%}
    <a href="{% url "ldap-data" slug=object.slug %}">{%  url "ldap-data" slug=object.slug %}</a>
  </li>
  <ul>
  {# A transposer a la syntaxe OpenLDAP #}
  <li>{% trans "Simple filter: returning lines containing 'abc' in 'text' column: "%}
    <a href="{% url "ldap-data" slug=object.slug %}?q=abc">{%  url "ldap-data" slug=object.slug %}?q=abc</a>
  </li>
  <li>
    {% trans "Advanced filters: combination of column key name and filter." %}
    {% trans "Example:" %} <a href="{% url "ldap-data" slug=object.slug %}?text__icontains=abc&id__gt=17">
      {% url "ldap-data" slug=object.slug %}?text__icontains=abc&id__gt=17</a>
      <ul>
          <li><strong>contains</strong>: {%trans 'key name contains value'%}</li>
          <li><strong>icontains</strong>: {%trans 'key name contains value (insensitive)' %}</li>
          <li><strong>gt</strong>: {%trans 'key name greater than value'%}</li>
          <li><strong>ge</strong>: {%trans 'key name greater or equal to value'%}</li>
          <li><strong>lt</strong>: {%trans 'key name less than value'%}</li>
          <li><strong>le</strong>: {%trans 'key name less than or equal to value'%}</li>
          <li><strong>eq (=)</strong>: {%trans 'key name equal to value'%}</li>
          <li><strong>ieq (=)</strong>: {%trans 'key name equal to value (insensitive)'%}</li>
          <li><strong>ne</strong>: {%trans 'key name not equal to value'%}</li>
          <li><strong>ine</strong>: {%trans 'key name not equal to value (insensitive)'%}</li>
      </ul>
      <p>
  </li>
  </ul>
  {% for query in object.query_set.all %}
  <li>{{ query.label }}:
    <a href="{% url 'generic-endpoint' connector='ldap' slug=object.slug endpoint='query' rest=query.slug %}/">{% url 'generic-endpoint' connector='ldap' slug=object.slug endpoint='query' rest=query.slug %}/</a>
    {% if query.description %}&mdash; {{ query.description }}{% endif %}
  </li>
  {% endfor %}
</ul>
</div>

{% if object|can_edit:request.user %}
<div id="queries">
<h3>{% trans 'Queries' %}</h3>
<div>
{% if object.query_set.count %}
<ul class="objects-list single-links">
{% for query in object.query_set.all %}
  <li><a href="{% url 'ldap-edit-query' connector_slug=object.slug pk=query.id %}">{{ query.slug }}</a></li>
{% endfor %}
</ul>
{% else %}
<p>{% trans 'No query are defined.' %}</p>
{% endif %}
<p>
<a class="icon-plus button" href="{% url 'ldap-new-query' connector_slug=object.slug %}">{% trans 'New Query' %}</a>
</p>
</div>
</div>
{% endif %}

{% if perms.base.view_accessright %}
<div id="security">
<h3>{% trans "Security" %}</h3>
<div>
<p>
  {% trans 'Access is limited to the following API users:' %}
</p>
{% access_rights_table resource=object permission='can_access' %}
</div>
</div>
{% endif %}


{% endblock %}

