ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilCASSettingsGUI Class Reference
+ Collaboration diagram for ilCASSettingsGUI:

Public Member Functions

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

Data Fields

const SYNC_DISABLED = 0
 
const SYNC_CAS = 1
 
const SYNC_LDAP = 2
 

Protected Member Functions

 getSettings ()
 
 initFormSettings ()
 Init cas settings. More...
 

Private Member Functions

 prepareRoleSelection ()
 

Private Attributes

 $settings
 
 $ref_id
 

Detailed Description

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

ilCASSettingsGUI:

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

Constructor & Destructor Documentation

◆ __construct()

ilCASSettingsGUI::__construct (   $a_auth_ref_id)

Constructor.

public

Parameters
intobject auth ref_id

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

References $ilCtrl, $lng, $tpl, ilCASSettings\getInstance(), and settings().

33  {
34  global $lng,$ilCtrl,$tpl,$ilTabs;
35 
36  $this->ctrl = $ilCtrl;
37  $this->tabs_gui = $ilTabs;
38  $this->lng = $lng;
39  $this->lng->loadLanguageModule('registration');
40  $this->lng->loadLanguageModule('auth');
41 
42  $this->tpl = $tpl;
43  $this->ref_id = $a_auth_ref_id;
44 
46  }
$tpl
Definition: ilias.php:10
global $ilCtrl
Definition: ilias.php:18
settings()
Show settings.
global $lng
Definition: privfeed.php:17
static getInstance()
Get singleton instance.
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilCASSettingsGUI::executeCommand ( )

Execute command.

public

Parameters

Definition at line 64 of file class.ilCASSettingsGUI.php.

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

65  {
66  global $ilAccess,$ilErr,$ilCtrl;
67 
68  $next_class = $this->ctrl->getNextClass($this);
69  $cmd = $this->ctrl->getCmd("settings");
70 
71  if (!$ilAccess->checkAccess('read', '', $this->ref_id)) {
72  $ilErr->raiseError($this->lng->txt('msg_no_perm_write'), $ilErr->WARNING);
73  }
74 
75  if (!$ilAccess->checkAccess('write', '', $this->ref_id) && $cmd != "settings") {
76  ilUtil::sendFailure($this->lng->txt('msg_no_perm_write'), true);
77  $ilCtrl->redirect($this, "settings");
78  }
79 
80 
81  switch ($next_class) {
82  default:
83  if (!$cmd) {
84  $cmd = "settings";
85  }
86  $this->$cmd();
87  break;
88  }
89  return true;
90  }
global $ilErr
Definition: raiseError.php:16
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:

◆ getSettings()

ilCASSettingsGUI::getSettings ( )
protected
Returns
ilCASSettings

Definition at line 52 of file class.ilCASSettingsGUI.php.

References $settings.

Referenced by initFormSettings(), and save().

53  {
54  return $this->settings;
55  }
+ Here is the caller graph for this function:

◆ initFormSettings()

ilCASSettingsGUI::initFormSettings ( )
protected

Init cas settings.

Definition at line 96 of file class.ilCASSettingsGUI.php.

References $form, $options, $sync, $text, AUTH_CAS, ilLDAPServer\getAvailableDataSources(), ilLDAPServer\getDataSource(), getSettings(), ilLDAPServer\isDataSourceActive(), prepareRoleSelection(), ilCheckboxInputGUI\setChecked(), ilTextAreaInputGUI\setCols(), ilRadioOption\setInfo(), ilFormPropertyGUI\setInfo(), ilSelectInputGUI\setOptions(), ilNumberInputGUI\setValue(), ilCASSettings\SYNC_CAS, ilCASSettings\SYNC_DISABLED, and ilCASSettings\SYNC_LDAP.

Referenced by save(), and settings().

