{# # --------------------------------------------------------------------- # # GLPI - Gestionnaire Libre de Parc Informatique # # http://glpi-project.org # # @copyright 2015-2025 Teclib' and contributors. # @licence https://www.gnu.org/licenses/gpl-3.0.html # # --------------------------------------------------------------------- # # LICENSE # # This file is part of GLPI. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # --------------------------------------------------------------------- #} {% import 'components/form/fields_macros.html.twig' as fields %} {% import 'components/form/basic_inputs_macros.html.twig' as inputs %} {% set is_sync_mode = _request['mode']|default(0) == constant('AuthLDAP::ACTION_SYNCHRONIZE') %} {% set is_expert_interface = _request['interface']|default('simple') == constant('AuthLDAP::EXPERT_INTERFACE') %} {% set selected_authldaps_id = _request['authldaps_id'] %} {% set selected_entity = _request['entities_id']|default(session('glpiactive_entity')) %}

{{ is_sync_mode ? __('Synchronizing already imported users') : __('Import new users') }}

{% if can_use_expert_interface %} {{ fields.sliderField('interface', is_expert_interface, is_expert_interface ? __('Expert mode') : __('Simple mode'), { no_value: 'simple', yes_value: 'expert', }) }} {% endif %}
{# Expert interface only shows a BaseDN and Filter field while simple interface shows several individual filters #}
{% if has_multiple_servers %} {{ fields.dropdownField('AuthLDAP', 'authldaps_id', selected_authldaps_id, 'AuthLDAP'|itemtype_name, { condition: {is_active: 1}, display_emptychoice: false, }) }} {% endif %} {% if is_multi_entities_mode() %} {{ fields.dropdownField('Entity', 'entities_id', selected_entity, 'Entity'|itemtype_name, { entity: session('glpiactiveentities'), add_field_class: is_expert_interface ? 'd-none' : '', add_field_attribs: { 'data-interface': 'simple' } }) }} {% endif %} {{ fields.smallTitle(__('Search criteria for users')) }} {{ fields.textField('basedn', _request['basedn'] ?? '', __('BaseDN'), { full_width: true, add_field_class: is_expert_interface ? '' : 'd-none', add_field_attribs: { 'data-interface': 'expert' } }) }} {{ fields.textField('ldap_filter', _request['ldap_filter'] ?? '', __('Search filter for users'), { full_width: true, add_field_class: is_expert_interface ? '' : 'd-none', add_field_attribs: { 'data-interface': 'expert' } }) }} {% set simple_fields = { 'login_field': __('Login'), 'sync_field': __('Synchronization field') ~ ' (' ~ authldap.fields['sync_field'] ?? '' ~ ')', 'email1_field': _n('Email', 'Emails', 1), 'email2_field': __('%1$s %2$s')|format(_n('Email', 'Emails', 1), '2'), 'email3_field': __('%1$s %2$s')|format(_n('Email', 'Emails', 1), '3'), 'email4_field': __('%1$s %2$s')|format(_n('Email', 'Emails', 1), '4'), 'realname_field': __('Surname'), 'firstname_field': __('First name'), 'phone_field': _x('ldap', 'Phone'), 'phone2_field': __('Phone 2'), 'mobile_field': __('Mobile phone'), 'title_field': _x('person', 'Title'), 'category_field': _n('Category', 'Categories', 1), 'picture_field': _n('Picture', 'Pictures', 1), } %} {% for field, label in simple_fields %} {% if authldap.fields[field] is defined and authldap.fields[field] is not empty %} {{ fields.textField('criterias[' ~ field ~ ']', _request['criterias'][field]|default(''), label, { add_field_class: is_expert_interface ? 'd-none' : '', add_field_attribs: { 'data-interface': 'simple' } }) }} {% endif %} {% endfor %} {% set updated_date_fields %} {{ inputs.datetime('begin_date', _request['begin_date']|default(null), { maybeempty: true, clearable: true, }) }} -> {{ inputs.datetime('end_date', _request['end_date']|default(null), { maybeempty: true, clearable: true, }) }} {% endset %} {{ fields.htmlField('', updated_date_fields, __('View updated users'), { add_field_class: is_expert_interface ? 'd-none' : '', add_field_attribs: { 'data-interface': 'simple' }, }) }}