ILIAS  release_4-4 Revision
ilRadiusSettingsGUI Class Reference
+ Collaboration diagram for ilRadiusSettingsGUI:

Public Member Functions

 __construct ($a_auth_ref_id)
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 settings ()
 Show settings. More...
 
 save ()
 Save. More...
 

Private Member Functions

 initSettings ()
 Init Server settings. More...
 
 prepareRoleSelection ()
 
 prepareCharsetSelection ()
 Get charset options. More...
 

Private Attributes

 $ref_id
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilRadiusSettingsGUI::__construct (   $a_auth_ref_id)

Constructor.

public

Parameters
intobject auth ref_id

Definition at line 24 of file class.ilRadiusSettingsGUI.php.

References $ilCtrl, $lng, $tpl, and initSettings().

25  {
26  global $lng,$ilCtrl,$tpl,$ilTabs;
27 
28  $this->ctrl = $ilCtrl;
29  $this->tabs_gui = $ilTabs;
30  $this->lng = $lng;
31  $this->lng->loadLanguageModule('registration');
32  $this->lng->loadLanguageModule('auth');
33 
34  $this->tpl = $tpl;
35  $this->ref_id = $a_auth_ref_id;
36 
37  $this->initSettings();
38  }
global $ilCtrl
Definition: ilias.php:18
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
global $lng
Definition: privfeed.php:40
initSettings()
Init Server settings.
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilRadiusSettingsGUI::executeCommand ( )

Execute command.

public

Parameters

Definition at line 47 of file class.ilRadiusSettingsGUI.php.

References $cmd, $ilCtrl, $ilErr, and ilUtil\sendFailure().

48  {
49  global $ilAccess,$ilErr,$ilCtrl;
50 
51  $next_class = $this->ctrl->getNextClass($this);
52  $cmd = $this->ctrl->getCmd("settings");
53 
54  if(!$ilAccess->checkAccess('read','',$this->ref_id))
55  {
56  $ilErr->raiseError($this->lng->txt('msg_no_perm_write'),$ilErr->WARNING);
57  }
58 
59  if(!$ilAccess->checkAccess('write','',$this->ref_id) && $cmd != "settings")
60  {
61  ilUtil::sendFailure($this->lng->txt('msg_no_perm_write'), true);
62  $ilCtrl->redirect($this, "settings");
63  }
64 
65 
66  switch($next_class)
67  {
68  default:
69  if(!$cmd)
70  {
71  $cmd = "settings";
72  }
73  $this->$cmd();
74  break;
75  }
76  return true;
77 
78  }
$cmd
Definition: sahs_server.php:35
global $ilCtrl
Definition: ilias.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ initSettings()

ilRadiusSettingsGUI::initSettings ( )
private

Init Server settings.

private

Definition at line 281 of file class.ilRadiusSettingsGUI.php.

References ilRadiusSettings\_getInstance(), and settings().

Referenced by __construct().

282  {
283  include_once('Services/Radius/classes/class.ilRadiusSettings.php');
285 
286 
287  }
static _getInstance()
singleton get instance
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareCharsetSelection()

ilRadiusSettingsGUI::prepareCharsetSelection ( )
private

Get charset options.

private

Definition at line 313 of file class.ilRadiusSettingsGUI.php.

References ilRadiusSettings\RADIUS_CHARSET_LATIN1, and ilRadiusSettings\RADIUS_CHARSET_UTF8.

Referenced by settings().

314  {
315  return $select = array(ilRadiusSettings::RADIUS_CHARSET_UTF8 => 'UTF-8',
317  }
+ Here is the caller graph for this function:

◆ prepareRoleSelection()

ilRadiusSettingsGUI::prepareRoleSelection ( )
private

Definition at line 289 of file class.ilRadiusSettingsGUI.php.

References ilObject\_lookupTitle(), and ilUtil\_sortIds().

Referenced by settings().

290  {
291  global $rbacreview,$ilObjDataCache;
292 
293  $global_roles = ilUtil::_sortIds($rbacreview->getGlobalRoles(),
294  'object_data',
295  'title',
296  'obj_id');
297 
298  $select[0] = $this->lng->txt('links_select_one');
299  foreach($global_roles as $role_id)
300  {
301  $select[$role_id] = ilObject::_lookupTitle($role_id);
302  }
303 
304  return $select;
305  }
static _lookupTitle($a_id)
lookup object title
static _sortIds($a_ids, $a_table, $a_field, $a_id_name)
Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,7),'usr_data','lastname','usr_id') => sorts by lastname.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilRadiusSettingsGUI::save ( )

