2 require_once(
'./Services/AuthShibboleth/classes/Config/class.shibConfig.php');
3 require_once(
'./Services/User/classes/class.ilObjUser.php');
35 $shibUser =
new self();
37 $ext_id = $shibUser->shibServerData->getLogin();
38 $shibUser->setExternalAccount($ext_id);
39 $existing_usr_id = self::getUsrIdByExtId($ext_id);
40 if ($existing_usr_id) {
41 $shibUser->setId($existing_usr_id);
44 $shibUser->setAuthMode(
'shibboleth');
52 if ($shibConfig->getUpdateFirstname()) {
55 if ($shibConfig->getUpdateLastname()) {
58 if ($shibConfig->getUpdateGender()) {
61 if ($shibConfig->getUpdateTitle()) {
64 if ($shibConfig->getUpdateInstitution()) {
67 if ($shibConfig->getUpdateDepartment()) {
70 if ($shibConfig->getUpdateStreet()) {
73 if ($shibConfig->getUpdateZipcode()) {
76 if ($shibConfig->getUpdateCountry()) {
79 if ($shibConfig->getUpdatePhoneOffice()) {
82 if ($shibConfig->getUpdatePhoneHome()) {
85 if ($shibConfig->getUpdatePhoneMobile()) {
88 if ($shibConfig->getUpdateFax()) {
91 if ($shibConfig->getUpdateMatriculation()) {
94 if ($shibConfig->getUpdateEmail()) {
97 if ($shibConfig->getUpdateHobby()) {
100 if ($shibConfig->getUpdateLanguage()) {
154 while (self::loginExists(
$login, $this->
getId())) {
155 $login = $login_tmp . $appendix;
167 return (
bool)($this->
getId() == 0);
194 return strtolower(strtr($name, $upas));
204 private static function loginExists(
$login, $usr_id) {
209 $query =
'SELECT usr_id FROM usr_data WHERE login = ' . $ilDB->quote(
$login,
'text');
210 $query .=
' AND usr_id != ' . $ilDB->quote($usr_id,
'integer');
212 return (
bool)($ilDB->numRows($ilDB->query(
$query)) > 0);
221 protected static function getUsrIdByExtId($ext_id) {
226 $query =
'SELECT usr_id FROM usr_data WHERE ext_account = ' . $ilDB->quote($ext_id,
'text');
227 $a_set = $ilDB->query(
$query);
228 if ($ilDB->numRows($a_set) == 0) {
231 $usr = $ilDB->fetchObject($a_set);