ILIAS  release_7 Revision v7.30-3-g800a261c036
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
 
 $dic
 

Detailed Description

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

@ilCtrl_Calls ilCASSettingsGUI:

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

Constructor & Destructor Documentation

◆ __construct()

ilCASSettingsGUI::__construct (   $a_auth_ref_id)

Constructor.

@access public

Parameters
intobject auth ref_id

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

37 {
38 global $DIC;
39
40 $this->dic = $DIC;
41 $this->ctrl = $this->dic->ctrl();
42 $this->tabs_gui = $this->dic->tabs();
43 $this->lng = $this->dic->language();
44 $this->lng->loadLanguageModule('registration');
45 $this->lng->loadLanguageModule('auth');
46
47 $this->tpl = $this->dic['tpl'];
48 $this->ref_id = $a_auth_ref_id;
49
51 }
static getInstance()
Get singleton instance.
global $DIC
Definition: goto.php:24

References $DIC, ilCASSettings\getInstance(), and settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilCASSettingsGUI::executeCommand ( )

Execute command.

@access public

Parameters

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

70 {
71 global $ilErr;
72
73 $next_class = $this->ctrl->getNextClass($this);
74 $cmd = $this->ctrl->getCmd("settings");
75
76 if (!$this->dic->rbac()->system()->checkAccess("visible,read", $this->ref_id)) {
77 $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->WARNING);
78 }
79
80 switch ($next_class) {
81 default:
82 if (!$cmd) {
83 $cmd = "settings";
84 }
85 $this->$cmd();
86 break;
87 }
88 return true;
89 }
$ilErr
Definition: raiseError.php:18

References $ilErr.

◆ getSettings()

ilCASSettingsGUI::getSettings ( )
protected
Returns
ilCASSettings

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

References $settings.

Referenced by initFormSettings(), and save().

+ Here is the caller graph for this function:

◆ initFormSettings()

ilCASSettingsGUI::initFormSettings ( )
protected

Init cas settings.

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

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

References AUTH_CAS, ilLDAPServer\getAvailableDataSources(), ilLDAPServer\getDataSource(), getSettings(), ilLDAPServer\isDataSourceActive(), prepareRoleSelection(), ilCASSettings\SYNC_CAS, ilCASSettings\SYNC_DISABLED, and ilCASSettings\SYNC_LDAP.

Referenced by save(), and settings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareRoleSelection()

ilCASSettingsGUI::prepareRoleSelection ( )
private

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

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,...

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

Referenced by initFormSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilCASSettingsGUI::save ( )

Save.

@access public

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

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

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

+ Here is the call graph for this function:

◆ settings()

ilCASSettingsGUI::settings ( )

Show settings.

@access public

Parameters

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

237 {
238 $form = $this->initFormSettings();
239 $this->tpl->setContent($form->getHTML());
240 return;
241 }

References initFormSettings().

Referenced by __construct(), and save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $dic

ilCASSettingsGUI::$dic
private

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

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