CAS integration. Done.

SVN:1.2.1[1920]
This commit is contained in:
Denis Flaven
2012-03-22 15:29:53 +00:00
parent ab1fc4b1b5
commit 42f355a592

View File

@@ -1258,12 +1258,17 @@ class CAS_SelfRegister implements iSelfRegister
if (array_key_exists(strtolower($aMatches[1]), $aAllProfiles)) if (array_key_exists(strtolower($aMatches[1]), $aAllProfiles))
{ {
$aProfiles[] = $aAllProfiles[strtolower($aMatches[1])]; $aProfiles[] = $aAllProfiles[strtolower($aMatches[1])];
phpCAS::log("Info: Adding the profile '{$aMatches[1]}' from CAS.");
} }
else else
{ {
phpCAS::log("Warning: {$aMatches[1]} is not a valid iTop profile (extracted from group name: '$sGroupName'). Ignored."); 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) if (count($aProfiles) == 0)
{ {
@@ -1277,6 +1282,7 @@ class CAS_SelfRegister implements iSelfRegister
if (array_key_exists(strtolower($sDefaultProfileName), $aAllProfiles)) if (array_key_exists(strtolower($sDefaultProfileName), $aAllProfiles))
{ {
$aProfiles[] = $aAllProfiles[strtolower($sDefaultProfileName)]; $aProfiles[] = $aAllProfiles[strtolower($sDefaultProfileName)];
phpCAS::log("Info: Adding the default profile '".$aAllProfiles[strtolower($sDefaultProfileName)]."' from CAS.");
} }
else else
{ {
@@ -1302,6 +1308,22 @@ class CAS_SelfRegister implements iSelfRegister
} }
$oUser->Set('profile_list', $oProfilesSet); $oUser->Set('profile_list', $oProfilesSet);
phpCAS::log("Info: the user '".$oUser->GetName()."' (id=".$oUser->GetKey().") now has the following profiles: '".implode("', '", $aProfiles)."'."); 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; return true;
} }
/** /**