ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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

 $dic
 
 $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 30 of file class.ilRadiusSettingsGUI.php.

References $DIC, and initSettings().

31  {
32  global $DIC;
33 
34  $this->dic = $DIC;
35  $this->ctrl = $this->dic->ctrl();
36  $this->tabs_gui = $this->dic->tabs();
37  $this->lng = $this->dic->language();
38  $this->lng->loadLanguageModule('registration');
39  $this->lng->loadLanguageModule('auth');
40 
41  $this->tpl = $this->dic['tpl'];
42  $this->ref_id = $a_auth_ref_id;
43 
44  $this->initSettings();
45  }
$DIC
Definition: xapitoken.php:46
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 54 of file class.ilRadiusSettingsGUI.php.

References $ilErr.

55  {
56  global $ilErr;
57 
58  $next_class = $this->ctrl->getNextClass($this);
59  $cmd = $this->ctrl->getCmd("settings");
60 
61  if (!$this->dic->rbac()->system()->checkAccess("visible,read", $this->ref_id)) {
62  $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->WARNING);
63  $this->dic->ctrl()->redirect($this, "settings");
64  }
65 
66  switch ($next_class) {
67  default:
68  if (!$cmd) {
69  $cmd = "settings";
70  }
71  $this->$cmd();
72  break;
73  }
74  return true;
75  }
$ilErr
Definition: raiseError.php:18

◆ initSettings()

ilRadiusSettingsGUI::initSettings ( )
private

Init Server settings.

private

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

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

Referenced by __construct().

290  {
291  include_once('Services/Radius/classes/class.ilRadiusSettings.php');
293  }
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 320 of file class.ilRadiusSettingsGUI.php.

References ilRadiusSettings\RADIUS_CHARSET_LATIN1, and ilRadiusSettings\RADIUS_CHARSET_UTF8.

Referenced by settings().

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

◆ prepareRoleSelection()

ilRadiusSettingsGUI::prepareRoleSelection ( )
private

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

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

Referenced by settings().

296  {
297  global $rbacreview,$ilObjDataCache;
298 
299  $global_roles = ilUtil::_sortIds(
300  $rbacreview->getGlobalRoles(),
301  'object_data',
302  'title',
303  'obj_id'
304  );
305 
306  $select[0] = $this->lng->txt('links_select_one');
307  foreach ($global_roles as $role_id) {
308  $select[$role_id] = ilObject::_lookupTitle($role_id);
309  }
310 
311  return $select;
312  }
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 227 of file class.ilRadiusSettingsGUI.php.

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

228  {
229  $this->settings->setActive((int) $_POST['active']);
230  $this->settings->setName(ilUtil::stripSlashes($_POST['name']));
231  $this->settings->setPort(ilUtil::stripSlashes($_POST['port']));
232  $this->settings->setSecret(ilUtil::stripSlashes($_POST['secret']));
233  $this->settings->setServerString(ilUtil::stripSlashes($_POST['servers']));
234  $this->settings->setDefaultRole((int) $_POST['role']);
235  $this->settings->enableAccountMigration((int) $_POST['migration']);
236  $this->settings->setCharset((int) $_POST['charset']);
237  $this->settings->enableCreation(((int) $_POST['sync'] == ilRadiusSettings::SYNC_RADIUS) ? true : false);
238 
239  if (!$this->settings->validateRequired()) {
240  ilUtil::sendFailure($this->lng->txt("fill_out_all_required_fields"));
241  $this->settings();
242  return false;
243  }
244  if (!$this->settings->validatePort()) {
245  ilUtil::sendFailure($this->lng->txt("err_invalid_port"));
246  $this->settings();
247  return false;
248  }
249  if (!$this->settings->validateServers()) {
250  ilUtil::sendFailure($this->lng->txt("err_invalid_server"));
251  $this->settings();
252  return false;
253  }
254 
255  include_once './Services/LDAP/classes/class.ilLDAPServer.php';
256  switch ((int) $_POST['sync']) {
259  break;
260 
263  break;
264 
266  if (!(int) $_REQUEST['ldap_sid']) {
267  ilUtil::sendFailure($this->lng->txt('err_check_input'));
268  $this->settings();
269  return false;
270  }
271 
272  ilLDAPServer::toggleDataSource((int) $_REQUEST['ldap_sid'], AUTH_RADIUS, true);
273  break;
274  }
275 
276  $this->settings->save();
277  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
278  $this->settings();
279  return true;
280  }
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 84 of file class.ilRadiusSettingsGUI.php.

References 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().

