ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17
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  }
global $ilErr
Definition: raiseError.php:16
$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 299 of file class.ilRadiusSettingsGUI.php.

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

Referenced by __construct().

300  {
301  include_once('Services/Radius/classes/class.ilRadiusSettings.php');
303 
304 
305  }
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 331 of file class.ilRadiusSettingsGUI.php.

References array, ilRadiusSettings\RADIUS_CHARSET_LATIN1, and ilRadiusSettings\RADIUS_CHARSET_UTF8.

Referenced by settings().

332  {
333  return $select = array(ilRadiusSettings::RADIUS_CHARSET_UTF8 => 'UTF-8',
335  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ prepareRoleSelection()

ilRadiusSettingsGUI::prepareRoleSelection ( )
private

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

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

Referenced by settings().

308  {
309  global $rbacreview,$ilObjDataCache;
310 
311  $global_roles = ilUtil::_sortIds($rbacreview->getGlobalRoles(),
312  'object_data',
313  'title',
314  'obj_id');
315 
316  $select[0] = $this->lng->txt('links_select_one');
317  foreach($global_roles as $role_id)
318  {
319  $select[$role_id] = ilObject::_lookupTitle($role_id);
320  }
321 
322  return $select;
323  }
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 232 of file class.ilRadiusSettingsGUI.php.

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

233  {
234  $this->settings->setActive((int) $_POST['active']);
235  $this->settings->setName(ilUtil::stripSlashes($_POST['name']));
236  $this->settings->setPort(ilUtil::stripSlashes($_POST['port']));
237  $this->settings->setSecret(ilUtil::stripSlashes($_POST['secret']));
238  $this->settings->setServerString(ilUtil::stripSlashes($_POST['servers']));
239  $this->settings->setDefaultRole((int) $_POST['role']);
240  $this->settings->enableAccountMigration((int) $_POST['migration']);
241  $this->settings->setCharset((int) $_POST['charset']);
242  $this->settings->enableCreation(((int) $_POST['sync'] == ilRadiusSettings::SYNC_RADIUS) ? true : false);
243 
244  if(!$this->settings->validateRequired())
245  {
246  ilUtil::sendFailure($this->lng->txt("fill_out_all_required_fields"));
247  $this->settings();
248  return false;
249  }
250  if(!$this->settings->validatePort())
251  {
252  ilUtil::sendFailure($this->lng->txt("err_invalid_port"));
253  $this->settings();
254  return false;
255  }
256  if(!$this->settings->validateServers())
257  {
258  ilUtil::sendFailure($this->lng->txt("err_invalid_server"));
259  $this->settings();
260  return false;
261  }
262 
263  include_once './Services/LDAP/classes/class.ilLDAPServer.php';
264  switch((int) $_POST['sync'])
265  {
268  break;
269 
272  break;
273 
275  if(!(int) $_REQUEST['ldap_sid'])
276  {
277  ilUtil::sendFailure($this->lng->txt('err_check_input'));
278  $this->settings();
279  return false;
280  }
281 
282  ilLDAPServer::toggleDataSource((int) $_REQUEST['ldap_sid'], AUTH_RADIUS,true);
283  break;
284  }
285 
286  $this->settings->save();
287  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
288  $this->settings();
289  return true;
290  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static disableDataSourceForAuthMode($a_authmode)
Disable 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.
$_POST["username"]
static toggleDataSource($a_ldap_server_id, $a_auth_mode, $a_status)
Toggle Data Source.
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 $options, $text, AUTH_RADIUS, ilLDAPServer\getAvailableDataSources(), ilLDAPServer\getDataSource(), 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  $ldap_server_select = new ilSelectInputGUI($this->lng->txt('auth_ldap_server_ds'), 'ldap_sid');
196  $options[0] = $this->lng->txt('select_one');
197  foreach($server_ids as $ldap_sid)
198  {
199  $ldap_server = new ilLDAPServer($ldap_sid);
200  $options[$ldap_sid] = $ldap_server->getName();
201  }
202  $ldap_server_select->setOptions($options);
203  $ldap_server_select->setRequired(true);
205  $ldap_server_select->setValue($ds);
206 
207  $ldap->addSubItem($ldap_server_select);
208  }
209 
211  {
212  $sync->setValue(ilRadiusSettings::SYNC_LDAP);
213  }
214  else
215  {
216  $sync->setValue(
217  $this->settings->enabledCreation() ?
220  }
221 
222  $form->addCommandButton('save',$this->lng->txt('save'));
223  $this->tpl->setVariable('SETTINGS_TABLE',$form->getHTML());
224  }
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.
if(!is_array($argv)) $options
This class represents a text property in a property form.
static getDataSource($a_auth_mode)
setOptions($a_options)
Set Options.
$text
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: