ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilShibbolethSettingsForm Class Reference

Class ilShibbolethSettingsForm. More...

+ Collaboration diagram for ilShibbolethSettingsForm:

Public Member Functions

 getHTML ()
 
 initForm ()
 
 setValuesByPost ()
 
 saveObject ()
 

Protected Member Functions

 txt (string $var)
 
 infoTxt (string $var)
 
 fillObject ()
 
 getRoles (int $filter=ilRbacReview::FILTER_ALL_GLOBAL)
 

Protected Attributes

ilCtrl $ctrl
 
ILIAS UI Factory $ui
 
ILIAS UI Renderer $renderer
 
ILIAS UI Component Input Container Form Standard $form = null
 
string $action
 
Psr Http Message RequestInterface $request
 
ilLanguage $lng
 
ilShibbolethSettings $settings
 

Private Attributes

 $refinery
 

Detailed Description

Member Function Documentation

◆ fillObject()

ilShibbolethSettingsForm::fillObject ( )
protected

Definition at line 212 of file class.ilShibbolethSettingsForm.php.

References ILIAS\Repository\form().

Referenced by saveObject().

212  : bool
213  {
214  return $this->form->getData() === true;
215  }
form( $class_path, string $cmd)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ilShibbolethSettingsForm::getHTML ( )

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

References ILIAS\Repository\form().

68  : string
69  {
70  return $this->renderer->render($this->form);
71  }
form( $class_path, string $cmd)
+ Here is the call graph for this function:

◆ getRoles()

ilShibbolethSettingsForm::getRoles ( int  $filter = ilRbacReview::FILTER_ALL_GLOBAL)
protected
Returns
array<int|string, string>

Definition at line 229 of file class.ilShibbolethSettingsForm.php.

References $DIC.

Referenced by initForm().

229  : array
230  {
231  global $DIC;
232  $opt = [];
233  foreach ($DIC->rbac()->review()->getRolesByFilter($filter) as $role) {
234  $opt[$role['obj_id']] = $role['title'] . ' (' . $role['obj_id'] . ')';
235  }
236 
237  return $opt;
238  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ infoTxt()

ilShibbolethSettingsForm::infoTxt ( string  $var)
protected

Definition at line 63 of file class.ilShibbolethSettingsForm.php.

References txt().

63  : string
64  {
65  return $this->txt($var . '_info');
66  }
+ Here is the call graph for this function:

◆ initForm()

ilShibbolethSettingsForm::initForm ( )

Definition at line 73 of file class.ilShibbolethSettingsForm.php.

References $c, ILIAS\Repository\form(), getRoles(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ILIAS\Repository\settings(), txt(), ILIAS\Repository\ui(), ILIAS\UI\Implementation\Component\Input\ViewControl\withAdditionalTransformation(), and ILIAS\UI\Implementation\Component\Input\withValue().

73  : void
74  {
75  $field = $this->ui->input()->field();
76  $custom_trafo = fn (callable $c) => $this->refinery->custom()->transformation($c);
78  $read_me_link = "./Services/AuthShibboleth/README.SHIBBOLETH.txt";
79  $active = $field->checkbox($this->txt('shib_active'), $this->lng->txt("auth_shib_instructions"))
80  ->withValue($this->settings->isActive())
81  ->withAdditionalTransformation($custom_trafo(function ($v): void {
82  $this->settings->setActive((bool) $v);
83  }));
84 
85  $auth_allow_local = $field->checkbox($this->txt('auth_allow_local'))
86  ->withValue($this->settings->isLocalAuthAllowed())
87  ->withAdditionalTransformation($custom_trafo(function ($v): void {
88  $this->settings->setAllowLocalAuth((bool) $v);
89  }));
90 
91  $admin_must_activate = $field->checkbox(
92  $this->txt('shib_activate_new'),
93  $this->lng->txt("shib_activate_new_info")
94  )->withValue($this->settings->adminMustActivate())
96  $custom_trafo(function ($v): void {
97  $this->settings->setAdminMustActivate((bool) $v);
98  })
99  );
100 
101  $default_user_role = $field->select($this->txt('shib_user_default_role'), $this->getRoles())
102  ->withRequired(true)
103  ->withValue($this->settings->getDefaultRole())
104  ->withAdditionalTransformation($custom_trafo(function ($v): void {
105  $this->settings->setDefaultRole((int) $v);
106  }));
107 
108  $basic_section = $field->section([
109  $active,
110  $auth_allow_local,
111  $admin_must_activate,
112  $default_user_role,
113  ], $this->txt('shib'));
114 
115  // Federation
116  $federation_name = $field->text($this->txt('shib_federation_name'))
117  ->withRequired(true)
118  ->withValue($this->settings->getFederationName())
119  ->withAdditionalTransformation($custom_trafo(function ($v): void {
120  $this->settings->setFederationName((string) $v);
121  }));
122 
123  $login_type = $field->switchableGroup([
124  'internal_wayf' => $field->group([
125  $field->textarea('', $this->txt('shib_idp_list'))
126  ->withValue($this->settings->getIdPList())
127  ->withAdditionalTransformation($custom_trafo(function ($v): void {
128  $this->settings->setIdPList((string) $v);
129  }))
130  ], $this->txt('shib_login_internal_wayf')),
131  'external_wayf' => $field->group([
132  $field->text('', $this->txt('shib_login_button'))
133  ->withValue($this->settings->getLoginButton())
134  ->withAdditionalTransformation($custom_trafo(function ($v): void {
135  $this->settings->setLoginButton((string) $v);
136  }))
137  ], $this->txt('shib_login_external_wayf')),
138  'embedded_wayf' => $field->group([], $this->txt('shib_login_embedded_wayf'))
139  ->withByline($this->txt('shib_login_embedded_wayf_description')),
140  ], $this->txt('shib_login_type'))
141  ->withRequired(true)
142  ->withValue($this->settings->getOrganisationSelectionType())
143  ->withAdditionalTransformation($custom_trafo(function ($v): void {
144  $this->settings->setOrganisationSelectionType($v[0]);
145  }));
146 
147  $instructions = $field->textarea($this->txt('auth_login_instructions'))
148  ->withValue($this->settings->get('login_instructions', ''))
149  ->withAdditionalTransformation($custom_trafo(function ($v): void {
150  $this->settings->set('login_instructions', (string) $v);
151  }));
152 
153  $data_manipulation = $field->text($this->txt('shib_data_conv'))
154  ->withValue($this->settings->get('data_conv'))
155  ->withAdditionalTransformation($custom_trafo(function ($v): void {
156  $this->settings->set('data_conv', (string) $v);
157  }));
158 
159  $federation_section = $field->section([
160  $federation_name,
161  $login_type,
162  $instructions,
163  $data_manipulation
164  ], '');
165 
166  // User Fields
167  $fields = [];
168  $fields[] = $field->text($this->txt('shib_login'))
169  ->withValue($this->settings->get('shib_login'))
170  ->withRequired(true)
171  ->withAdditionalTransformation($custom_trafo(function ($v): void {
172  $this->settings->set('shib_login', (string) $v);
173  }));
174  foreach ($this->settings->getUserFields() as $field_name => $required) {
175  $fields[] = $field->text($this->txt($field_name))
176  ->withValue($this->settings->get($field_name))
177  ->withRequired($required)
178  ->withAdditionalTransformation($custom_trafo(function ($v) use ($field_name): void {
179  $this->settings->set($field_name, (string) $v);
180  }));
181  $fields[] = $field->checkbox($this->txt('shib_update'))
182  ->withValue((bool) $this->settings->get('update_' . $field_name))
183  ->withAdditionalTransformation($custom_trafo(function ($v) use ($field_name): void {
184  $this->settings->set('update_' . $field_name, (string) $v);
185  }));
186  }
187 
188  $user_fields = $field->section(
189  $fields,
190  ''
191  );
192 
193  // COMPLETE FORM
194 
195  $this->form = $this->ui->input()->container()->form()->standard(
196  $this->action,
197  [
198  $basic_section,
199  $federation_section,
200  $user_fields
201  ]
202  )->withAdditionalTransformation($this->refinery->custom()->transformation(function ($v) {
203  return true;
204  }));
205  }
$c
Definition: cli.php:38
form( $class_path, string $cmd)
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:59
getRoles(int $filter=ilRbacReview::FILTER_ALL_GLOBAL)
+ Here is the call graph for this function:

◆ saveObject()

ilShibbolethSettingsForm::saveObject ( )

Definition at line 217 of file class.ilShibbolethSettingsForm.php.

References fillObject(), and ILIAS\Repository\settings().

217  : bool
218  {
219  if (!$this->fillObject()) {
220  return false;
221  }
222  $this->settings->store();
223  return true;
224  }
+ Here is the call graph for this function:

◆ setValuesByPost()

ilShibbolethSettingsForm::setValuesByPost ( )

Definition at line 207 of file class.ilShibbolethSettingsForm.php.

References ILIAS\Repository\form().

Referenced by ilAuthShibbolethSettingsGUI\save().

207  : void
208  {
209  $this->form = $this->form->withRequest($this->request);
210  }
form( $class_path, string $cmd)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ txt()

ilShibbolethSettingsForm::txt ( string  $var)
protected

Definition at line 58 of file class.ilShibbolethSettingsForm.php.

References ILIAS\Repository\lng().

Referenced by infoTxt(), and initForm().

58  : string
59  {
60  return $this->lng->txt($var);
61  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $action

string ilShibbolethSettingsForm::$action
protected

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

◆ $ctrl

ilCtrl ilShibbolethSettingsForm::$ctrl
protected

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

◆ $form

ILIAS UI Component Input Container Form Standard ilShibbolethSettingsForm::$form = null
protected

Definition at line 35 of file class.ilShibbolethSettingsForm.php.

◆ $lng

ilLanguage ilShibbolethSettingsForm::$lng
protected

Definition at line 38 of file class.ilShibbolethSettingsForm.php.

◆ $refinery

ilShibbolethSettingsForm::$refinery
private

Definition at line 30 of file class.ilShibbolethSettingsForm.php.

◆ $renderer

ILIAS UI Renderer ilShibbolethSettingsForm::$renderer
protected

Definition at line 34 of file class.ilShibbolethSettingsForm.php.

◆ $request

Psr Http Message RequestInterface ilShibbolethSettingsForm::$request
protected

Definition at line 37 of file class.ilShibbolethSettingsForm.php.

◆ $settings

ilShibbolethSettings ilShibbolethSettingsForm::$settings
protected

Definition at line 39 of file class.ilShibbolethSettingsForm.php.

◆ $ui

ILIAS UI Factory ilShibbolethSettingsForm::$ui
protected

Definition at line 33 of file class.ilShibbolethSettingsForm.php.


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