Ejemplo n.º 1
0
 /**
  * Login function
  *
  * @access private
  * @return void
  */
 public function login()
 {
     $shibServerData = shibServerData::getInstance($_SERVER);
     if ($shibServerData->getLogin()) {
         $shibUser = shibUser::getInstance($shibServerData);
         if ($shibUser->isNew()) {
             $shibUser->createFields();
             $shibUser = ilShibbolethPluginWrapper::getInstance()->beforeCreateUser($shibUser);
             $shibUser->create();
             $shibUser->updateOwner();
             $shibUser->saveAsNew();
             $shibUser = ilShibbolethPluginWrapper::getInstance()->afterCreateUser($shibUser);
             ilShibbolethRoleAssignmentRules::doAssignments($shibUser->getId(), $_SERVER);
         } else {
             $shibUser->updateFields();
             $shibUser->update();
             $shibUser = ilShibbolethPluginWrapper::getInstance()->beforeUpdateUser($shibUser);
             $shibUser->update();
             $shibUser = ilShibbolethPluginWrapper::getInstance()->afterUpdateUser($shibUser);
             ilShibbolethRoleAssignmentRules::updateAssignments($shibUser->getId(), $_SERVER);
         }
         $this->setAuth($shibUser->getLogin(), $shibUser);
         ilObjUser::_updateLastLogin($shibUser->getId());
         if ($_GET['target'] != '') {
             ilUtil::redirect('goto.php?target=' . $_GET['target'] . '&client_id=' . CLIENT_ID);
         }
     } else {
         $this->status = AUTH_WRONG_LOGIN;
     }
 }
Ejemplo n.º 2
0
 public function createFields()
 {
     $this->setFirstname($this->shibServerData->getFirstname());
     $this->setLastname($this->shibServerData->getLastname());
     $this->setLogin($this->returnNewLoginName());
     $this->setPasswd(md5(end(ilUtil::generatePasswords(1))), IL_PASSWD_CRYPTED);
     $this->setGender($this->shibServerData->getGender());
     $this->setExternalAccount($this->shibServerData->getLogin());
     $this->setTitle($this->shibServerData->getTitle());
     $this->setInstitution($this->shibServerData->getInstitution());
     $this->setDepartment($this->shibServerData->getDepartment());
     $this->setStreet($this->shibServerData->getStreet());
     $this->setZipcode($this->shibServerData->getZipcode());
     $this->setCountry($this->shibServerData->getCountry());
     $this->setPhoneOffice($this->shibServerData->getPhoneOffice());
     $this->setPhoneHome($this->shibServerData->getPhoneHome());
     $this->setPhoneMobile($this->shibServerData->getPhoneMobile());
     $this->setFax($this->shibServerData->getFax());
     $this->setMatriculation($this->shibServerData->getMatriculation());
     $this->setEmail($this->shibServerData->getEmail());
     $this->setHobby($this->shibServerData->getHobby());
     $this->setTitle($this->getFullname());
     $this->setDescription($this->getEmail());
     $this->setLanguage($this->shibServerData->getLanguage());
     $this->setTimeLimitOwner(7);
     $this->setTimeLimitUnlimited(1);
     $this->setTimeLimitFrom(time());
     $this->setTimeLimitUntil(time());
     $this->setActive(true);
 }
Ejemplo n.º 3
0
 /**
  * @param array $data
  *
  * @return shibServerData
  */
 public static function getInstance(array $data)
 {
     if (!isset(self::$cache)) {
         self::$cache = new self($data);
     }
     return self::$cache;
 }
Ejemplo n.º 4
0
 /**
  * Login function
  *
  * @access private
  * @return void
  */
 public function login()
 {
     global $ilias, $ilSetting;
     // for backword compatibility of hook environment variables
     $shibServerData = shibServerData::getInstance($_SERVER);
     if ($shibServerData->getLogin()) {
         $shibUser = shibUser::buildInstance($shibServerData);
         // for backword compatibility of hook environment variables
         $userObj =& $shibUser;
         // For shib_data_conv included Script
         $newUser = $shibUser->isNew();
         // For shib_data_conv included Script
         if ($shibUser->isNew()) {
             $shibUser->createFields();
             $shibUser->setPref('hits_per_page', $ilSetting->get('hits_per_page'));
             // Modify user data before creating the user
             // Include custom code that can be used to further modify
             // certain Shibboleth user attributes
             if ($ilias->getSetting('shib_data_conv') and $ilias->getSetting('shib_data_conv') != '' and is_readable($ilias->getSetting('shib_data_conv'))) {
                 include $ilias->getSetting('shib_data_conv');
             }
             $shibUser = ilShibbolethPluginWrapper::getInstance()->beforeCreateUser($shibUser);
             $shibUser->create();
             $shibUser->updateOwner();
             $shibUser->saveAsNew();
             $shibUser->writePrefs();
             $shibUser = ilShibbolethPluginWrapper::getInstance()->afterCreateUser($shibUser);
             ilShibbolethRoleAssignmentRules::doAssignments($shibUser->getId(), $_SERVER);
         } else {
             $shibUser->updateFields();
             // Include custom code that can be used to further modify
             // certain Shibboleth user attributes
             if ($ilias->getSetting('shib_data_conv') and $ilias->getSetting('shib_data_conv') != '' and is_readable($ilias->getSetting('shib_data_conv'))) {
                 include $ilias->getSetting('shib_data_conv');
             }
             //				$shibUser->update();
             $shibUser = ilShibbolethPluginWrapper::getInstance()->beforeUpdateUser($shibUser);
             $shibUser->update();
             $shibUser = ilShibbolethPluginWrapper::getInstance()->afterUpdateUser($shibUser);
             ilShibbolethRoleAssignmentRules::updateAssignments($shibUser->getId(), $_SERVER);
         }
         $this->setAuth($shibUser->getLogin(), $shibUser);
         ilObjUser::_updateLastLogin($shibUser->getId());
         if ($_GET['target'] != '') {
             ilUtil::redirect('goto.php?target=' . $_GET['target'] . '&client_id=' . CLIENT_ID);
         }
     } else {
         $this->status = AUTH_WRONG_LOGIN;
     }
 }