97  {
98  $this->lng->loadLanguageModule('auth');
99  $this->lng->loadLanguageModule('radius');
100 
101  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
102  $form = new ilPropertyFormGUI();
103  $form->setFormAction($this->ctrl->getFormAction($this));
104 
105  $form->setTitle($this->lng->txt('auth_cas_auth'));
106  $form->setDescription($this->lng->txt("auth_cas_auth_desc"));
107 
108  // Form checkbox
109  $check = new ilCheckboxInputGUI($this->lng->txt("active"), 'active');
110  $check->setChecked($this->getSettings()->isActive() ? true : false);
111  $check->setValue(1);
112  $form->addItem($check);
113 
114  $text = new ilTextInputGUI($this->lng->txt('server'), 'server');
115  $text->setValue($this->getSettings()->getServer());
116  $text->setRequired(true);
117  $text->setInfo($this->lng->txt('auth_cas_server_desc'));
118  $text->setSize(64);
119  $text->setMaxLength(255);
120  $form->addItem($text);
121 
122  $port = new ilNumberInputGUI($this->lng->txt("port"), 'port');
123  $port->setValue($this->getSettings()->getPort());
124  $port->setRequired(true);
125  $port->setMinValue(0);
126  $port->setMaxValue(65535);
127  $port->setSize(5);
128  $port->setMaxLength(5);
129  $port->setInfo($this->lng->txt('auth_cas_port_desc'));
130  $form->addItem($port);
131 
132  $text = new ilTextInputGUI($this->lng->txt('uri'), 'uri');
133  $text->setValue($this->getSettings()->getUri());
134  $text->setRequired(true);
135  $text->setInfo($this->lng->txt('auth_cas_uri_desc'));
136  $text->setSize(64);
137  $text->setMaxLength(255);
138  $form->addItem($text);
139 
140  // User synchronization
141  // 0: Disabled
142  // 1: CAS
143  // 2: LDAP
144  $sync = new ilRadioGroupInputGUI($this->lng->txt('auth_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'),
152  self::SYNC_DISABLED,
153  ''
154  );
155  #$dis->setInfo($this->lng->txt('auth_radius_sync_disabled_info'));
156  $sync->addOption($dis);
157 
158  // CAS
159  $rad = new ilRadioOption(
160  $this->lng->txt('auth_sync_cas'),
161  self::SYNC_CAS,
162  ''
163  );
164  $rad->setInfo($this->lng->txt('auth_sync_cas_info'));
165  $sync->addOption($rad);
166 
167  $select = new ilSelectInputGUI($this->lng->txt('auth_user_default_role'), 'role');
168  $select->setOptions($this->prepareRoleSelection());
169  $select->setValue($this->getSettings()->getDefaultRole());
170  $rad->addSubItem($select);
171 
172 
173 
174  // LDAP
175  include_once './Services/LDAP/classes/class.ilLDAPServer.php';
177 
178  if (count($server_ids)) {
179  $ldap = new ilRadioOption(
180  $this->lng->txt('auth_radius_ldap'),
182  ''
183  );
184  $ldap->setInfo($this->lng->txt('auth_radius_ldap_info'));
185  $sync->addOption($ldap);
186 
187  $ldap_server_select = new ilSelectInputGUI($this->lng->txt('auth_ldap_server_ds'), 'ldap_sid');
188  $options[0] = $this->lng->txt('select_one');
189  foreach ($server_ids as $ldap_sid) {
190  $ldap_server = new ilLDAPServer($ldap_sid);
191  $options[$ldap_sid] = $ldap_server->getName();
192  }
193  $ldap_server_select->setOptions($options);
194  $ldap_server_select->setRequired(true);
196  $ldap_server_select->setValue($ds);
197 
198  $ldap->addSubItem($ldap_server_select);
199  }
200 
202  $sync->setValue(ilCASSettings::SYNC_LDAP);
203  } else {
204  $sync->setValue(
205  $this->getSettings()->isUserCreationEnabled() ?
208  );
209  }
210 
211  $instruction = new ilTextAreaInputGUI($this->lng->txt('auth_login_instructions'), 'instruction');
212  $instruction->setCols(80);
213  $instruction->setRows(6);
214  $instruction->setValue($this->getSettings()->getLoginInstruction());
215  $form->addItem($instruction);
216 
217  $create = new ilCheckboxInputGUI($this->lng->txt('auth_allow_local'), 'local');
218  $create->setInfo($this->lng->txt('auth_cas_allow_local_desc'));
219  $create->setChecked($this->getSettings()->isLocalAuthenticationEnabled() ? true : false);
220  $create->setValue(1);
221  $form->addItem($create);
222 
223  $form->addCommandButton('save', $this->lng->txt('save'));
224 
225  return $form;
226  }
This class represents an option in a radio group.
setValue($a_value)
Set Value.
This class represents a selection list property in a property form.
This class represents a property form user interface.
const AUTH_CAS
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
This class represents a number property in a property 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.
This class represents a text area property in a property form.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareRoleSelection()