85  {
86  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
87 
88  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.settings.html', 'Services/Radius');
89 
90  $this->lng->loadLanguageModule('auth');
91 
92  $form = new ilPropertyFormGUI();
93  $form->setFormAction($this->ctrl->getFormAction($this));
94  $form->setTitle($this->lng->txt('auth_radius_configure'));
95 
96  // Form checkbox
97  $check = new ilCheckboxInputGUI($this->lng->txt('auth_radius_enable'), 'active');
98  $check->setChecked($this->settings->isActive() ? 1 : 0);
99  $check->setValue(1);
100  $form->addItem($check);
101 
102  $text = new ilTextInputGUI($this->lng->txt('auth_radius_name'), 'name');
103  $text->setRequired(true);
104  $text->setInfo($this->lng->txt('auth_radius_name_desc'));
105  $text->setValue($this->settings->getName());
106  $text->setSize(32);
107  $text->setMaxLength(64);
108  $form->addItem($text);
109 
110  $text = new ilTextInputGUI($this->lng->txt('auth_radius_server'), 'servers');
111  $text->setRequired(true);
112  $text->setInfo($this->lng->txt('auth_radius_server_desc'));
113  $text->setValue($this->settings->getServersAsString());
114  $text->setSize(64);
115  $text->setMaxLength(255);
116  $form->addItem($text);
117 
118 
119  $text = new ilTextInputGUI($this->lng->txt('auth_radius_port'), 'port');
120  $text->setRequired(true);
121  $text->setValue($this->settings->getPort());
122  $text->setSize(5);
123  $text->setMaxLength(5);
124  $form->addItem($text);
125 
126  $text = new ilTextInputGUI($this->lng->txt('auth_radius_shared_secret'), 'secret');
127  $text->setRequired(true);
128  $text->setValue($this->settings->getSecret());
129  $text->setSize(16);
130  $text->setMaxLength(32);
131  $form->addItem($text);
132 
133  $encoding = new ilSelectInputGUI($this->lng->txt('auth_radius_charset'), 'charset');
134  $encoding->setRequired(true);
135  $encoding->setOptions($this->prepareCharsetSelection());
136  $encoding->setValue($this->settings->getCharset());
137  $encoding->setInfo($this->lng->txt('auth_radius_charset_info'));
138  $form->addItem($encoding);
139 
140  // User synchronization
141  // 0: Disabled
142  // 1: Radius
143  // 2: LDAP
144  $sync = new ilRadioGroupInputGUI($this->lng->txt('auth_radius_sync'), 'sync');
145  $sync->setRequired(true);
146  #$sync->setInfo($this->lng->txt('auth_radius_sync_info'));
147  $form->addItem($sync);
148 
149  // Disabled
150  $dis = new ilRadioOption(
151  $this->lng->txt('disabled'),
153  ''
154  );
155  #$dis->setInfo($this->lng->txt('auth_radius_sync_disabled_info'));
156  $sync->addOption($dis);
157 
158  // Radius
159  $rad = new ilRadioOption(
160  $this->lng->txt('auth_radius_sync_rad'),
162  ''
163  );
164  $rad->setInfo($this->lng->txt('auth_radius_sync_rad_info'));
165  $sync->addOption($rad);
166 
167  $select = new ilSelectInputGUI($this->lng->txt('auth_radius_role_select'), 'role');
168  $select->setOptions($this->prepareRoleSelection());
169  $select->setValue($this->settings->getDefaultRole());
170  $rad->addSubItem($select);
171 
172  $migr = new ilCheckboxInputGUI($this->lng->txt('auth_rad_migration'), 'migration');
173  $migr->setInfo($this->lng->txt('auth_rad_migration_info'));
174  $migr->setChecked($this->settings->isAccountMigrationEnabled() ? 1 : 0);
175  $migr->setValue(1);
176  $rad->addSubItem($migr);
177 
178  // LDAP
179  include_once './Services/LDAP/classes/class.ilLDAPServer.php';
181 
182  if (count($server_ids)) {
183  $ldap = new ilRadioOption(
184  $this->lng->txt('auth_radius_ldap'),
186  ''
187  );
188  $ldap->setInfo($this->lng->txt('auth_radius_ldap_info'));
189  $sync->addOption($ldap);
190 
191  $ldap_server_select = new ilSelectInputGUI($this->lng->txt('auth_ldap_server_ds'), 'ldap_sid');
192  $options[0] = $this->lng->txt('select_one');
193  foreach ($server_ids as $ldap_sid) {
194  $ldap_server = new ilLDAPServer($ldap_sid);
195  $options[$ldap_sid] = $ldap_server->getName();
196  }
197  $ldap_server_select->setOptions($options);
198  $ldap_server_select->setRequired(true);
200  $ldap_server_select->setValue($ds);
201 
202  $ldap->addSubItem($ldap_server_select);
203  }
204 
206  $sync->setValue(ilRadiusSettings::SYNC_LDAP);
207  } else {
208  $sync->setValue(
209  $this->settings->enabledCreation() ?
212  );
213  }
214 
215  if ($this->dic->rbac()->system()->checkAccess('write', $this->ref_id)) {
216  $form->addCommandButton('save', $this->lng->txt('save'));
217  }
218  $this->tpl->setVariable('SETTINGS_TABLE', $form->getHTML());
219  }
This class represents an option in a radio group.
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.
static getDataSource($a_auth_mode)
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

◆ $dic

ilRadiusSettingsGUI::$dic
private

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

◆ $ref_id

ilRadiusSettingsGUI::$ref_id
private

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


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