ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilRadiusAttributeToUser Class Reference
+ Collaboration diagram for ilRadiusAttributeToUser:

Public Member Functions

 __construct ()
 Constructor. More...
 
 create ($a_username)
 Create new ILIAS account. More...
 

Detailed Description

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

Definition at line 32 of file class.ilRadiusAttributeToUser.php.

Constructor & Destructor Documentation

◆ __construct()

ilRadiusAttributeToUser::__construct ( )

Constructor.

public

Definition at line 40 of file class.ilRadiusAttributeToUser.php.

References $ilLog, and ilRadiusSettings\_getInstance().

41  {
42  global $ilLog;
43 
44  $this->log = $ilLog;
45 
46  include_once('Services/Radius/classes/class.ilRadiusSettings.php');
47  $this->rad_settings = ilRadiusSettings::_getInstance();
48 
49  include_once('./Services/Xml/classes/class.ilXmlWriter.php');
50  $this->writer = new ilXmlWriter();
51  }
XML writer class.
static _getInstance()
singleton get instance
+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilRadiusAttributeToUser::create (   $a_username)

Create new ILIAS account.

public

Parameters
stringexternal username

Definition at line 60 of file class.ilRadiusAttributeToUser.php.

References ilAuthUtils\_generateLogin().

61  {
62  $this->writer->xmlStartTag('Users');
63 
64  // Single users
65  // Required fields
66  // Create user
67  $this->writer->xmlStartTag('User', array('Action' => 'Insert'));
68  $this->writer->xmlElement('Login', array(), $new_name = ilAuthUtils::_generateLogin($a_username));
69 
70  // Assign to role only for new users
71  $this->writer->xmlElement('Role', array('Id' => $this->rad_settings->getDefaultRole(),
72  'Type' => 'Global',
73  'Action' => 'Assign'), '');
74 
75  $this->writer->xmlElement('Active', array(), "true");
76  $this->writer->xmlElement('TimeLimitOwner', array(), 7);
77  $this->writer->xmlElement('TimeLimitUnlimited', array(), 1);
78  $this->writer->xmlElement('TimeLimitFrom', array(), time());
79  $this->writer->xmlElement('TimeLimitUntil', array(), time());
80  $this->writer->xmlElement('AuthMode', array('type' => 'radius'), 'radius');
81  $this->writer->xmlElement('ExternalAccount', array(), $a_username);
82 
83  $this->writer->xmlEndTag('User');
84  $this->writer->xmlEndTag('Users');
85  $this->log->write('Radius: Started creation of user: ' . $new_name);
86 
87  include_once './Services/User/classes/class.ilUserImportParser.php';
88  $importParser = new ilUserImportParser();
89  $importParser->setXMLContent($this->writer->xmlDumpMem(false));
90  $importParser->setRoleAssignment(array($this->rad_settings->getDefaultRole() => $this->rad_settings->getDefaultRole()));
91  $importParser->setFolderId(7);
92  $importParser->startParsing();
93 
94  return $new_name;
95  }
static _generateLogin($a_login)
generate free login by starting with a default string and adding postfix numbers
+ Here is the call graph for this function:

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