ilCASSettingsGUI::prepareRoleSelection ( )
private

Definition at line 294 of file class.ilCASSettingsGUI.php.

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

Referenced by initFormSettings().

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

ilCASSettingsGUI::save ( )

Save.

public

Definition at line 248 of file class.ilCASSettingsGUI.php.

References $form, AUTH_CAS, ilLDAPServer\disableDataSourceForAuthMode(), getSettings(), initFormSettings(), ilUtil\sendFailure(), ilUtil\sendSuccess(), settings(), ilCASSettings\SYNC_CAS, ilCASSettings\SYNC_DISABLED, ilCASSettings\SYNC_LDAP, and ilLDAPServer\toggleDataSource().

249  {
250  $form = $this->initFormSettings();
251  if ($form->checkInput()) {
252  $this->getSettings()->setActive($form->getInput('active'));
253  $this->getSettings()->setServer($form->getInput('server'));
254  $this->getSettings()->setPort($form->getInput('port'));
255  $this->getSettings()->setUri($form->getInput('uri'));
256  $this->getSettings()->setDefaultRole($form->getInput('role'));
257  $this->getSettings()->enableLocalAuthentication($form->getInput('local'));
258  $this->getSettings()->setLoginInstruction($form->getInput('instruction'));
259  $this->getSettings()->enableUserCreation($form->getInput('sync') == ilCASSettings::SYNC_CAS ? true : false);
260  $this->getSettings()->save();
261 
262  include_once './Services/LDAP/classes/class.ilLDAPServer.php';
263  switch ((int) $form->getInput('sync')) {
266  break;
267 
270  break;
271 
273  if (!(int) $_REQUEST['ldap_sid']) {
274  ilUtil::sendFailure($this->lng->txt('err_check_input'));
275  $this->settings();
276  return false;
277  }
278 
279  ilLDAPServer::toggleDataSource((int) $_REQUEST['ldap_sid'], AUTH_CAS, true);
280  break;
281  }
282 
283  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
284  $this->ctrl->redirect($this, 'settings');
285  }
286 
287  $form->setValuesByPost();
288  ilUtil::sendFailure($this->lng->txt('err_ceck_input'));
289  $this->tpl->setContent($form->getHTML());
290  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
const AUTH_CAS
static disableDataSourceForAuthMode($a_authmode)
Disable data source.
if(isset($_POST['submit'])) $form
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
settings()
Show settings.
initFormSettings()
Init cas settings.
static toggleDataSource($a_ldap_server_id, $a_auth_mode, $a_status)
Toggle Data Source.
+ Here is the call graph for this function:

◆ settings()

ilCASSettingsGUI::settings ( )

Show settings.

public

Parameters

Definition at line 235 of file class.ilCASSettingsGUI.php.

References $form, and initFormSettings().

Referenced by __construct(), and save().

236  {
237  $form = $this->initFormSettings();
238  $this->tpl->setContent($form->getHTML());
239  return;
240  }
if(isset($_POST['submit'])) $form
initFormSettings()
Init cas settings.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ref_id

ilCASSettingsGUI::$ref_id
private

Definition at line 23 of file class.ilCASSettingsGUI.php.

◆ $settings

ilCASSettingsGUI::$settings
private

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

Referenced by getSettings().

◆ SYNC_CAS

const ilCASSettingsGUI::SYNC_CAS = 1

Definition at line 18 of file class.ilCASSettingsGUI.php.

◆ SYNC_DISABLED

const ilCASSettingsGUI::SYNC_DISABLED = 0

Definition at line 17 of file class.ilCASSettingsGUI.php.

◆ SYNC_LDAP

const ilCASSettingsGUI::SYNC_LDAP = 2

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


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