ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilOpenIdSettingsGUI Class Reference

@classDescription Open ID Settings GUI More...

+ Collaboration diagram for ilOpenIdSettingsGUI:

Public Member Functions

 __construct ($a_ref_id)
 Constructor. More...
 
 executeCommand ()
 Execute control command. More...
 
 getRefId ()
 Get ref id of settings object. More...
 

Protected Member Functions

 settings ()
 Show general settings. More...
 
 save ()
 Save settings. More...
 
 provider ()
 Administrate openid provider. More...
 
 deleteProvider ()
 Delete selected provider. More...
 
 addProvider ()
 Create new provider. More...
 
 editProvider ()
 Create new provider. More...
 
 createProvider ()
 Create new provider. More...
 
 updateProvider ()
 Update provider settings. More...
 
 initFormProvider ($a_mode='edit')
 Show provider form. More...
 
 initProvider ($a_provider_id)
 Init provider. More...
 
 loadProviderFromPost ()
 load provider from post More...
 

Private Member Functions

 setSubTabs ()
 Set sub tabs for open id section. More...
 
 prepareRoleSelection ()
 Prepare default role selection. More...
 

Private Attributes

 $ctrl
 
 $lng
 
 $tpl
 
 $ref_id
 
 $settings
 
 $form = null
 
 $provider = null
 

Detailed Description

@classDescription Open ID Settings GUI

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

@ilCtrl_isCalledBy ilOpenIdSettingsGUI: ilObjAuthSettingsGUI

Definition at line 13 of file class.ilOpenIdSettingsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilOpenIdSettingsGUI::__construct (   $a_ref_id)

Constructor.

Definition at line 29 of file class.ilOpenIdSettingsGUI.php.

30 {
31 $this->ref_id = $a_ref_id;
32 $this->ctrl = $GLOBALS['ilCtrl'];
33 $this->lng = $GLOBALS['lng'];
34 $this->tpl = $GLOBALS['tpl'];
35 $this->lng->loadLanguageModule('auth');
37 }
settings()
Show general settings.
static getInstance()
Get singleton instance.
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276

References $GLOBALS, ilOpenIdSettings\getInstance(), and settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ addProvider()

ilOpenIdSettingsGUI::addProvider ( )
protected

Create new provider.

Returns

Definition at line 215 of file class.ilOpenIdSettingsGUI.php.

216 {
217 global $ilTabs;
218
219 $this->setSubTabs();
220 $ilTabs->setSubTabActive('auth_openid_provider');
221
222 $this->initProvider(0);
223 $this->initFormProvider('add');
224 $this->tpl->setContent($this->form->getHTML());
225 }
setSubTabs()
Set sub tabs for open id section.
initProvider($a_provider_id)
Init provider.
initFormProvider($a_mode='edit')
Show provider form.

References initFormProvider(), initProvider(), and setSubTabs().

+ Here is the call graph for this function:

◆ createProvider()

ilOpenIdSettingsGUI::createProvider ( )
protected

Create new provider.

Returns

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

