ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilOpenIdAttributeToUser Class Reference

Open ID auth class More...

+ Collaboration diagram for ilOpenIdAttributeToUser:

Public Member Functions

 __construct ()
 create ($a_username, $a_userdata=array())
 Create new ILIAS account.

Protected Member Functions

 parseFullname ($a_userdata)

Private Attributes

 $settings = null
 $writer = null

Detailed Description

Open ID auth class

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

Definition at line 13 of file class.ilOpenIdAttributeToUser.php.

Constructor & Destructor Documentation

ilOpenIdAttributeToUser::__construct ( )

Definition at line 21 of file class.ilOpenIdAttributeToUser.php.

References $ilLog, and ilOpenIdSettings\getInstance().

{
global $ilLog;
$this->log = $ilLog;
$this->settings = ilOpenIdSettings::getInstance();
include_once('./Services/Xml/classes/class.ilXmlWriter.php');
$this->writer = new ilXmlWriter();
}

+ Here is the call graph for this function:

Member Function Documentation

ilOpenIdAttributeToUser::create (   $a_username,
  $a_userdata = array() 
)

Create new ILIAS account.

public

Parameters
stringexternal username

Definition at line 41 of file class.ilOpenIdAttributeToUser.php.

References $usr_id, ilAuthUtils\_generateLogin(), ilCalendarUtil\_getShortTimeZoneList(), ilObjUser\_lookupId(), and parseFullname().

{
$a_userdata = $this->parseFullname($a_userdata);
$this->writer->xmlStartTag('Users');
// Single users
// Required fields
// Create user
$this->writer->xmlStartTag('User',array('Action' => 'Insert'));
$this->writer->xmlElement('Login',array(),$new_name = ilAuthUtils::_generateLogin($a_username));
// Assign to role only for new users
$this->writer->xmlElement('Role',array('Id' => $this->settings->getDefaultRole(),
'Type' => 'Global',
'Action' => 'Assign'),'');
if(isset($a_userdata['email']))
{
$this->writer->xmlElement('Email',array(),$a_userdata['email']);
}
if(isset($a_userdata['postcode']))
{
$this->writer->xmlElement('PostalCode',array(),$a_userdata['postcode']);
}
if(isset($a_userdata['dob']) and $a_userdata['dob'])
{
$this->writer->xmlElement('Birthday',array(),$a_userdata['dob']);
}
if(isset($a_userdata['gender']))
{
$this->writer->xmlElement('Gender',array(),strtolower($a_userdata['gender']));
}
if(isset($a_userdata['title']))
{
$this->writer->xmlElement('Title',array(),$a_userdata['title']);
}
if(isset($a_userdata['firstname']))
{
$this->writer->xmlElement('Firstname',array(),$a_userdata['firstname']);
}
if(isset($a_userdata['lastname']))
{
$this->writer->xmlElement('Lastname',array(),$a_userdata['lastname']);
}
$this->writer->xmlElement('Active',array(),"true");
$this->writer->xmlElement('TimeLimitOwner',array(),7);
$this->writer->xmlElement('TimeLimitUnlimited',array(),1);
$this->writer->xmlElement('TimeLimitFrom',array(),time());
$this->writer->xmlElement('TimeLimitUntil',array(),time());
$this->writer->xmlElement('AuthMode',array('type' => 'openid'),'openid');
$this->writer->xmlElement('ExternalAccount',array(),$a_username);
$this->writer->xmlEndTag('User');
$this->writer->xmlEndTag('Users');
$this->log->write('OpenId: Started creation of user: '.$new_name);
include_once './Services/User/classes/class.ilUserImportParser.php';
$importParser = new ilUserImportParser();
$importParser->setXMLContent($this->writer->xmlDumpMem(false));
$importParser->setRoleAssignment(array($this->settings->getDefaultRole() => $this->settings->getDefaultRole()));
$importParser->setFolderId(7);
$importParser->startParsing();
// Assign timezone
if(isset($a_userdata['timezone']))
{
include_once './Services/Calendar/classes/class.ilCalendarUtil.php';
if(isset($tzs[$a_userdata['timezone']]))
{
ilObjUser::_writePref($usr_id, 'user_tz', $a_userdata['timezone']);
}
}
return $new_name;
}

+ Here is the call graph for this function:

ilOpenIdAttributeToUser::parseFullname (   $a_userdata)
protected

Definition at line 122 of file class.ilOpenIdAttributeToUser.php.

Referenced by create().

{
include_once './Services/User/classes/class.ilFullnameParser.php';
$parser = new ilFullnameParser($a_userdata['fullname']);
if($parser->getNotParseable())
{
return $a_userdata;
}
$a_userdata['firstname'] = $parser->getFirstName();
$a_userdata['lastname'] = $parser->getLastName();
$a_userdata['title'] = $parser->getTitle();
return $a_userdata;
}

+ Here is the caller graph for this function:

Field Documentation

ilOpenIdAttributeToUser::$settings = null
private

Definition at line 15 of file class.ilOpenIdAttributeToUser.php.

ilOpenIdAttributeToUser::$writer = null
private

Definition at line 16 of file class.ilOpenIdAttributeToUser.php.


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