From ea950ef625218dedca1937f0cb486f0190e14278 Mon Sep 17 00:00:00 2001
From: "renater.salaun" <renater.salaun@047e039d-479c-447e-8a29-aa6bf4a09bab>
Date: Fri, 31 Oct 2014 15:08:14 +0000
Subject: [PATCH] Add account profiles

git-svn-id: https://svn.geant.net/GEANT/edugain_testidp_account_manager/trunk@65 047e039d-479c-447e-8a29-aa6bf4a09bab
---
 conf/default-Conf.pm                         |  2 +-
 templates/accountProfiles/alumni1.tt2        | 16 ++++++++++++++++
 templates/accountProfiles/employee1.tt2      | 16 ++++++++++++++++
 templates/accountProfiles/librarywalkin1.tt2 | 17 +++++++++++++++++
 templates/accountProfiles/researcher1.tt2    | 17 +++++++++++++++++
 templates/accountProfiles/teacher1.tt2       |  2 +-
 6 files changed, 68 insertions(+), 2 deletions(-)
 create mode 100644 templates/accountProfiles/alumni1.tt2
 create mode 100644 templates/accountProfiles/employee1.tt2
 create mode 100644 templates/accountProfiles/librarywalkin1.tt2
 create mode 100644 templates/accountProfiles/researcher1.tt2

diff --git a/conf/default-Conf.pm b/conf/default-Conf.pm
index c5d5415..08640a8 100644
--- a/conf/default-Conf.pm
+++ b/conf/default-Conf.pm
@@ -81,7 +81,7 @@ our %global = (
     'federation_metadata_file_path' => '/opt/testidp/IdPAccountManager/conf/edugain-md.xml',
     
     ## valid account profiles
-    'account_profiles' => ['student1','teacher1'],
+    'account_profiles' => ['student1','teacher1','alumni1','librarywalkin1','employee1','researcher1'],
 );
     
 1; # Magic true value required at end of module
