ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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  }
$tpl
Definition: ilias.php:10
global $ilCtrl
Definition: ilias.php:18
$lng
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 $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  $ilErr->raiseError($this->lng->txt('msg_no_perm_write'), $ilErr->WARNING);
56  }
57 
58  if (!$ilAccess->checkAccess('write', '', $this->ref_id) && $cmd != "settings") {
59  ilUtil::sendFailure($this->lng->txt('msg_no_perm_write'), true);
60  $ilCtrl->redirect($this, "settings");
61  }
62 
63 
64  switch ($next_class) {
65  default:
66  if (!$cmd) {
67  $cmd = "settings";
68  }
69  $this->$cmd();
70  break;
71  }
72  return true;
73  }
$ilErr
Definition: raiseError.php:18
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 285 of file class.ilRadiusSettingsGUI.php.

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

Referenced by __construct().

286  {
287  include_once('Services/Radius/classes/class.ilRadiusSettings.php');
289  }
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 316 of file class.ilRadiusSettingsGUI.php.

References ilRadiusSettings\RADIUS_CHARSET_LATIN1, and ilRadiusSettings\RADIUS_CHARSET_UTF8.

Referenced by settings().

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

◆ prepareRoleSelection()

ilRadiusSettingsGUI::prepareRoleSelection ( )
private

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

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

Referenced by settings().

292  {
293  global $rbacreview,$ilObjDataCache;
294 
295  $global_roles = ilUtil::_sortIds(
296  $rbacreview->getGlobalRoles(),
297  'object_data',
298  'title',
299  'obj_id'
300  );
301 
302  $select[0] = $this->lng->txt('links_select_one');
303  foreach ($global_roles as $role_id) {
304  $select[$role_id] = ilObject::_lookupTitle($role_id);
305  }
306 
307  return $select;
308  }
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 223 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().

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

References $form, PHPMailer\PHPMailer\$options, $sync, $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().

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

◆ $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: