ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilAuthContainerECS Class Reference

Custom PEAR Auth Container for ECS auth checks. More...

+ Inheritance diagram for ilAuthContainerECS:
+ Collaboration diagram for ilAuthContainerECS:

Public Member Functions

 __construct ($a_params=array())
 Constructor.
 getAbreviation ()
 get abbreviation
 getMID ()
 get mid
 fetchData ($a_username, $a_pass)
 fetch data
 loginObserver ($a_username, $a_auth)
 Called from base class after successful login.
 failedLoginObserver ()
 Called from base class after failed login.
- Public Member Functions inherited from Auth_Container
 Auth_Container ()
 Constructor.
 fetchData ($username, $password, $isChallengeResponse=false)
 Fetch data from storage container.
 verifyPassword ($password1, $password2, $cryptType="md5")
 Crypt and verfiy the entered password.
 supportsChallengeResponse ()
 Returns true if the container supports Challenge Response password authentication.
 getCryptType ()
 Returns the crypt current crypt type of the container.
 listUsers ()
 List all users that are available from the storage container.
 getUser ($username)
 Returns a user assoc array.
 addUser ($username, $password, $additional=null)
 Add a new user to the storage container.
 removeUser ($username)
 Remove user from the storage container.
 changePassword ($username, $password)
 Change password for user in the storage container.
 log ($message, $level=AUTH_LOG_DEBUG)
 Log a message to the Auth log.
- Public Member Functions inherited from ilAuthContainerBase
 failedLoginObserver ($a_username, $a_auth)
 Called after failed login.
 checkAuthObserver ($a_username, $a_auth)
 Called after check auth requests.
 logoutObserver ($a_username, $a_auth)
 Called after logout.

Protected Member Functions

 createUser (ilECSUser $user)
 create new user
 updateUser (ilECSUser $user, $a_local_user_id)
 update existing user

Protected Attributes

 $mid = null
 $abreviation = null
 $log

Private Member Functions

 initSettings ()
 init ecs settings
 initECSServices ()
 Init ECS Services private.
 sendNotification ($user_obj)
 Send notification.

Additional Inherited Members

- Data Fields inherited from Auth_Container
 $activeUser = ""
 User that is currently selected from the storage container.
 $_auth_obj = null
 The Auth object this container is attached to.

Detailed Description

Custom PEAR Auth Container for ECS auth checks.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 34 of file class.ilAuthContainerECS.php.

Constructor & Destructor Documentation

ilAuthContainerECS::__construct (   $a_params = array())

Constructor.

public

Parameters

Definition at line 48 of file class.ilAuthContainerECS.php.

References $GLOBALS, initECSServices(), and Auth_Container\log().

{
parent::__construct($a_params);
$this->initECSServices();
$this->log = $GLOBALS['ilLog'];
}

+ Here is the call graph for this function:

Member Function Documentation

ilAuthContainerECS::createUser ( ilECSUser  $user)
protected

create new user

protected

Definition at line 169 of file class.ilAuthContainerECS.php.

References $ilLog, $ilSetting, ilAuthUtils\_generateLogin(), ilObject\_writeImportId(), getAbreviation(), ilECSUser\getEmail(), ilECSUser\getFirstname(), ilECSUser\getImportId(), ilECSUser\getInstitution(), ilECSUser\getLastname(), ilECSUser\getLogin(), IL_PASSWD_MD5, and initSettings().

Referenced by loginObserver().

{
global $ilClientIniFile,$ilSetting,$rbacadmin,$ilLog;
$userObj = new ilObjUser();
include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
$local_user = ilAuthUtils::_generateLogin($this->getAbreviation().'_'.$user->getLogin());
$newUser["login"] = $local_user;
$newUser["firstname"] = $user->getFirstname();
$newUser["lastname"] = $user->getLastname();
$newUser['email'] = $user->getEmail();
$newUser['institution'] = $user->getInstitution();
// set "plain md5" password (= no valid password)
$newUser["passwd"] = "";
$newUser["passwd_type"] = IL_PASSWD_MD5;
$newUser["auth_mode"] = "ecs";
$newUser["profile_incomplete"] = 0;
// system data
$userObj->assignData($newUser);
$userObj->setTitle($userObj->getFullname());
$userObj->setDescription($userObj->getEmail());
// set user language to system language
$userObj->setLanguage($ilSetting->get("language"));
// Time limit
$userObj->setTimeLimitOwner(7);
$userObj->setTimeLimitUnlimited(0);
$userObj->setTimeLimitFrom(time());
$userObj->setTimeLimitUntil(time() + $ilClientIniFile->readVariable("session","expire"));
// Create user in DB
$userObj->setOwner(6);
$userObj->create();
$userObj->setActive(1);
$userObj->updateOwner();
$userObj->saveAsNew();
$userObj->writePrefs();
$this->initSettings();
if($global_role = $this->settings->getGlobalRole())
{
$rbacadmin->assignUser($this->settings->getGlobalRole(),$userObj->getId(),true);
}
ilObject::_writeImportId($userObj->getId(),$user->getImportId());
$ilLog->write(__METHOD__.': Created new remote user with usr_id: '.$user->getImportId());
// Send Mail
#$this->sendNotification($userObj);
return $userObj->getLogin();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAuthContainerECS::failedLoginObserver ( )

Called from base class after failed login.

Parameters
stringusername

Definition at line 156 of file class.ilAuthContainerECS.php.

References Auth_Container\log().

{
$this->log->write(__METHOD__.': Login failed');
return false;
}

+ Here is the call graph for this function:

ilAuthContainerECS::fetchData (   $a_username,
  $a_pass 
)

fetch data

public

Parameters
stringusername
stringpass

Definition at line 87 of file class.ilAuthContainerECS.php.

References $_GET, $ilLog, and $res.

{
global $ilLog;
$ilLog->write(__METHOD__.': Starting ECS authentication.');
if(!$this->settings->isEnabled())
{
$ilLog->write(__METHOD__.': ECS settings .');
return false;
}
// Check if hash is valid ...
include_once('./Services/WebServices/ECS/classes/class.ilECSConnector.php');
try
{
$connector = new ilECSConnector();
$res = $connector->getAuth($_GET['ecs_hash']);
$auths = $res->getResult();
$this->mid = $auths[0]->mid;
$ilLog->write(__METHOD__.': Got mid: '.$this->mid);
$this->abreviation = $auths[0]->abr;
$ilLog->write(__METHOD__.': Got abr: '.$this->abreviation);
/*
// Read abbreviation from mid
$res = $connector->getMemberships($this->mid);
$member = $res->getResult();
$this->abbreviation = $member[0]->participants[0]->abr;
*/
return true;
}
{
$ilLog->write(__METHOD__.': Authentication failed with message: '.$e->getMessage());
return false;
}
}
ilAuthContainerECS::getAbreviation ( )

get abbreviation

public

Parameters

Definition at line 63 of file class.ilAuthContainerECS.php.

References $abreviation.

Referenced by createUser().

{
}

+ Here is the caller graph for this function:

ilAuthContainerECS::getMID ( )

get mid

public

Definition at line 73 of file class.ilAuthContainerECS.php.

References $mid.

{
return $this->mid;
}
ilAuthContainerECS::initECSServices ( )
private

Init ECS Services private.

Parameters

Definition at line 283 of file class.ilAuthContainerECS.php.

References ilECSSettings\_getInstance().

Referenced by __construct().

{
include_once('./Services/WebServices/ECS/classes/class.ilECSSettings.php');
$this->settings = ilECSSettings::_getInstance();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAuthContainerECS::initSettings ( )
private

init ecs settings

private

Definition at line 270 of file class.ilAuthContainerECS.php.

References ilECSSettings\_getInstance().

Referenced by createUser(), and updateUser().

{
include_once('./Services/WebServices/ECS/classes/class.ilECSSettings.php');
$this->settings = ilECSSettings::_getInstance();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAuthContainerECS::loginObserver (   $a_username,
  $a_auth 
)

Called from base class after successful login.

Parameters
stringusername

Reimplemented from ilAuthContainerBase.

Definition at line 131 of file class.ilAuthContainerECS.php.

References $_GET, $user, $usr_id, ilObject\_lookupObjIdByImportId(), createUser(), Auth_Container\log(), and updateUser().

{
include_once('./Services/WebServices/ECS/classes/class.ilECSUser.php');
{
$username = $this->createUser($user);
}
else
{
$username = $this->updateUser($user,$usr_id);
}
$a_auth->setAuth($username);
$this->log->write(__METHOD__.': Login succesesful');
return true;
}

+ Here is the call graph for this function:

ilAuthContainerECS::sendNotification (   $user_obj)
private

Send notification.

private

Parameters

Definition at line 296 of file class.ilAuthContainerECS.php.

References $GLOBALS, $lang, ilMail\_getAutoGeneratedMessageString(), and ilLanguageFactory\_getLanguage().

{
if(!count($this->settings->getUserRecipients()))
{
return true;
}
include_once('./Services/Language/classes/class.ilLanguageFactory.php');
$GLOBALS['lng'] = $lang;
$GLOBALS['ilUser'] = $user_obj;
$lang->loadLanguageModule('ecs');
include_once('./Services/Mail/classes/class.ilMail.php');
$mail = new ilMail(6);
$mail->enableSoap(false);
$subject = $lang->txt('ecs_new_user_subject');
// build body
$body = $lang->txt('ecs_new_user_body')."\n\n";
$body .= $lang->txt('ecs_new_user_profile')."\n\n";
$body .= $user_obj->getProfileAsString($lang)."\n\n";
$mail->sendMail($this->settings->getUserRecipientsAsString(),"","",$subject,$body,array(),array("normal"));
}

+ Here is the call graph for this function:

ilAuthContainerECS::updateUser ( ilECSUser  $user,
  $a_local_user_id 
)
protected

update existing user

protected

Definition at line 233 of file class.ilAuthContainerECS.php.

References $ilLog, ilECSUser\getEmail(), ilECSUser\getFirstname(), ilECSUser\getImportId(), ilECSUser\getInstitution(), ilECSUser\getLastname(), and initSettings().

Referenced by loginObserver().

{
global $ilClientIniFile,$ilLog,$rbacadmin;
$user_obj = new ilObjUser($a_local_user_id);
$user_obj->setFirstname($user->getFirstname());
$user_obj->setLastname($user->getLastname());
$user_obj->setEmail($user->getEmail());
$user_obj->setInstitution($user->getInstitution());
$until = $user_obj->getTimeLimitUntil();
if($until < (time() + $ilClientIniFile->readVariable('session','expire')))
{
$user_obj->setTimeLimitFrom(time());
$user_obj->setTimeLimitUntil(time() + $ilClientIniFile->readVariable("session","expire"));
}
$user_obj->update();
$user_obj->refreshLogin();
$this->initSettings();
if($global_role = $this->settings->getGlobalRole())
{
$rbacadmin->assignUser($this->settings->getGlobalRole(),$user_obj->getId(),true);
}
$ilLog->write(__METHOD__.': Finished update of remote user with usr_id: '.$user->getImportId());
return $user_obj->getLogin();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilAuthContainerECS::$abreviation = null
protected

Definition at line 37 of file class.ilAuthContainerECS.php.

Referenced by getAbreviation().

ilAuthContainerECS::$log
protected

Definition at line 39 of file class.ilAuthContainerECS.php.

ilAuthContainerECS::$mid = null
protected

Definition at line 36 of file class.ilAuthContainerECS.php.

Referenced by getMID().


The documentation for this class was generated from the following file: