From 5967864e4aa0f30d3e7d8e5a0221c787db2f980f Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Mon, 13 May 2024 23:36:54 +0200 Subject: [PATCH] Finalize the LDAP integration and complete SSO support in the login page (#128) --- application/config/constants.php | 10 + application/controllers/Admins.php | 1 + application/controllers/Customers.php | 1 + application/controllers/Ldap_settings.php | 132 ++++++++++ application/controllers/Login.php | 5 + application/controllers/Providers.php | 12 + application/controllers/Secretaries.php | 1 + application/core/EA_Controller.php | 1 + .../language/arabic/translations_lang.php | 16 ++ .../language/bulgarian/translations_lang.php | 16 ++ .../language/catalan/translations_lang.php | 16 ++ .../language/chinese/translations_lang.php | 16 ++ .../language/croatian/translations_lang.php | 16 ++ .../language/czech/translations_lang.php | 16 ++ .../language/danish/translations_lang.php | 16 ++ .../language/dutch/translations_lang.php | 16 ++ .../language/english/translations_lang.php | 16 ++ .../language/estonian/translations_lang.php | 16 ++ .../language/finnish/translations_lang.php | 16 ++ .../language/french/translations_lang.php | 16 ++ .../language/german/translations_lang.php | 16 ++ .../language/greek/translations_lang.php | 16 ++ .../language/hebrew/translations_lang.php | 16 ++ .../language/hindi/translations_lang.php | 16 ++ .../language/hungarian/translations_lang.php | 16 ++ .../language/italian/translations_lang.php | 16 ++ .../language/japanese/translations_lang.php | 16 ++ .../luxembourgish/translations_lang.php | 16 ++ .../language/marathi/translations_lang.php | 16 ++ .../language/persian/translations_lang.php | 16 ++ .../language/polish/translations_lang.php | 16 ++ .../portuguese-br/translations_lang.php | 16 ++ .../language/portuguese/translations_lang.php | 16 ++ .../language/romanian/translations_lang.php | 16 ++ .../language/russian/translations_lang.php | 16 ++ .../language/serbian/translations_lang.php | 16 ++ .../language/slovak/translations_lang.php | 16 ++ .../language/spanish/translations_lang.php | 16 ++ .../language/swedish/translations_lang.php | 16 ++ .../language/thai/translations_lang.php | 16 ++ .../language/turkish/translations_lang.php | 16 ++ application/libraries/Accounts.php | 20 ++ application/libraries/Ldap_client.php | 236 +++++++++++++++++ .../057_add_ldap_rows_to_settings_table.php | 102 ++++++++ .../058_add_ldap_dn_column_to_users_table.php | 43 +++ application/models/Admins_model.php | 11 + application/models/Customers_model.php | 6 + application/models/Providers_model.php | 6 + application/models/Secretaries_model.php | 11 + application/models/Users_model.php | 37 ++- .../views/components/ldap_import_modal.php | 105 ++++++++ application/views/pages/admins.php | 9 + application/views/pages/customers.php | 9 + application/views/pages/integrations.php | 23 ++ application/views/pages/ldap_settings.php | 165 ++++++++++++ application/views/pages/providers.php | 9 + application/views/pages/secretaries.php | 9 + assets/js/components/ldap_import_modal.js | 170 ++++++++++++ assets/js/http/ldap_settings_http_client.js | 58 +++++ assets/js/pages/admins.js | 3 + assets/js/pages/customers.js | 3 + assets/js/pages/ldap_settings.js | 246 ++++++++++++++++++ assets/js/pages/providers.js | 3 + assets/js/pages/secretaries.js | 3 + assets/js/utils/message.js | 2 +- composer.json | 4 +- openapi.yml | 27 ++ 67 files changed, 1994 insertions(+), 17 deletions(-) create mode 100644 application/controllers/Ldap_settings.php create mode 100644 application/libraries/Ldap_client.php create mode 100644 application/migrations/057_add_ldap_rows_to_settings_table.php create mode 100644 application/migrations/058_add_ldap_dn_column_to_users_table.php create mode 100644 application/views/components/ldap_import_modal.php create mode 100644 application/views/pages/ldap_settings.php create mode 100644 assets/js/components/ldap_import_modal.js create mode 100644 assets/js/http/ldap_settings_http_client.js create mode 100644 assets/js/pages/ldap_settings.js diff --git a/application/config/constants.php b/application/config/constants.php index 15b5e840..9d607214 100644 --- a/application/config/constants.php +++ b/application/config/constants.php @@ -94,6 +94,16 @@ const EVENT_MINIMUM_DURATION = 5; // Minutes const DEFAULT_COMPANY_COLOR = '#ffffff'; +const LDAP_DEFAULT_FILTER = '(&(objectClass=person)(|(cn={{KEYWORD}})(sn={{KEYWORD}})(mail={{KEYWORD}})(givenName={{KEYWORD}})(uid={{KEYWORD}})))'; + +const LDAP_DEFAULT_FIELD_MAPPING = [ + 'first_name' => 'givenname', + 'last_name' => 'sn', + 'email' => 'mail', + 'phone_number' => 'telephonenumber', + 'username' => 'cn', +]; + /* |-------------------------------------------------------------------------- | Webhook Actions diff --git a/application/controllers/Admins.php b/application/controllers/Admins.php index 15614458..a8619a3d 100644 --- a/application/controllers/Admins.php +++ b/application/controllers/Admins.php @@ -34,6 +34,7 @@ class Admins extends EA_Controller 'notes', 'timezone', 'language', + 'ldap_dn', 'settings', ]; diff --git a/application/controllers/Customers.php b/application/controllers/Customers.php index 403b2b49..9809957a 100644 --- a/application/controllers/Customers.php +++ b/application/controllers/Customers.php @@ -38,6 +38,7 @@ class Customers extends EA_Controller 'custom_field_3', 'custom_field_4', 'custom_field_5', + 'ldap_dn', ]; /** diff --git a/application/controllers/Ldap_settings.php b/application/controllers/Ldap_settings.php new file mode 100644 index 00000000..7598dcfc --- /dev/null +++ b/application/controllers/Ldap_settings.php @@ -0,0 +1,132 @@ + + * @copyright Copyright (c) Alex Tselegidis + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org + * @since v1.5.0 + * ---------------------------------------------------------------------------- */ + +/** + * LDAP settings controller. + * + * Handles LDAP settings related operations. + * + * @package Controllers + */ +class Ldap_settings extends EA_Controller +{ + /** + * Ldap_settings constructor. + */ + public function __construct() + { + parent::__construct(); + + $this->load->model('settings_model'); + + $this->load->library('accounts'); + $this->load->library('ldap_client'); + } + + /** + * Render the settings page. + */ + public function index(): void + { + session(['dest_url' => site_url('ldap_settings')]); + + $user_id = session('user_id'); + + if (cannot('view', PRIV_SYSTEM_SETTINGS)) { + if ($user_id) { + abort(403, 'Forbidden'); + } + + redirect('login'); + + return; + } + + $role_slug = session('role_slug'); + + script_vars([ + 'user_id' => $user_id, + 'role_slug' => $role_slug, + 'ldap_settings' => $this->settings_model->get('name like "ldap_%"'), + 'ldap_default_filter' => LDAP_DEFAULT_FILTER, + 'ldap_default_field_mapping' => LDAP_DEFAULT_FIELD_MAPPING, + ]); + + html_vars([ + 'page_title' => lang('ldap'), + 'active_menu' => PRIV_SYSTEM_SETTINGS, + 'user_display_name' => $this->accounts->get_user_display_name($user_id), + 'roles' => $this->roles_model->get(), + ]); + + $this->load->view('pages/ldap_settings'); + } + + /** + * Save general settings. + */ + public function save(): void + { + try { + if (cannot('edit', PRIV_SYSTEM_SETTINGS)) { + throw new RuntimeException('You do not have the required permissions for this task.'); + } + + $settings = request('ldap_settings', []); + + foreach ($settings as $setting) { + $existing_setting = $this->settings_model + ->query() + ->where('name', $setting['name']) + ->get() + ->row_array(); + + if (!empty($existing_setting)) { + $setting['id'] = $existing_setting['id']; + } + + $this->settings_model->save($setting); + } + + response(); + } catch (Throwable $e) { + json_exception($e); + } + } + + /** + * Search the LDAP directory. + * + * @return void + */ + public function search(): void + { + try { + if (cannot('edit', PRIV_SYSTEM_SETTINGS)) { + throw new RuntimeException('You do not have the required permissions for this task.'); + } + + if (!extension_loaded('ldap')) { + throw new RuntimeException('The LDAP extension is not loaded.'); + } + + $keyword = request('keyword'); + + $entries = $this->ldap_client->search($keyword); + + json_response($entries); + } catch (Throwable $e) { + json_exception($e); + } + } +} diff --git a/application/controllers/Login.php b/application/controllers/Login.php index 65884558..5151d3df 100644 --- a/application/controllers/Login.php +++ b/application/controllers/Login.php @@ -28,6 +28,7 @@ class Login extends EA_Controller parent::__construct(); $this->load->library('accounts'); + $this->load->library('ldap_client'); $this->load->library('email_messages'); script_vars([ @@ -75,6 +76,10 @@ class Login extends EA_Controller $user_data = $this->accounts->check_login($username, $password); + if (empty($user_data)) { + $user_data = $this->ldap_client->check_login($username, $password); + } + if (empty($user_data)) { throw new InvalidArgumentException('Invalid credentials provided, please try again.'); } diff --git a/application/controllers/Providers.php b/application/controllers/Providers.php index b56766cc..b29c0257 100644 --- a/application/controllers/Providers.php +++ b/application/controllers/Providers.php @@ -35,6 +35,7 @@ class Providers extends EA_Controller 'timezone', 'language', 'is_private', + 'ldap_dn', 'id_roles', 'settings', 'services', @@ -52,6 +53,11 @@ class Providers extends EA_Controller 'services' => [], ]; + public array $optional_provider_setting_fields = [ + 'working_plan' => null, + 'working_plan_exceptions' => '{}', + ]; + /** * Providers constructor. */ @@ -66,6 +72,8 @@ class Providers extends EA_Controller $this->load->library('accounts'); $this->load->library('timezones'); $this->load->library('webhooks_client'); + + $this->optional_provider_setting_fields['working_plan'] = setting('company_working_plan'); } /** @@ -168,6 +176,8 @@ class Providers extends EA_Controller $this->providers_model->optional($provider, $this->optional_provider_fields); + $this->providers_model->optional($provider['settings'], $this->optional_provider_setting_fields); + $provider_id = $this->providers_model->save($provider); $provider = $this->providers_model->find($provider_id); @@ -221,6 +231,8 @@ class Providers extends EA_Controller $this->providers_model->optional($provider, $this->optional_provider_fields); + $this->providers_model->optional($provider['settings'], $this->optional_provider_setting_fields); + $provider_id = $this->providers_model->save($provider); $provider = $this->providers_model->find($provider_id); diff --git a/application/controllers/Secretaries.php b/application/controllers/Secretaries.php index e16da7c3..4b0b68eb 100644 --- a/application/controllers/Secretaries.php +++ b/application/controllers/Secretaries.php @@ -36,6 +36,7 @@ class Secretaries extends EA_Controller 'timezone', 'language', 'is_private', + 'ldap_dn', 'id_roles', 'settings', 'providers', diff --git a/application/core/EA_Controller.php b/application/core/EA_Controller.php index cec3966c..101bcc61 100644 --- a/application/core/EA_Controller.php +++ b/application/core/EA_Controller.php @@ -63,6 +63,7 @@ * @property Caldav_Sync $caldav_sync * @property Ics_file $ics_file * @property Instance $instance + * @property Ldap_client $ldap_client * @property Notifications $notifications * @property Permissions $permissions * @property Synchronization $synchronization diff --git a/application/language/arabic/translations_lang.php b/application/language/arabic/translations_lang.php index 10eb1084..e568290e 100755 --- a/application/language/arabic/translations_lang.php +++ b/application/language/arabic/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/bulgarian/translations_lang.php b/application/language/bulgarian/translations_lang.php index f95405f7..6334499f 100755 --- a/application/language/bulgarian/translations_lang.php +++ b/application/language/bulgarian/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/catalan/translations_lang.php b/application/language/catalan/translations_lang.php index 2e8dfe35..4a4518f0 100644 --- a/application/language/catalan/translations_lang.php +++ b/application/language/catalan/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/chinese/translations_lang.php b/application/language/chinese/translations_lang.php index 9f66723a..7ecdca3e 100755 --- a/application/language/chinese/translations_lang.php +++ b/application/language/chinese/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/croatian/translations_lang.php b/application/language/croatian/translations_lang.php index bcd91cf8..5e96596c 100644 --- a/application/language/croatian/translations_lang.php +++ b/application/language/croatian/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/czech/translations_lang.php b/application/language/czech/translations_lang.php index 6937c19b..c99e3b3e 100644 --- a/application/language/czech/translations_lang.php +++ b/application/language/czech/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/danish/translations_lang.php b/application/language/danish/translations_lang.php index 45a6fee4..9374e3c1 100755 --- a/application/language/danish/translations_lang.php +++ b/application/language/danish/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/dutch/translations_lang.php b/application/language/dutch/translations_lang.php index 5ce50877..c37422cf 100755 --- a/application/language/dutch/translations_lang.php +++ b/application/language/dutch/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/english/translations_lang.php b/application/language/english/translations_lang.php index d3e827ab..6465554c 100755 --- a/application/language/english/translations_lang.php +++ b/application/language/english/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/estonian/translations_lang.php b/application/language/estonian/translations_lang.php index ad535629..f904e1a2 100644 --- a/application/language/estonian/translations_lang.php +++ b/application/language/estonian/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/finnish/translations_lang.php b/application/language/finnish/translations_lang.php index 88e58dfc..618d08d4 100755 --- a/application/language/finnish/translations_lang.php +++ b/application/language/finnish/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/french/translations_lang.php b/application/language/french/translations_lang.php index 50131a44..dd6649a8 100755 --- a/application/language/french/translations_lang.php +++ b/application/language/french/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/german/translations_lang.php b/application/language/german/translations_lang.php index ca8f9894..2070ebdd 100755 --- a/application/language/german/translations_lang.php +++ b/application/language/german/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/greek/translations_lang.php b/application/language/greek/translations_lang.php index 7b185720..7991e0e2 100755 --- a/application/language/greek/translations_lang.php +++ b/application/language/greek/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/hebrew/translations_lang.php b/application/language/hebrew/translations_lang.php index 6443a4b5..0be16eae 100644 --- a/application/language/hebrew/translations_lang.php +++ b/application/language/hebrew/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/hindi/translations_lang.php b/application/language/hindi/translations_lang.php index 46b6bebd..d66dec22 100755 --- a/application/language/hindi/translations_lang.php +++ b/application/language/hindi/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/hungarian/translations_lang.php b/application/language/hungarian/translations_lang.php index dab5bb1f..18d649d9 100755 --- a/application/language/hungarian/translations_lang.php +++ b/application/language/hungarian/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/italian/translations_lang.php b/application/language/italian/translations_lang.php index 05027da7..d499471b 100755 --- a/application/language/italian/translations_lang.php +++ b/application/language/italian/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/japanese/translations_lang.php b/application/language/japanese/translations_lang.php index 38589f5f..e09e2aed 100755 --- a/application/language/japanese/translations_lang.php +++ b/application/language/japanese/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/luxembourgish/translations_lang.php b/application/language/luxembourgish/translations_lang.php index e0d3d77c..91f06032 100755 --- a/application/language/luxembourgish/translations_lang.php +++ b/application/language/luxembourgish/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/marathi/translations_lang.php b/application/language/marathi/translations_lang.php index ade2d8ef..46572605 100644 --- a/application/language/marathi/translations_lang.php +++ b/application/language/marathi/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/persian/translations_lang.php b/application/language/persian/translations_lang.php index 93525f4b..4f169fc9 100644 --- a/application/language/persian/translations_lang.php +++ b/application/language/persian/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/polish/translations_lang.php b/application/language/polish/translations_lang.php index 6e4706aa..2bea5a2b 100755 --- a/application/language/polish/translations_lang.php +++ b/application/language/polish/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/portuguese-br/translations_lang.php b/application/language/portuguese-br/translations_lang.php index b3851176..d8acb1da 100755 --- a/application/language/portuguese-br/translations_lang.php +++ b/application/language/portuguese-br/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/portuguese/translations_lang.php b/application/language/portuguese/translations_lang.php index 335e9b98..9fae3e9e 100755 --- a/application/language/portuguese/translations_lang.php +++ b/application/language/portuguese/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/romanian/translations_lang.php b/application/language/romanian/translations_lang.php index 6f787ad3..dde6b2cf 100755 --- a/application/language/romanian/translations_lang.php +++ b/application/language/romanian/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/russian/translations_lang.php b/application/language/russian/translations_lang.php index 0c238fad..91a6474b 100644 --- a/application/language/russian/translations_lang.php +++ b/application/language/russian/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/serbian/translations_lang.php b/application/language/serbian/translations_lang.php index 9815a851..70a89475 100644 --- a/application/language/serbian/translations_lang.php +++ b/application/language/serbian/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/slovak/translations_lang.php b/application/language/slovak/translations_lang.php index a268ab83..df7908ff 100755 --- a/application/language/slovak/translations_lang.php +++ b/application/language/slovak/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/spanish/translations_lang.php b/application/language/spanish/translations_lang.php index fc819e6f..180e23d2 100755 --- a/application/language/spanish/translations_lang.php +++ b/application/language/spanish/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/swedish/translations_lang.php b/application/language/swedish/translations_lang.php index e772dc11..4683d4f8 100644 --- a/application/language/swedish/translations_lang.php +++ b/application/language/swedish/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/thai/translations_lang.php b/application/language/thai/translations_lang.php index a8bd5efd..a5f559f3 100644 --- a/application/language/thai/translations_lang.php +++ b/application/language/thai/translations_lang.php @@ -461,4 +461,20 @@ $lang['default_timezone'] = 'Default Timezone'; $lang['default_timezone_hint'] = 'Set the default timezone value that will be used for new records.'; $lang['default_language'] = 'Default Language'; $lang['default_language_hint'] = 'Set the default language value that will be used for new records.'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/language/turkish/translations_lang.php b/application/language/turkish/translations_lang.php index 484c971c..1c3b9367 100755 --- a/application/language/turkish/translations_lang.php +++ b/application/language/turkish/translations_lang.php @@ -461,4 +461,20 @@ $lang['sync_method_prompt'] = 'Which sync method would you like to use?'; $lang['caldav_server'] = 'CalDAV Server'; $lang['caldav_connection_info_prompt'] = 'Please enter the connection information of the target CalDAV server.'; $lang['connect'] = 'Connect'; +$lang['ldap'] = 'LDAP'; +$lang['ldap_info'] = 'This integration enables you to connect to an existing LDAP server and automatically import users into Easy!Appointments and let them SSO with their directory password (username must match).'; +$lang['host'] = 'Host'; +$lang['port'] = 'Port'; +$lang['user_dn'] = 'User DN'; +$lang['base_dn'] = 'Base DN'; +$lang['keyword'] = 'Keyword'; +$lang['ldap_search_hint'] = 'Provide a keyword to search through the LDAP directory for users that match the filter criteria.'; +$lang['ldap_extension_not_loaded'] = 'The LDAP PHP extension is not loaded, but is required for this integration to work.'; +$lang['field_mapping'] = 'Field Mapping'; +$lang['content'] = 'Content'; +$lang['active'] = 'Active'; +$lang['user_imported'] = 'The user record was imported successfully.'; +$lang['import'] = 'Import'; +$lang['ldap_dn'] = 'LDAP DN'; +$lang['role'] = 'Role'; // End diff --git a/application/libraries/Accounts.php b/application/libraries/Accounts.php index f49c732d..acd8c157 100644 --- a/application/libraries/Accounts.php +++ b/application/libraries/Accounts.php @@ -161,4 +161,24 @@ class Accounts ->get() ->num_rows() > 0; } + + /** + * Get a user record based on the provided username value + * + * @param string $username + * + * @return array|null + */ + public function get_user_by_username(string $username): ?array + { + $user_settings = $this->CI->db->get_where('user_settings', ['username' => $username])->row_array(); + + if (!$user_settings) { + return null; + } + + $user_id = $user_settings['id_users']; + + return $this->CI->users_model->find($user_id); + } } diff --git a/application/libraries/Ldap_client.php b/application/libraries/Ldap_client.php new file mode 100644 index 00000000..29a28362 --- /dev/null +++ b/application/libraries/Ldap_client.php @@ -0,0 +1,236 @@ + + * @copyright Copyright (c) Alex Tselegidis + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org + * @since v1.4.0 + * ---------------------------------------------------------------------------- */ + +/** + * Ldap_client library. + * + * Handles LDAP related functionality. + * + * @package Libraries + */ +class Ldap_client +{ + /** + * @var EA_Controller|CI_Controller + */ + protected EA_Controller|CI_Controller $CI; + + /** + * Ldap_client constructor. + */ + public function __construct() + { + $this->CI = &get_instance(); + + $this->CI->load->model('roles_model'); + + $this->CI->load->library('timezones'); + $this->CI->load->library('accounts'); + } + + /** + * Validate the provided password with an LDAP hashed password. + * + * @param string $password + * @param string $hashed_password + * + * @return bool + */ + public function validate_password(string $password, string $hashed_password): bool + { + if (empty($hashed_password) || ($hashed_password[0] !== '{' && $password === $hashed_password)) { + return false; + } + + if (str_starts_with($hashed_password, '{MD5}')) { + $encrypted_password = '{MD5}' . base64_encode(md5($password, true)); + } elseif (str_starts_with($hashed_password, '{SHA1}')) { + $encrypted_password = '{SHA}' . base64_encode(sha1($password, true)); + } elseif (str_starts_with($hashed_password, '{SSHA}')) { + $salt = substr(base64_decode(substr($hashed_password, 6)), 20); + $encrypted_password = '{SSHA}' . base64_encode(sha1($password . $salt, true) . $salt); + } else { + throw new RuntimeException('Unsupported password hash format'); + } + + return $hashed_password === $encrypted_password; + } + + /** + * Try authenticating the user with LDAP + * + * @param string $username + * @param string $password + * + * @return array|null + * + * @throws Exception + */ + public function check_login(string $username, string $password): ?array + { + if (empty($username)) { + throw new InvalidArgumentException('No username value provided.'); + } + + // Check LDAP environment and configuration + + if (!extension_loaded('ldap')) { + throw new RuntimeException('The LDAP extension is not loaded.'); + } + + $ldap_is_active = setting('ldap_is_active'); + + if (!$ldap_is_active) { + return null; + } + + // Match user by username + + $user = $this->CI->accounts->get_user_by_username($username); + + if (empty($user['ldap_dn'])) { + return null; + } + + // Connect to LDAP server + + $host = setting('ldap_host'); + $port = (int) setting('ldap_port'); + $user_dn = setting('ldap_user_dn'); + $ldap_password = setting('ldap_password'); + + $connection = ldap_connect($host, $port); + + if (!$connection) { + throw new Exception('Could not connect to LDAP server: ' . ldap_error($connection)); + } + + ldap_set_option($connection, LDAP_OPT_PROTOCOL_VERSION, 3); + ldap_set_option($connection, LDAP_OPT_REFERRALS, 0); // We need this for doing an LDAP search. + + $bind = ldap_bind($connection, $user_dn, $ldap_password); + + if (!$bind) { + throw new Exception('LDAP bind failed: ' . ldap_error($connection)); + } + + // Check the provided password against the LDAP service + + $filter = '(objectclass=*)'; + + $result = ldap_search($connection, $user['ldap_dn'], $filter); + + if (!$result) { + return null; + } + + $ldap_entries = ldap_get_entries($connection, $result); + + foreach ($ldap_entries as $ldap_entry) { + if (!is_array($ldap_entry) || empty($ldap_entry['dn']) || $ldap_entry['dn'] !== $user['ldap_dn']) { + continue; + } + + if (!$this->validate_password($password, $ldap_entry['userpassword'][0])) { + continue; + } + + $role = $this->CI->roles_model->find($user['id_roles']); + + $default_timezone = $this->CI->timezones->get_default_timezone(); + + return [ + 'user_id' => $user['id'], + 'user_email' => $user['email'], + 'username' => $username, + 'timezone' => !empty($user['timezone']) ? $user['timezone'] : $default_timezone, + 'language' => !empty($user['language']) ? $user['language'] : Config::LANGUAGE, + 'role_slug' => $role['slug'], + ]; + } + + return null; + } + + /** + * Search the LDAP server based on the provided keyword and configuration. + * + * @param string $keyword + * + * @return array + * + * @throws Exception + */ + public function search(string $keyword): array + { + $host = setting('ldap_host'); + $port = (int) setting('ldap_port'); + $user_dn = setting('ldap_user_dn'); + $password = setting('ldap_password'); + $base_dn = setting('ldap_base_dn'); + $filter = setting('ldap_filter'); + + $connection = ldap_connect($host, $port); + + if (!$connection) { + throw new Exception('Could not connect to LDAP server: ' . ldap_error($connection)); + } + + ldap_set_option($connection, LDAP_OPT_PROTOCOL_VERSION, 3); + ldap_set_option($connection, LDAP_OPT_REFERRALS, 0); // We need this for doing an LDAP search. + + $bind = ldap_bind($connection, $user_dn, $password); + + if (!$bind) { + throw new Exception('LDAP bind failed: ' . ldap_error($connection)); + } + + $wildcard_keyword = !empty($keyword) ? '*' . $keyword . '*' : '*'; + + $interpolated_filter = str_replace('{{KEYWORD}}', $wildcard_keyword, $filter); + + $result = ldap_search($connection, $base_dn, $interpolated_filter); + + if (!$result) { + throw new Exception('Search failed: ' . ldap_error($connection)); + } + + $ldap_entries = ldap_get_entries($connection, $result); + + // Flatten the LDAP entries so that they become easier to import + + $entries = []; + + foreach ($ldap_entries as $ldap_entry) { + if (!is_array($ldap_entry)) { + continue; + } + + $entry = [ + 'dn' => $ldap_entry['dn'], + ]; + + foreach ($ldap_entry as $key => $value) { + if (!is_array($value)) { + continue; + } + + $entry[$key] = $value[0] ?? null; + } + + $entries[] = $entry; + } + + return $entries; + } +} diff --git a/application/migrations/057_add_ldap_rows_to_settings_table.php b/application/migrations/057_add_ldap_rows_to_settings_table.php new file mode 100644 index 00000000..5940161c --- /dev/null +++ b/application/migrations/057_add_ldap_rows_to_settings_table.php @@ -0,0 +1,102 @@ + + * @copyright Copyright (c) Alex Tselegidis + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org + * @since v1.3.2 + * ---------------------------------------------------------------------------- */ + +class Migration_Add_ldap_rows_to_settings_table extends EA_Migration +{ + /** + * Upgrade method. + */ + public function up() + { + $now = date('Y-m-d H:i:s'); + + $timestamps = [ + 'create_datetime' => $now, + 'update_datetime' => $now, + ]; + + if (!$this->db->get_where('settings', ['name' => 'ldap_is_active'])->num_rows()) { + $this->db->insert('settings', [...$timestamps, 'name' => 'ldap_is_active', 'value' => '0']); + } + + if (!$this->db->get_where('settings', ['name' => 'ldap_host'])->num_rows()) { + $this->db->insert('settings', [...$timestamps, 'name' => 'ldap_host', 'value' => '']); + } + + if (!$this->db->get_where('settings', ['name' => 'ldap_port'])->num_rows()) { + $this->db->insert('settings', [...$timestamps, 'name' => 'ldap_port', 'value' => '']); + } + + if (!$this->db->get_where('settings', ['name' => 'ldap_user_dn'])->num_rows()) { + $this->db->insert('settings', [...$timestamps, 'name' => 'ldap_user_dn', 'value' => '']); + } + + if (!$this->db->get_where('settings', ['name' => 'ldap_password'])->num_rows()) { + $this->db->insert('settings', [...$timestamps, 'name' => 'ldap_password', 'value' => '']); + } + + if (!$this->db->get_where('settings', ['name' => 'ldap_base_dn'])->num_rows()) { + $this->db->insert('settings', [...$timestamps, 'name' => 'ldap_base_dn', 'value' => '']); + } + + if (!$this->db->get_where('settings', ['name' => 'ldap_filter'])->num_rows()) { + $this->db->insert('settings', [...$timestamps, 'name' => 'ldap_filter', 'value' => LDAP_DEFAULT_FILTER]); + } + + if (!$this->db->get_where('settings', ['name' => 'ldap_field_mapping'])->num_rows()) { + $this->db->insert('settings', [ + ...$timestamps, + 'name' => 'ldap_field_mapping', + 'value' => json_encode(LDAP_DEFAULT_FIELD_MAPPING, JSON_PRETTY_PRINT), + ]); + } + } + + /** + * Downgrade method. + */ + public function down() + { + if ($this->db->get_where('settings', ['name' => 'ldap_is_active'])->num_rows()) { + $this->db->delete('settings', ['name' => 'ldap_is_active']); + } + + if ($this->db->get_where('settings', ['name' => 'ldap_host'])->num_rows()) { + $this->db->delete('settings', ['name' => 'ldap_host']); + } + + if ($this->db->get_where('settings', ['name' => 'ldap_port'])->num_rows()) { + $this->db->delete('settings', ['name' => 'ldap_port']); + } + + if ($this->db->get_where('settings', ['name' => 'ldap_user_dn'])->num_rows()) { + $this->db->delete('settings', ['name' => 'ldap_user_dn']); + } + + if ($this->db->get_where('settings', ['name' => 'ldap_password'])->num_rows()) { + $this->db->delete('settings', ['name' => 'ldap_password']); + } + + if ($this->db->get_where('settings', ['name' => 'ldap_base_dn'])->num_rows()) { + $this->db->delete('settings', ['name' => 'ldap_base_dn']); + } + + if ($this->db->get_where('settings', ['name' => 'ldap_filter'])->num_rows()) { + $this->db->delete('settings', ['name' => 'ldap_filter']); + } + + if ($this->db->get_where('settings', ['name' => 'ldap_field_mapping'])->num_rows()) { + $this->db->delete('settings', ['name' => 'ldap_field_mapping']); + } + } +} diff --git a/application/migrations/058_add_ldap_dn_column_to_users_table.php b/application/migrations/058_add_ldap_dn_column_to_users_table.php new file mode 100644 index 00000000..af2f59e7 --- /dev/null +++ b/application/migrations/058_add_ldap_dn_column_to_users_table.php @@ -0,0 +1,43 @@ + + * @copyright Copyright (c) Alex Tselegidis + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org + * @since v1.4.0 + * ---------------------------------------------------------------------------- */ + +class Migration_Add_ldap_dn_column_to_users_table extends EA_Migration +{ + /** + * Upgrade method. + */ + public function up() + { + if (!$this->db->field_exists('ldap_dn', 'users')) { + $fields = [ + 'ldap_dn' => [ + 'type' => 'TEXT', + 'null' => true, + 'after' => 'is_private', + ], + ]; + + $this->dbforge->add_column('users', $fields); + } + } + + /** + * Downgrade method. + */ + public function down() + { + if ($this->db->field_exists('ldap_dn', 'users')) { + $this->dbforge->drop_column('users', 'ldap_dn'); + } + } +} diff --git a/application/models/Admins_model.php b/application/models/Admins_model.php index 507d420d..17fe2ba2 100644 --- a/application/models/Admins_model.php +++ b/application/models/Admins_model.php @@ -45,6 +45,7 @@ class Admins_model extends EA_Model 'timezone' => 'timezone', 'language' => 'language', 'notes' => 'notes', + 'ldapDn' => 'ldap_dn', 'roleId' => 'id_roles', ]; @@ -556,6 +557,8 @@ class Admins_model extends EA_Model 'zip' => $admin['zip_code'], 'notes' => $admin['notes'], 'timezone' => $admin['timezone'], + 'language' => $admin['language'], + 'ldapDn' => $admin['ldap_dn'], 'settings' => [ 'username' => $admin['settings']['username'], 'notifications' => filter_var($admin['settings']['notifications'], FILTER_VALIDATE_BOOLEAN), @@ -624,6 +627,14 @@ class Admins_model extends EA_Model $decoded_resource['timezone'] = $admin['timezone']; } + if (array_key_exists('language', $admin)) { + $decoded_resource['language'] = $admin['language']; + } + + if (array_key_exists('ldapDn', $admin)) { + $decoded_resource['ldap_dn'] = $admin['ldapDn']; + } + if (array_key_exists('settings', $admin)) { if (empty($decoded_resource['settings'])) { $decoded_resource['settings'] = []; diff --git a/application/models/Customers_model.php b/application/models/Customers_model.php index c698fd41..d4d241ba 100644 --- a/application/models/Customers_model.php +++ b/application/models/Customers_model.php @@ -49,6 +49,7 @@ class Customers_model extends EA_Model 'customField4' => 'custom_field_4', 'customField5' => 'custom_field_5', 'notes' => 'notes', + 'ldapDn' => 'ldap_dn', ]; /** @@ -461,6 +462,7 @@ class Customers_model extends EA_Model 'customField3' => $customer['custom_field_3'], 'customField4' => $customer['custom_field_4'], 'customField5' => $customer['custom_field_5'], + 'ldapDn' => $customer['ldap_dn'], ]; $customer = $encoded_resource; @@ -532,6 +534,10 @@ class Customers_model extends EA_Model $decoded_resource['custom_field_5'] = $customer['customField5']; } + if (array_key_exists('ldapDn', $customer)) { + $decoded_resource['ldap_dn'] = $customer['ldapDn']; + } + if (array_key_exists('notes', $customer)) { $decoded_resource['notes'] = $customer['notes']; } diff --git a/application/models/Providers_model.php b/application/models/Providers_model.php index 218c8bbd..4a9eb1b1 100755 --- a/application/models/Providers_model.php +++ b/application/models/Providers_model.php @@ -47,6 +47,7 @@ class Providers_model extends EA_Model 'language' => 'language', 'notes' => 'notes', 'isPrivate' => 'is_private', + 'ldapDn' => 'ldap_dn', 'roleId' => 'id_roles', ]; @@ -749,6 +750,7 @@ class Providers_model extends EA_Model 'zip' => $provider['zip_code'], 'notes' => $provider['notes'], 'is_private' => $provider['is_private'], + 'ldapDn' => $provider['ldap_dn'], 'timezone' => $provider['timezone'], ]; @@ -869,6 +871,10 @@ class Providers_model extends EA_Model $decoded_resource['is_private'] = (bool) $provider['isPrivate']; } + if (array_key_exists('ldapDn', $provider)) { + $decoded_resource['ldap_dn'] = $provider['ldapDn']; + } + if (array_key_exists('settings', $provider)) { if (empty($decoded_resource['settings'])) { $decoded_resource['settings'] = []; diff --git a/application/models/Secretaries_model.php b/application/models/Secretaries_model.php index 6be14064..349099eb 100644 --- a/application/models/Secretaries_model.php +++ b/application/models/Secretaries_model.php @@ -45,6 +45,7 @@ class Secretaries_model extends EA_Model 'timezone' => 'timezone', 'language' => 'language', 'notes' => 'notes', + 'ldapDn' => 'ldap_dn', 'roleId' => 'id_roles', ]; @@ -601,6 +602,8 @@ class Secretaries_model extends EA_Model 'notes' => $secretary['notes'], 'providers' => $secretary['providers'], 'timezone' => $secretary['timezone'], + 'language' => $secretary['language'], + 'ldapDn' => $secretary['ldap_dn'], 'settings' => [ 'username' => $secretary['settings']['username'], 'notifications' => filter_var($secretary['settings']['notifications'], FILTER_VALIDATE_BOOLEAN), @@ -669,6 +672,14 @@ class Secretaries_model extends EA_Model $decoded_resource['timezone'] = $secretary['timezone']; } + if (array_key_exists('language', $secretary)) { + $decoded_resource['language'] = $secretary['language']; + } + + if (array_key_exists('ldapDn', $secretary)) { + $decoded_resource['ldap_dn'] = $secretary['ldapDn']; + } + if (array_key_exists('providers', $secretary)) { $decoded_resource['providers'] = $secretary['providers']; } diff --git a/application/models/Users_model.php b/application/models/Users_model.php index 1b071234..3606b662 100644 --- a/application/models/Users_model.php +++ b/application/models/Users_model.php @@ -44,6 +44,7 @@ class Users_model extends EA_Model 'zip' => 'zip_code', 'timezone' => 'timezone', 'language' => 'language', + 'ldapDn' => 'ldap_dn', 'notes' => 'notes', 'roleId' => 'id_roles', ]; @@ -125,7 +126,7 @@ class Users_model extends EA_Model $settings['salt'] = generate_salt(); $settings['password'] = hash_password($settings['salt'], $settings['password']); - $this->save_settings($user['id'], $settings); + $this->set_settings($user['id'], $settings); return $user['id']; } @@ -138,7 +139,7 @@ class Users_model extends EA_Model * * @throws InvalidArgumentException */ - protected function save_settings(int $user_id, array $settings): void + protected function set_settings(int $user_id, array $settings): void { if (empty($settings)) { throw new InvalidArgumentException('The settings argument cannot be empty.'); @@ -156,6 +157,22 @@ class Users_model extends EA_Model } } + /** + * Get the user settings. + * + * @param int $user_id User ID. + * + * @throws InvalidArgumentException + */ + public function get_settings(int $user_id): array + { + $settings = $this->db->get_where('user_settings', ['id_users' => $user_id])->row_array(); + + unset($settings['id_users'], $settings['password'], $settings['salt']); + + return $settings; + } + /** * Set the value of a user setting. * @@ -200,7 +217,7 @@ class Users_model extends EA_Model throw new RuntimeException('Could not update user.'); } - $this->save_settings($user['id'], $settings); + $this->set_settings($user['id'], $settings); return $user['id']; } @@ -236,9 +253,7 @@ class Users_model extends EA_Model $this->cast($user); - $user['settings'] = $this->db->get_where('user_settings', ['id_users' => $user_id])->row_array(); - - unset($user['settings']['id_users'], $user['settings']['password'], $user['settings']['salt']); + $user['settings'] = $this->get_settings($user['id']); return $user; } @@ -346,10 +361,7 @@ class Users_model extends EA_Model foreach ($users as &$user) { $this->cast($user); - - $user['settings'] = $this->db->get_where('user_settings', ['id_users' => $user['id']])->row_array(); - - unset($user['settings']['id_users'], $user['settings']['password'], $user['settings']['salt']); + $user['settings'] = $this->get_settings($user['id']); } return $users; @@ -383,10 +395,7 @@ class Users_model extends EA_Model foreach ($users as &$user) { $this->cast($user); - - $user['settings'] = $this->db->get_where('user_settings', ['id_users' => $user['id']])->row_array(); - - unset($user['settings']['id_users'], $user['settings']['password'], $user['settings']['salt']); + $user['settings'] = $this->get_settings($user['id']); } return $users; diff --git a/application/views/components/ldap_import_modal.php b/application/views/components/ldap_import_modal.php new file mode 100644 index 00000000..4468140e --- /dev/null +++ b/application/views/components/ldap_import_modal.php @@ -0,0 +1,105 @@ + + + + + + + + + diff --git a/application/views/pages/admins.php b/application/views/pages/admins.php index 42a475a4..6a77ff5f 100755 --- a/application/views/pages/admins.php +++ b/application/views/pages/admins.php @@ -208,6 +208,15 @@ ]); ?> + +
+ + +
+ +
+ +
+ + +
+ + true, ]); ?> diff --git a/application/views/pages/integrations.php b/application/views/pages/integrations.php index 9ac20abe..5ac5d5dc 100755 --- a/application/views/pages/integrations.php +++ b/application/views/pages/integrations.php @@ -111,6 +111,29 @@ +
+
+
+
+ +
+
+
+
+ + + +
+
+ +
+
+ diff --git a/application/views/pages/ldap_settings.php b/application/views/pages/ldap_settings.php new file mode 100644 index 00000000..2879ec22 --- /dev/null +++ b/application/views/pages/ldap_settings.php @@ -0,0 +1,165 @@ + + + + +
+
+
+ +
+
+
+
+
+

+ +

+ +
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
+ + +
+
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+
+ + +
+ +
+ +
+
+ + +
+ + +
+
+
+ + +
+
+ +
+

+ +

+
+ +

+ +

+ +
+ + +
+ + + +
+
+ +
+ +
+
+
+
+ + vars('roles'), +]); ?> + + + + + + + + + + + + + + diff --git a/application/views/pages/providers.php b/application/views/pages/providers.php index 9fd1faf7..54e5ff1b 100755 --- a/application/views/pages/providers.php +++ b/application/views/pages/providers.php @@ -230,6 +230,15 @@ ]); ?> + +
+ + +
+ +
+ +
+ + +
+ +