From 091397df1439f695eae070367ed5fc7be87c2c62 Mon Sep 17 00:00:00 2001
From: Guillaume Rousse <guillaume.rousse@renater.fr>
Date: Mon, 6 Nov 2017 13:05:15 +0100
Subject: [PATCH] replace root_manager_dir configuration directive with
 templates_dir

---
 conf/IdPAccountManager.conf         | 4 ++--
 lib/IdPAccountManager/Tools.pm      | 5 ++---
 lib/IdPAccountManager/WebRequest.pm | 6 ++----
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/conf/IdPAccountManager.conf b/conf/IdPAccountManager.conf
index 8ed6bb6..ba6538f 100644
--- a/conf/IdPAccountManager.conf
+++ b/conf/IdPAccountManager.conf
@@ -25,8 +25,8 @@ idp_displayname = eduGAIN Access Check
 # Root simpleSamlPhp directory
 root_ssp_dir = /opt/testidp/simplesamlphp
 
-# Root test account manager directory
-root_manager_dir = /opt/testidp/IdPAccountManager
+# Templates directory
+templates_dir = templates
 
 # Database type refers to a Perl Database Driver name
 # However only a subset of existing DBDs are supported by Rose::DB::Object:
diff --git a/lib/IdPAccountManager/Tools.pm b/lib/IdPAccountManager/Tools.pm
index 4af9e28..03bcbde 100644
--- a/lib/IdPAccountManager/Tools.pm
+++ b/lib/IdPAccountManager/Tools.pm
@@ -77,11 +77,10 @@ sub generate_password {
 
 ## Updates simpleSamlPhp authsources.php configuration file
 sub update_ssp_authsources {
-    my ($root_manager_dir, $conf) = @_;
+    my ($templates_dir, $conf) = @_;
 
     my $tt2 = Template->new({
-        INCLUDE_PATH => $root_manager_dir . ':' .
-                        $root_manager_dir . '/templates/accountProfiles'
+        INCLUDE_PATH => $templates_dir
     });
     my %args = (
         accounts => IdPAccountManager::TestAccount::Data::Manager->get_testaccounts(),
diff --git a/lib/IdPAccountManager/WebRequest.pm b/lib/IdPAccountManager/WebRequest.pm
index ca25f1e..c6f3041 100755
--- a/lib/IdPAccountManager/WebRequest.pm
+++ b/lib/IdPAccountManager/WebRequest.pm
@@ -168,9 +168,7 @@ sub respond {
                 escape_quotes =>
                   [ \&IdPAccountManager::Tools::escape_quotes, 0 ]
             },
-            INCLUDE_PATH => $self->{configuration}->{root_manager_dir} . ':'
-              . $self->{configuration}->{root_manager_dir}
-              . '/templates/accountProfiles',
+            INCLUDE_PATH => $self->{configuration}->{templates_dir}
         }
     );
 
@@ -581,7 +579,7 @@ sub req_validate_token {
 
     ## Update simpleSAMLphp configuration to enable test accounts
     unless (IdPAccountManager::Tools::update_ssp_authsources(
-            $self->{configuration}->{root_manager_dir},
+            $self->{configuration}->{templates_dir},
             $self->{configuration}
         )) {
         push @{ $self->{out}->{errors} }, "accounts_creation_failed";
-- 
GitLab