From 7dc242a5c981395cbf16a7c3d0b44b842ea5f8b5 Mon Sep 17 00:00:00 2001 From: NicoDucou Date: Thu, 29 Aug 2024 21:50:21 +0200 Subject: [PATCH] Script: Cron: add authsource importation and also add a variable to configure the path to the csv files - refs BT#20351 --- tests/scripts/synchronize_user_base_from_csv.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/scripts/synchronize_user_base_from_csv.php b/tests/scripts/synchronize_user_base_from_csv.php index 980b1fb859..c5233b5324 100644 --- a/tests/scripts/synchronize_user_base_from_csv.php +++ b/tests/scripts/synchronize_user_base_from_csv.php @@ -22,6 +22,9 @@ exit; // Change this to the absolute path to chamilo root folder if you move the script out of tests/scripts $chamiloRoot = __DIR__.'/../../public'; +// Change this to the absolute path to the folder of the csv files (by default it is in the same folder as the script) +$CSVFilesPath = '.'; + // Set to true in order to get a trace of changes made by this script $debug = true; @@ -104,7 +107,7 @@ if ($firstAdmin) { $accessUrls = api_get_access_urls(0, 100000, 'id'); foreach ($accessUrls as $accessUrl) { $accessUrlId = $accessUrl['id']; - $filename = $chamiloRoot . "/../tests/scripts/url_" . $accessUrlId . "_synchroUsers.csv"; + $filename = $CSVFilesPath . "/url_" . $accessUrlId . "_synchroUsers.csv"; if (!file_exists($filename)) { if ($debug) { @@ -135,6 +138,7 @@ foreach ($accessUrls as $accessUrl) { 'active' => 'setActive', 'language' => 'setLocale', 'password' => 'setPlainPassword' + 'authsource' => 'setAuthSource' ]; // Create new user accounts found in the CSV and update the existing ones, re-enabling if necessary