summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2011-01-10 13:55:04 (GMT)
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2011-01-10 13:55:04 (GMT)
commit90aba1cedab880e4c30d7e044ae59d8c4d9966fe (patch)
tree26358a06174d1dfc9c53792bfe6c56d19d1d8ee1
parent137cb0e6c1e58bb1a6fff0847a9e11a7abdeff2b (diff)
downloadsamlauth-elgg-90aba1cedab880e4c30d7e044ae59d8c4d9966fe.zip
samlauth-elgg-90aba1cedab880e4c30d7e044ae59d8c4d9966fe.tar.gz
samlauth-elgg-90aba1cedab880e4c30d7e044ae59d8c4d9966fe.tar.bz2
Complete user attributes provisionning
-rw-r--r--start.php29
1 files changed, 27 insertions, 2 deletions
diff --git a/start.php b/start.php
index 1cc9251..26b309c 100644
--- a/start.php
+++ b/start.php
@@ -50,9 +50,8 @@
$user = get_user_by_username($elgg_user['username']);
$user->ldapDN = $elgg_user['ldapDN'];
}
- else
- saml_sync_user($user, $elgg_user);
if ($user) {
+ saml_sync_user($user, $elgg_user);
$result = login($user);
$_SESSION['saml_user'] = TRUE;
return $result;
@@ -85,6 +84,23 @@
$user->name = $elgg_user['name'];
$user->email = $elgg_user['email'];
$user->ldapDN = $elgg_user['ldapDN'];
+ $user->birthday = $elgg_user['birthday'];
+ $user->ircem = $elgg_user['ircem'];
+ $user->urssaf = $elgg_user['urssaf'];
+ $user->address = $elgg_user['address'];
+ $user->zipcode = $elgg_user['zipcode'];
+ $user->city = $elgg_user['city'];
+ $user->location = array($user->city, 'France');
+ $user->mobile = $elgg_user['mobile'];
+ $user->landline = $elgg_user['landline'];
+ remove_entity_relationships($user->guid, 'user2usertype');
+ foreach ($elgg_user['usertype'] as $usertype) {
+ $usertype = get_entities_by_title($usertype, 'object', 'usertype');
+ $usertype = $usertype[0];
+ if (!check_entity_relationship($user->guid, 'user2usertype', $usertype->guid)) {
+ add_entity_relationship($user->guid, 'user2usertype', $usertype->guid);
+ }
+ }
$user->save();
}
@@ -131,6 +147,15 @@
else
$elgg_user['name'] = $elgg_user['username'];
$elgg_user['email'] = $attributes[$config->email][0];
+ $elgg_user['usertype'] = $attributes['userClass'];
+ $elgg_user['ircem'] = $attributes['numeroIRCEM'][0];
+ $elgg_user['urssaf'] = $attributes['numeroURSSAF'][0];
+ $elgg_user['birthday'] = $attributes['dateOfBirth'][0];
+ $elgg_user['address'] = $attributes['homeStreetAddress'][0];
+ $elgg_user['zipcode'] = $attributes['homePostalCode'][0];
+ $elgg_user['city'] = $attributes['homeLocalityName'][0];
+ $elgg_user['mobile'] = $attributes['mobile'][0];
+ $elgg_user['landline'] = $attributes['telephoneNumber'][0];
return $elgg_user;
}