Save.

public

Definition at line 220 of file class.ilRadiusSettingsGUI.php.

References $_POST, AUTH_RADIUS, ilUtil\sendFailure(), ilUtil\sendSuccess(), settings(), ilUtil\stripSlashes(), ilRadiusSettings\SYNC_DISABLED, ilRadiusSettings\SYNC_LDAP, ilRadiusSettings\SYNC_RADIUS, and ilLDAPServer\toggleDataSource().

221  {
222  $this->settings->setActive((int) $_POST['active']);
223  $this->settings->setName(ilUtil::stripSlashes($_POST['name']));
224  $this->settings->setPort(ilUtil::stripSlashes($_POST['port']));
225  $this->settings->setSecret(ilUtil::stripSlashes($_POST['secret']));
226  $this->settings->setServerString(ilUtil::stripSlashes($_POST['servers']));
227  $this->settings->setDefaultRole((int) $_POST['role']);
228  $this->settings->enableAccountMigration((int) $_POST['migration']);
229  $this->settings->setCharset((int) $_POST['charset']);
230  $this->settings->enableCreation(((int) $_POST['sync'] == ilRadiusSettings::SYNC_RADIUS) ? true : false);
231 
232  if(!$this->settings->validateRequired())
233  {
234  ilUtil::sendFailure($this->lng->txt("fill_out_all_required_fields"));
235  $this->settings();
236  return false;
237  }
238  if(!$this->settings->validatePort())
239  {
240  ilUtil::sendFailure($this->lng->txt("err_invalid_port"));
241  $this->settings();
242  return false;
243  }
244  if(!$this->settings->validateServers())
245  {
246  ilUtil::sendFailure($this->lng->txt("err_invalid_server"));
247  $this->settings();
248  return false;
249  }
250 
251  include_once './Services/LDAP/classes/class.ilLDAPServer.php';
252  switch((int) $_POST['sync'])
253  {
256  break;
257 
260  break;
261 
263  // TODO: handle multiple ldap configurations
265  break;
266  }
267 
268  $this->settings->save();
269  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
270  $this->settings();
271  return true;
272  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
static toggleDataSource($a_auth_mode, $a_status)
Toggle Data Source.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
const AUTH_RADIUS
+ Here is the call graph for this function:

◆ settings()

ilRadiusSettingsGUI::settings ( )

Show settings.

public

Parameters

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

References AUTH_RADIUS, ilLDAPServer\getAvailableDataSources(), ilLDAPServer\isDataSourceActive(), prepareCharsetSelection(), prepareRoleSelection(), ilCheckboxInputGUI\setChecked(), ilRadioOption\setInfo(), ilFormPropertyGUI\setInfo(), ilSelectInputGUI\setOptions(), ilFormPropertyGUI\setRequired(), ilRadiusSettings\SYNC_DISABLED, ilRadiusSettings\SYNC_LDAP, and ilRadiusSettings\SYNC_RADIUS.

Referenced by initSettings(), and save().

88  {
89  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
90 
91  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.settings.html','Services/Radius');
92 
93  $this->lng->loadLanguageModule('auth');
94 
95  $form = new ilPropertyFormGUI();
96  $form->setFormAction($this->ctrl->getFormAction($this));
97  $form->setTitle($this->lng->txt('auth_radius_configure'));
98 
99  // Form checkbox
100  $check = new ilCheckboxInputGUI($this->lng->txt('auth_radius_enable'),'active');
101  $check->setChecked($this->settings->isActive() ? 1 : 0);
102  $check->setValue(1);
103  $form->addItem($check);
104 
105  $text = new ilTextInputGUI($this->lng->txt('auth_radius_name'),'name');
106  $text->setRequired(true);
107  $text->setInfo($this->lng->txt('auth_radius_name_desc'));
108  $text->setValue($this->settings->getName());
109  $text->setSize(32);
110  $text->setMaxLength(64);
111  $form->addItem($text);
112 
113  $text = new ilTextInputGUI($this->lng->txt('auth_radius_server'),'servers');
114  $text->setRequired(true);
115  $text->setInfo($this->lng->txt('auth_radius_server_desc'));
116  $text->setValue($this->settings->getServersAsString());
117  $text->setSize(64);
118  $text->setMaxLength(255);
119  $form->addItem($text);
120 
121 
122  $text = new ilTextInputGUI($this->lng->txt('auth_radius_port'),'port');
123  $text->setRequired(true);
124  $text->setValue($this->settings->getPort());
125  $text->setSize(5);
126  $text->setMaxLength(5);
127  $form->addItem($text);
128 
129  $text = new ilTextInputGUI($this->lng->txt('auth_radius_shared_secret'),'secret');
130  $text->setRequired(true);
131  $text->setValue($this->settings->getSecret());
132  $text->setSize(16);
133  $text->setMaxLength(32);
134  $form->addItem($text);
135 
136  $encoding = new ilSelectInputGUI($this->lng->txt('auth_radius_charset'),'charset');
137  $encoding->setRequired(true);
138  $encoding->setOptions($this->prepareCharsetSelection());
139  $encoding->setValue($this->settings->getCharset());
140  $encoding->setInfo($this->lng->txt('auth_radius_charset_info'));
141  $form->addItem($encoding);
142 
143  // User synchronization
144  // 0: Disabled
145  // 1: Radius
146  // 2: LDAP
147  $sync = new ilRadioGroupInputGUI($this->lng->txt('auth_radius_sync'), 'sync');
148  $sync->setRequired(true);
149  #$sync->setInfo($this->lng->txt('auth_radius_sync_info'));
150  $form->addItem($sync);
151 
152  // Disabled
153  $dis = new ilRadioOption(
154  $this->lng->txt('disabled'),
156  ''
157  );
158  #$dis->setInfo($this->lng->txt('auth_radius_sync_disabled_info'));
159  $sync->addOption($dis);
160 
161  // Radius
162  $rad = new ilRadioOption(
163  $this->lng->txt('auth_radius_sync_rad'),
165  ''
166  );
167  $rad->setInfo($this->lng->txt('auth_radius_sync_rad_info'));
168  $sync->addOption($rad);
169 
170  $select = new ilSelectInputGUI($this->lng->txt('auth_radius_role_select'),'role');
171  $select->setOptions($this->prepareRoleSelection());
172  $select->setValue($this->settings->getDefaultRole());
173  $rad->addSubItem($select);
174 
175  $migr = new ilCheckboxInputGUI($this->lng->txt('auth_rad_migration'),'migration');
176  $migr->setInfo($this->lng->txt('auth_rad_migration_info'));
177  $migr->setChecked($this->settings->isAccountMigrationEnabled() ? 1 : 0);
178  $migr->setValue(1);
179  $rad->addSubItem($migr);
180 
181  // LDAP
182  include_once './Services/LDAP/classes/class.ilLDAPServer.php';
184 
185  if(count($server_ids))
186  {
187  $ldap = new ilRadioOption(
188  $this->lng->txt('auth_radius_ldap'),
190  ''
191  );
192  $ldap->setInfo($this->lng->txt('auth_radius_ldap_info'));
193  $sync->addOption($ldap);
194 
195  // TODO Handle more than one LDAP configuration
196  }
197 
199  {
200  $sync->setValue(ilRadiusSettings::SYNC_LDAP);
201  }
202  else
203  {
204  $sync->setValue(
205  $this->settings->enabledCreation() ?
208  }
209 
210  $form->addCommandButton('save',$this->lng->txt('save'));
211  $this->tpl->setVariable('SETTINGS_TABLE',$form->getHTML());
212  }
This class represents an option in a radio group.
This class represents a selection list property in a property form.
prepareCharsetSelection()
Get charset options.
This class represents a property form user interface.
static getAvailableDataSources($a_auth_mode)
This class represents a checkbox property in a property form.
setInfo($a_info)
Set Info.
setInfo($a_info)
Set Information Text.
setChecked($a_checked)
Set Checked.
This class represents a property in a property form.
static isDataSourceActive($a_auth_mode)
Check if a data source is active for a specific auth mode ilDB $ilDB.
This class represents a text property in a property form.
setOptions($a_options)
Set Options.
setRequired($a_required)
Set Required.
const AUTH_RADIUS
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ref_id

ilRadiusSettingsGUI::$ref_id
private

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


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