diff --git a/templates/accountProfiles/alumni1.tt2 b/templates/accountProfiles/alumni1.tt2
new file mode 100644
index 0000000..5e38fbc
--- /dev/null
+++ b/templates/accountProfiles/alumni1.tt2
@@ -0,0 +1,16 @@
+[% account_sp_entityid = account.get('sp_entityid') %]
+[% account_id = account.get('id') %]
+
+[% SET account_profile = {
+  	'uid' => "${account_id}",
+	'eduPersonAffiliation' => ['alum'],
+	'eduPersonScopedAffiliation' => ["alum@${conf.idp_scope}"],
+        'displayName' => 'Ruby Anderson',
+        'cn' => 'Ruby Anderson',
+        'mail' => "ruby.anderson@${conf.idp_scope}",
+        'eduPersonPrincipalName' =>"${account_id}@${conf.idp_scope}",
+        'eduPersonTargetedID' =>"${conf.idp_entityid}!${account_sp_entityid}!X622UR2A7PG1uVhATobBOrMz+Ys=",
+        'schacHomeOrganization' => "${conf.idp_scope}",
+        'schacHomeOrganizationType' => 'urn:schac:homeOrganizationType:int:university',
+} %]
+
diff --git a/templates/accountProfiles/employee1.tt2 b/templates/accountProfiles/employee1.tt2
new file mode 100644
index 0000000..5acc0c0
--- /dev/null
+++ b/templates/accountProfiles/employee1.tt2
@@ -0,0 +1,16 @@
+[% account_sp_entityid = account.get('sp_entityid') %]
+[% account_id = account.get('id') %]
+
+[% SET account_profile = {
+  	'uid' => "${account_id}",
+	'eduPersonAffiliation' => ['member','staff','employee'],
+	'eduPersonScopedAffiliation' => ["member@${conf.idp_scope}","staff@${conf.idp_scope}","employee@${conf.idp_scope}"],
+        'displayName' => 'Morgan Hsu',
+        'cn' => 'Morgan Hsu',
+        'mail' => "morgan.hsu@${conf.idp_scope}",
+        'eduPersonPrincipalName' =>"${account_id}@${conf.idp_scope}",
+        'eduPersonTargetedID' =>"${conf.idp_entityid}!${account_sp_entityid}!X622UR2A7PG1uVhATobBOrMz+Ys=",
+        'schacHomeOrganization' => "${conf.idp_scope}",
+        'schacHomeOrganizationType' => 'urn:schac:homeOrganizationType:int:university',
+} %]
+
diff --git a/templates/accountProfiles/librarywalkin1.tt2 b/templates/accountProfiles/librarywalkin1.tt2
new file mode 100644
index 0000000..4141d52
--- /dev/null
+++ b/templates/accountProfiles/librarywalkin1.tt2
@@ -0,0 +1,17 @@
+[% account_sp_entityid = account.get('sp_entityid') %]
+[% account_id = account.get('id') %]
+
+[% SET account_profile = {
+  	'uid' => "${account_id}",
+	'eduPersonAffiliation' => ['library-walk-in'],
+	'eduPersonScopedAffiliation' => ["library-walk-in@${conf.idp_scope}"],
+        'displayName' => 'Dorian Segura',
+        'cn' => 'Dorian Segura',
+        'mail' => "dorian.segora@${conf.idp_scope}",
+        'eduPersonPrincipalName' =>"${account_id}@${conf.idp_scope}",
+        'eduPersonTargetedID' =>"${conf.idp_entityid}!${account_sp_entityid}!X622UR2A7PG1uVhATobBOrMz+Ys=",
+        'schacHomeOrganization' => "${conf.idp_scope}",
+        'schacHomeOrganizationType' => 'urn:schac:homeOrganizationType:int:university',
+	'eduPersonEntitlement' => 'urn:mace:dir:entitlement:common-lib-terms',
+} %]
+
diff --git a/templates/accountProfiles/researcher1.tt2 b/templates/accountProfiles/researcher1.tt2
new file mode 100644
index 0000000..651a300
--- /dev/null
+++ b/templates/accountProfiles/researcher1.tt2
@@ -0,0 +1,17 @@
+[% account_sp_entityid = account.get('sp_entityid') %]
+[% account_id = account.get('id') %]
+
+[% SET account_profile = {
+  	'uid' => "${account_id}",
+	'eduPersonAffiliation' => ['member', 'faculty'],
+	'eduPersonScopedAffiliation' => ["member@${conf.idp_scope}", "faculty@${conf.idp_scope}"],
+        'displayName' => 'Jean Valjean',
+        'cn' => 'Jean Valjean',
+        'mail' => "peter.smithjean.valjean@${conf.idp_scope}",
+        'eduPersonPrincipalName' =>"${account_id}@${conf.idp_scope}",
+        'eduPersonTargetedID' =>"${conf.idp_entityid}!${account_sp_entityid}!X622UR2A7PG1uVhATobBOrMz+Ys=",
+        'schacHomeOrganization' => "${conf.idp_scope}",
+        'schacHomeOrganizationType' => 'urn:schac:homeOrganizationType:int:public-research-institution',
+} %]
+
+
diff --git a/templates/accountProfiles/teacher1.tt2 b/templates/accountProfiles/teacher1.tt2
index 56a3977..5f7ab5b 100644
--- a/templates/accountProfiles/teacher1.tt2
+++ b/templates/accountProfiles/teacher1.tt2
@@ -4,7 +4,7 @@
 [% SET account_profile = {
   	'uid' => "${account_id}",
 	'eduPersonAffiliation' => ['member', 'faculty'],
-	'eduPersonScopedAffiliation' => ["member@${conf.idp_scope}", "student@${conf.idp_scope}"],
+	'eduPersonScopedAffiliation' => ["member@${conf.idp_scope}", "faculty@${conf.idp_scope}"],
         'displayName' => 'Peter Smith',
         'cn' => 'Peter Smith',
         'mail' => "peter.smith@${conf.idp_scope}",
-- 
GitLab