250 {
251 global $tpl;
252
253 $this->initProvider(0);
254 $this->initFormProvider('add');
255
256 if(!$this->form->checkInput())
257 {
258 $this->form->setValuesByPost();
259 ilUtil::sendFailure($this->lng->txt('err_check_input'));
260 $tpl->setContent($this->form->getHTML());
261 return false;
262 }
263 $this->loadProviderFromPost();
264 $this->provider->add();
265 ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
266 $this->ctrl->redirect($this,'provider');
267 }
provider()
Administrate openid provider.
loadProviderFromPost()
load provider from post
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References $tpl, initFormProvider(), initProvider(), loadProviderFromPost(), provider(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ deleteProvider()

ilOpenIdSettingsGUI::deleteProvider ( )
protected

Delete selected provider.

Returns

Definition at line 193 of file class.ilOpenIdSettingsGUI.php.

194 {
195 if(!isset($_POST['provider_ids']) or !$_POST['provider_ids'])
196 {
197 ilUtil::sendFailure($this->lng->txt('select_one'));
198 $this->provider();
199 return true;
200 }
201
202 foreach($_POST['provider_ids'] as $provider)
203 {
204 $this->initProvider($provider);
205 $this->provider->delete();
206 }
207 ilUtil::sendSuccess($this->lng->txt('auth_openid_deleted_provider'),TRUE);
208 $this->ctrl->redirect($this,'provider');
209 }
$_POST['username']
Definition: cron.php:12

References $_POST, $provider, initProvider(), provider(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ editProvider()

ilOpenIdSettingsGUI::editProvider ( )
protected

Create new provider.

Returns

Definition at line 231 of file class.ilOpenIdSettingsGUI.php.

232 {
233 global $ilTabs;
234
235 $this->setSubTabs();
236 $ilTabs->setSubTabActive('auth_openid_provider');
237
238 $this->ctrl->setParameter($this,'provider_id',$_GET['provider_id']);
239
240 $this->initProvider((int) $_GET['provider_id']);
241 $this->initFormProvider('edit');
242 $this->tpl->setContent($this->form->getHTML());
243 }
$_GET["client_id"]

References $_GET, initFormProvider(), initProvider(), and setSubTabs().

+ Here is the call graph for this function:

◆ executeCommand()

ilOpenIdSettingsGUI::executeCommand ( )

Execute control command.

Returns

Definition at line 43 of file class.ilOpenIdSettingsGUI.php.

44 {
45 global $ilAccess, $ilErr, $lng;
46
47 if(!$ilAccess->checkAccess('read','',$this->getRefId()))
48 {
49 $ilErr->raiseError($lng->txt('msg_no_perm_read'),$ilErr->WARNING);
50 }
51 switch($this->ctrl->getNextClass($this))
52 {
53 default:
54 if(!$cmd = $this->ctrl->getCmd())
55 {
56 $cmd = 'settings';
57 }
58 $this->$cmd();
59 break;
60 }
61 }
$cmd
Definition: sahs_server.php:35

References $cmd, $ilErr, and $lng.

◆ getRefId()

ilOpenIdSettingsGUI::getRefId ( )

Get ref id of settings object.

Returns
int

Definition at line 87 of file class.ilOpenIdSettingsGUI.php.

References $ref_id.

◆ initFormProvider()

ilOpenIdSettingsGUI::initFormProvider (   $a_mode = 'edit')
protected

Show provider form.

Parameters
string$a_mode[optional] add | edit
Returns

Definition at line 298 of file class.ilOpenIdSettingsGUI.php.

299 {
300 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
301 $this->form = new ilPropertyFormGUI();
302 $this->form->setFormAction($this->ctrl->getFormAction($this,'provider'));
303 $this->form->setTableWidth('75%');
304
305 switch($a_mode)
306 {
307 case 'edit':
308 $this->form->setTitle($this->lng->txt('auth_openid_provider_edit'));
309 $this->form->addCommandButton('updateProvider', $this->lng->txt('save'));
310 $this->form->addCommandButton('provider', $this->lng->txt('cancel'));
311 break;
312
313 case 'add':
314 $this->form->setTitle($this->lng->txt('auth_openid_provider_add'));
315 $this->form->addCommandButton('createProvider', $this->lng->txt('btn_add'));
316 $this->form->addCommandButton('provider', $this->lng->txt('cancel'));
317 break;
318 }
319
320 $title = new ilTextInputGUI($this->lng->txt('title'),'title');
321 $title->setRequired(true);
322 $title->setMaxLength(128);
323 $title->setSize(32);
324 $title->setValue($this->provider->getName());
325 $this->form->addItem($title);
326
327 $url = new ilTextInputGUI($this->lng->txt('url'),'url');
328 $url->setValidationRegexp('/http.*%s.*/');
329 $url->setRequired(true);
330 $url->setMaxLength(255);
331 $url->setSize(32);
332 $url->setInfo($this->lng->txt('auth_openid_url_info'));
333 $url->setValue($this->provider->getURL());
334 $this->form->addItem($url);
335 }
This class represents a property form user interface.
This class represents a text property in a property form.
$url
Definition: shib_logout.php:72

References $url, and provider().

Referenced by addProvider(), createProvider(), editProvider(), and updateProvider().

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

◆ initProvider()

ilOpenIdSettingsGUI::initProvider (   $a_provider_id)
protected

Init provider.

Parameters
object$a_provider_id
Returns

Definition at line 342 of file class.ilOpenIdSettingsGUI.php.

343 {
344 include_once './Services/OpenId/classes/class.ilOpenIdProvider.php';
345
346 $this->provider = new ilOpenIdProvider($a_provider_id);
347 return $this->provider;
348 }
@classDescription OpenId provider

References $provider, and provider().

Referenced by addProvider(), createProvider(), deleteProvider(), editProvider(), and updateProvider().

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

◆ loadProviderFromPost()

ilOpenIdSettingsGUI::loadProviderFromPost ( )
protected

load provider from post

Definition at line 353 of file class.ilOpenIdSettingsGUI.php.

354 {
355 $this->provider->setName($this->form->getInput('title'));
356 $this->provider->setURL($this->form->getInput('url'));
357 return $this->provider();
358 }

References provider().

Referenced by createProvider(), and updateProvider().

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

◆ prepareRoleSelection()

ilOpenIdSettingsGUI::prepareRoleSelection ( )
private

Prepare default role selection.

Returns

Definition at line 365 of file class.ilOpenIdSettingsGUI.php.

366 {
367 global $rbacreview,$ilObjDataCache;
368
369 $global_roles = ilUtil::_sortIds($rbacreview->getGlobalRoles(),
370 'object_data',
371 'title',
372 'obj_id');
373
374 $select[0] = $this->lng->txt('links_select_one');
375 foreach($global_roles as $role_id)
376 {
377 $select[$role_id] = ilObject::_lookupTitle($role_id);
378 }
379
380 return $select;
381 }
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 settings().

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

◆ provider()

ilOpenIdSettingsGUI::provider ( )
protected

Administrate openid provider.

Returns

Definition at line 174 of file class.ilOpenIdSettingsGUI.php.

175 {
176 global $ilTabs;
177
178 $this->setSubTabs();
179 $ilTabs->setSubTabActive('auth_openid_provider');
180
181 include_once './Services/OpenId/classes/class.ilOpenIdProviderTableGUI.php';
182 $table = new ilOpenIdProviderTableGUI($this,'provider');
183 $table->parse();
184
185 $GLOBALS['tpl']->setContent($table->getHTML());
186 return true;
187 }
@classDescription Open ID provider table

References $GLOBALS, and setSubTabs().

Referenced by createProvider(), deleteProvider(), initFormProvider(), initProvider(), loadProviderFromPost(), and updateProvider().

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

◆ save()

ilOpenIdSettingsGUI::save ( )
protected

Save settings.

Returns

Definition at line 156 of file class.ilOpenIdSettingsGUI.php.

157 {
158 $this->settings->setActive((int) $_POST['active']);
159 $this->settings->forceProviderSelection((int) !$_POST['free']);
160 $this->settings->enableCreation((int) $_POST['sync']);
161 $this->settings->enableAccountMigration((int) $_POST['migration']);
162 $this->settings->setDefaultRole((int) $_POST['role']);
163 $this->settings->update();
164
165 ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
166 $this->ctrl->redirect($this,'settings');
167 }

References $_POST, ilUtil\sendSuccess(), and settings().

+ Here is the call graph for this function:

◆ setSubTabs()

ilOpenIdSettingsGUI::setSubTabs ( )
private

Set sub tabs for open id section.

@access private

Definition at line 68 of file class.ilOpenIdSettingsGUI.php.

69 {
70 global $ilTabs;
71
72 $ilTabs->addSubTabTarget(
73 "auth_openid_settings",
74 $this->ctrl->getLinkTarget($this,'settings')
75 );
76 $ilTabs->addSubTabTarget(
77 'auth_openid_provider',
78 $this->ctrl->getLinkTarget($this,'provider')
79 );
80 }

Referenced by addProvider(), editProvider(), provider(), and settings().

+ Here is the caller graph for this function:

◆ settings()

ilOpenIdSettingsGUI::settings ( )
protected

Show general settings.

Returns

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

97 {
98 global $tpl,$lng,$ilTabs;
99
100 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
101
102 $tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.openid_settings.html','Services/OpenId');
103
104 $this->setSubTabs();
105 $ilTabs->setSubTabActive('auth_openid_settings');
106
107 $this->form = new ilPropertyFormGUI();
108 $this->form->setTableWidth('75%');
109 $this->form->setFormAction($this->ctrl->getFormAction($this,'save'));
110
111 $this->form->setTitle($this->lng->txt('auth_openid_configure'));
112
113 // Activation
114 $check = new ilCheckboxInputGUI($this->lng->txt('auth_openid_enable'),'active');
115 $check->setChecked($this->settings->isActive() ? 1 : 0);
116 $check->setValue(1);
117 $this->form->addItem($check);
118
119 // Selection
120 $sel = new ilCheckboxInputGUI($this->lng->txt('auth_openid_uncontrolled_selection'),'free');
121 $sel->setChecked(!$this->settings->forcedProviderSelection() ? 1 : 0);
122 $sel->setValue(1);
123 $sel->setInfo($this->lng->txt('auth_openid_uncontrolled_selection_info'));
124 $this->form->addItem($sel);
125
126 // Creation
127 $check = new ilCheckboxInputGUI($this->lng->txt('auth_openid_sync'),'sync');
128 $check->setInfo($this->lng->txt('auth_openid_sync_info'));
129 $check->setChecked($this->settings->isCreationEnabled() ? 1 : 0);
130 $check->setValue(1);
131
132 // Role selection
133 $select = new ilSelectInputGUI($this->lng->txt('auth_openid_role_select'),'role');
134 $select->setOptions($this->prepareRoleSelection());
135 $select->setValue($this->settings->getDefaultRole());
136 $check->addSubItem($select);
137
138 $migr = new ilCheckboxInputGUI($this->lng->txt('auth_openid_migration'),'migration');
139 $migr->setInfo($this->lng->txt('auth_openid_migration_info'));
140 $migr->setChecked($this->settings->isAccountMigrationEnabled() ? 1 : 0);
141 $migr->setValue(1);
142 $check->addSubItem($migr);
143 $this->form->addItem($check);
144
145 $this->form->addCommandButton('save',$this->lng->txt('save'));
146
147 $tpl->setVariable('SETTINGS_FORM',$this->form->getHTML());
148
149 return true;
150 }
This class represents a checkbox property in a property form.
prepareRoleSelection()
Prepare default role selection.
This class represents a selection list property in a property form.

References $lng, $tpl, prepareRoleSelection(), setSubTabs(), and settings().

Referenced by __construct(), save(), and settings().

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

◆ updateProvider()

ilOpenIdSettingsGUI::updateProvider ( )
protected

Update provider settings.

Returns

Definition at line 273 of file class.ilOpenIdSettingsGUI.php.

274 {
275 global $tpl;
276
277 $this->initProvider((int) $_GET['provider_id']);
278 $this->initFormProvider('edit');
279
280 if(!$this->form->checkInput())
281 {
282 $this->form->setValuesByPost();
283 ilUtil::sendFailure($this->lng->txt('err_check_input'));
284 $tpl->setContent($this->form->getHTML());
285 return false;
286 }
287 $this->loadProviderFromPost();
288 $this->provider->update();
289 ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
290 $this->ctrl->redirect($this,'provider');
291 }

References $_GET, $tpl, initFormProvider(), initProvider(), loadProviderFromPost(), provider(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilOpenIdSettingsGUI::$ctrl
private

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

◆ $form

ilOpenIdSettingsGUI::$form = null
private

Definition at line 22 of file class.ilOpenIdSettingsGUI.php.

◆ $lng

ilOpenIdSettingsGUI::$lng
private

Definition at line 16 of file class.ilOpenIdSettingsGUI.php.

Referenced by executeCommand(), and settings().

◆ $provider

ilOpenIdSettingsGUI::$provider = null
private

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

Referenced by deleteProvider(), and initProvider().

◆ $ref_id

ilOpenIdSettingsGUI::$ref_id
private

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

Referenced by getRefId().

◆ $settings

ilOpenIdSettingsGUI::$settings
private

Definition at line 20 of file class.ilOpenIdSettingsGUI.php.

◆ $tpl

ilOpenIdSettingsGUI::$tpl
private

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

Referenced by createProvider(), settings(), and updateProvider().


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