From 42f355a5925b186e0b3f3249f55f10c3546e73db Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Thu, 22 Mar 2012 15:29:53 +0000 Subject: [PATCH] CAS integration. Done. SVN:1.2.1[1920] --- core/userrights.class.inc.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/core/userrights.class.inc.php b/core/userrights.class.inc.php index 3e80ea0173..fa21502549 100644 --- a/core/userrights.class.inc.php +++ b/core/userrights.class.inc.php @@ -1258,12 +1258,17 @@ class CAS_SelfRegister implements iSelfRegister if (array_key_exists(strtolower($aMatches[1]), $aAllProfiles)) { $aProfiles[] = $aAllProfiles[strtolower($aMatches[1])]; + phpCAS::log("Info: Adding the profile '{$aMatches[1]}' from CAS."); } else { phpCAS::log("Warning: {$aMatches[1]} is not a valid iTop profile (extracted from group name: '$sGroupName'). Ignored."); } } + else + { + phpCAS::log("Info: The CAS group '$sGroupName' does not seem to match an iTop pattern. Ignored."); + } } if (count($aProfiles) == 0) { @@ -1277,6 +1282,7 @@ class CAS_SelfRegister implements iSelfRegister if (array_key_exists(strtolower($sDefaultProfileName), $aAllProfiles)) { $aProfiles[] = $aAllProfiles[strtolower($sDefaultProfileName)]; + phpCAS::log("Info: Adding the default profile '".$aAllProfiles[strtolower($sDefaultProfileName)]."' from CAS."); } else { @@ -1302,6 +1308,22 @@ class CAS_SelfRegister implements iSelfRegister } $oUser->Set('profile_list', $oProfilesSet); phpCAS::log("Info: the user '".$oUser->GetName()."' (id=".$oUser->GetKey().") now has the following profiles: '".implode("', '", $aProfiles)."'."); + if ($oUser->IsModified()) + { + $oMyChange = MetaModel::NewObject("CMDBChange"); + $oMyChange->Set("date", time()); + $oMyChange->Set("userinfo", 'CAS/LDAP Synchro'); + $oMyChange->DBInsert(); + if ($oUser->IsNew()) + { + $oUser->DBInsertTracked($oMyChange); + } + else + { + $oUser->DBUpdateTracked($oMyChange); + } + } + return true; } /**