ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
ILIAS\Authentication\Form\ApacheAuthSettingsForm Class Reference
+ Collaboration diagram for ILIAS\Authentication\Form\ApacheAuthSettingsForm:

Public Member Functions

 __construct (private int $ref_id, private object $parentObject, private string $show_command, private string $save_command, private array $values=[], ?UIFactory $ui_factory=null, ?ilLanguage $lng=null, ?ilRbacSystem $rbac_system=null, ?ilRbacReview $rbac_review=null, ?ilCtrlInterface $ctrl=null)
 
 buildForm ()
 

Private Member Functions

 buildEnableAuthInput ()
 
 buildLdapEnableInput ()
 
 buildAuthEnableOverrideLoginPageInput ()
 
 buildAuthUsernameConfigTypeInput ()
 
 checkGroupEnabled (string $post_var)
 

Private Attributes

UIFactory $ui_factory
 
ilLanguage $lng
 
ilRbacSystem $rbac_system
 
ilRbacReview $rbac_review
 
ilCtrlInterface $ctrl
 
FieldFactory $ui_field
 

Detailed Description

Definition at line 37 of file ApacheAuthSettingsForm.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Authentication\Form\ApacheAuthSettingsForm::__construct ( private int  $ref_id,
private object  $parentObject,
private string  $show_command,
private string  $save_command,
private array  $values = [],
?UIFactory  $ui_factory = null,
?ilLanguage  $lng = null,
?ilRbacSystem  $rbac_system = null,
?ilRbacReview  $rbac_review = null,
?ilCtrlInterface  $ctrl = null 
)
Parameters
array<string,mixed>$values

Definition at line 49 of file ApacheAuthSettingsForm.php.

60 {
61 global $DIC;
62
63 $this->ui_factory = $ui_factory ?? $DIC->ui()->factory();
64 $this->lng = $lng ?? $DIC->language();
65 $this->rbac_system = $rbac_system ?? $DIC->rbac()->system();
66 $this->rbac_review = $rbac_review ?? $DIC->rbac()->review();
67 $this->ctrl = $ctrl ?? $DIC->ctrl();
68
69 $this->ui_field = $this->ui_factory->input()->field();
70
71 $this->lng->loadLanguageModule('auth');
72 }
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\Authentication\Form\ApacheAuthSettingsForm\$rbac_review, ILIAS\Authentication\Form\ApacheAuthSettingsForm\$rbac_system, ILIAS\Authentication\Form\ApacheAuthSettingsForm\$ui_factory, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildAuthEnableOverrideLoginPageInput()

ILIAS\Authentication\Form\ApacheAuthSettingsForm::buildAuthEnableOverrideLoginPageInput ( )
private

Definition at line 185 of file ApacheAuthSettingsForm.php.

185 : OptionalGroup
186 {
187 return $this->ui_field->optionalGroup([
188 'apache_auth_target_override_login_page' => $this->ui_field->text($this->lng->txt('apache_auth_target_override_login'))
189 ->withRequired(true)
190 ], $this->lng->txt('apache_auth_enable_override_login'))
191 ->withValue(
192 $this->checkGroupEnabled('apache_auth_enable_override_login_page')
193 ? [
194 'apache_auth_target_override_login_page' => $this->values['apache_auth_target_override_login_page'] ?? ''
195 ]
196 : null
197 );
198 }

References ILIAS\Authentication\Form\ApacheAuthSettingsForm\checkGroupEnabled(), and ILIAS\UI\Component\Input\Input\withValue().

Referenced by ILIAS\Authentication\Form\ApacheAuthSettingsForm\buildForm().

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

◆ buildAuthUsernameConfigTypeInput()

ILIAS\Authentication\Form\ApacheAuthSettingsForm::buildAuthUsernameConfigTypeInput ( )
private

Definition at line 200 of file ApacheAuthSettingsForm.php.

200 : SwitchableGroup
201 {
202 return $this->ui_field->switchableGroup([
203 '1' => $this->ui_field->group([
204 'apache_auth_username_direct_mapping_fieldname' => $this->ui_field->text(
205 $this->lng->txt('apache_auth_username_direct_mapping_fieldname')
206 )->withValue($this->values['apache_auth_username_direct_mapping_fieldname'] ?? '')
207 ], $this->lng->txt('apache_auth_username_direct_mapping')),
208 '2' => $this->ui_field->group([], $this->lng->txt('apache_auth_username_extended_mapping'))->withDisabled(true),
209 '3' => $this->ui_field->group([], $this->lng->txt('apache_auth_username_by_function')),
210 ], $this->lng->txt('apache_auth_username_config_type'))
211 ->withValue(
212 isset($this->values['apache_auth_username_config_type']) &&
213 $this->values['apache_auth_username_config_type'] !== '' ?
214 $this->values['apache_auth_username_config_type'] :
215 '1'
216 );
217 }

References ILIAS\UI\Component\Input\Input\withValue().

Referenced by ILIAS\Authentication\Form\ApacheAuthSettingsForm\buildForm().

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

◆ buildEnableAuthInput()

ILIAS\Authentication\Form\ApacheAuthSettingsForm::buildEnableAuthInput ( )
private

Definition at line 121 of file ApacheAuthSettingsForm.php.

121 : OptionalGroup
122 {
123 $roleOptions = [];
124 foreach ($this->rbac_review->getGlobalRolesArray() as $role) {
125 $roleOptions[$role['obj_id']] = ilObject::_lookupTitle($role['obj_id']);
126 }
127
128 $apache_default_role = $this->ui_field->select(
129 $this->lng->txt('apache_default_role'),
130 $roleOptions
131 );
132
133 $apache_local_autocreate = $this->ui_field->optionalGroup([
134 'apache_default_role' => $apache_default_role
135 ], $this->lng->txt('apache_autocreate'));
136
137 return $this->ui_field->optionalGroup([
138 'apache_local_autocreate' => $apache_local_autocreate
139 ], $this->lng->txt('apache_enable_auth'))
140 ->withValue(
141 $this->checkGroupEnabled('apache_enable_auth')
142 ? [
143 'apache_local_autocreate' => $this->checkGroupEnabled('apache_local_autocreate')
144 ? [
145 'apache_default_role' => $this->values['apache_default_role'] ?? 4
146 ]
147 : null
148 ]
149 : null
150 );
151 }
static _lookupTitle(int $obj_id)

References ilObject\_lookupTitle(), ILIAS\Authentication\Form\ApacheAuthSettingsForm\checkGroupEnabled(), and ILIAS\Repository\lng().

Referenced by ILIAS\Authentication\Form\ApacheAuthSettingsForm\buildForm().

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

◆ buildForm()

ILIAS\Authentication\Form\ApacheAuthSettingsForm::buildForm ( )

Definition at line 74 of file ApacheAuthSettingsForm.php.

74 : StandardForm
75 {
76 $access = $this->rbac_system->checkAccess('write', $this->ref_id);
77 $inputs = [
78 'apache_enable_auth' => $this->buildEnableAuthInput(),
79 'apache_enable_local' => $this->ui_field->checkbox($this->lng->txt('apache_enable_local'))
80 ->withValue((bool) ($this->values['apache_enable_local'] ?? true)),
81 'apache_enable_ldap' => $this->buildLdapEnableInput(),
82 'apache_auth_indicator_name' => $this->ui_field->text($this->lng->txt('apache_auth_indicator_name'))
83 ->withRequired(true)
84 ->withValue($this->values['apache_auth_indicator_name'] ?? ''),
85 'apache_auth_indicator_value' => $this->ui_field->text($this->lng->txt('apache_auth_indicator_value'))
86 ->withRequired(true)
87 ->withValue($this->values['apache_auth_indicator_value'] ?? ''),
88 'apache_auth_enable_override_login_page' => $this->buildAuthEnableOverrideLoginPageInput(),
89 'apache_auth_authenticate_on_login_page' => $this->ui_field->checkbox($this->lng->txt('apache_auth_authenticate_on_login_page'))
90 ->withValue((bool) ($this->values['apache_auth_authenticate_on_login_page'] ?? true)),
91 'apache_auth_username_config' => $this->ui_field->section([
92 'apache_auth_username_config_type' => $this->buildAuthUsernameConfigTypeInput()
93 ], $this->lng->txt('apache_auth_username_config')),
94 'apache_auth_security' => $this->ui_field->section([
95 'apache_auth_domains' => $this->ui_field->textarea(
96 $this->lng->txt('apache_auth_domains'),
97 $this->lng->txt('apache_auth_domains_description')
98 )->withValue($this->values['apache_auth_domains'] ?? '')
99 ], $this->lng->txt('apache_auth_security'))
100 ];
101
102 if (!$access) {
103 foreach ($inputs as $key => $input) {
104 $inputs[$key] = $input->withDisabled(true);
105 }
106 }
107
108
109 $form = $this->ui_factory->input()->container()->form()->standard(
110 $this->ctrl->getFormAction($this->parentObject, $access ? $this->save_command : $this->show_command),
111 $inputs
112 );
113
114 if (!$access) {
115 $form = $form->withSubmitLabel($this->lng->txt('refresh'));
116 }
117
118 return $form;
119 }

References ILIAS\UI\Implementation\Component\Input\$inputs, ILIAS\Authentication\Form\ApacheAuthSettingsForm\buildAuthEnableOverrideLoginPageInput(), ILIAS\Authentication\Form\ApacheAuthSettingsForm\buildAuthUsernameConfigTypeInput(), ILIAS\Authentication\Form\ApacheAuthSettingsForm\buildEnableAuthInput(), ILIAS\Authentication\Form\ApacheAuthSettingsForm\buildLdapEnableInput(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ buildLdapEnableInput()

ILIAS\Authentication\Form\ApacheAuthSettingsForm::buildLdapEnableInput ( )
private

Definition at line 153 of file ApacheAuthSettingsForm.php.

153 : Checkbox|OptionalGroup
154 {
155 $servers = ilLDAPServer::getServerIds();
156
157 if ($servers !== []) {
158 $options[0] = $this->lng->txt('select_one');
159 foreach ($servers as $server_id) {
160 $ldap_server = new ilLDAPServer($server_id);
161 $options[$server_id] = $ldap_server->getName();
162 }
163
164 $apache_enable_ldap = $this->ui_field->optionalGroup([
165 'apache_ldap_sid' => $this->ui_field->select($this->lng->txt('auth_ldap_server_ds'), $options)
166 ->withRequired(true)
167 ], $this->lng->txt('apache_enable_ldap'), $this->lng->txt('apache_ldap_hint_ldap_must_be_configured'))
168 ->withValue(
169 $this->checkGroupEnabled('apache_enable_ldap')
170 ? [
171 'apache_ldap_sid' => $this->values['apache_ldap_sid'] ?? ilLDAPServer::getDataSource(ilAuthUtils::AUTH_APACHE)
172 ]
173 : null
174 );
175 } else {
176 $apache_enable_ldap = $this->ui_field->checkbox(
177 $this->lng->txt('apache_enable_ldap'),
178 $this->lng->txt('apache_ldap_hint_ldap_must_be_configured')
179 )->withValue((bool) ($this->values['apache_enable_ldap'] ?? true));
180 }
181
182 return $apache_enable_ldap;
183 }
const int AUTH_APACHE
static getDataSource(int $a_auth_mode)
static getServerIds()
Get all server ids.

References ILIAS\UI\Implementation\Component\Input\Field\$options, ilAuthUtils\AUTH_APACHE, ILIAS\Authentication\Form\ApacheAuthSettingsForm\checkGroupEnabled(), ilLDAPServer\getDataSource(), ilLDAPServer\getServerIds(), and ILIAS\Repository\lng().

Referenced by ILIAS\Authentication\Form\ApacheAuthSettingsForm\buildForm().

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

◆ checkGroupEnabled()

ILIAS\Authentication\Form\ApacheAuthSettingsForm::checkGroupEnabled ( string  $post_var)
private

Definition at line 219 of file ApacheAuthSettingsForm.php.

219 : bool
220 {
221 return isset($this->values[$post_var]) && $this->values[$post_var];
222 }

Referenced by ILIAS\Authentication\Form\ApacheAuthSettingsForm\buildAuthEnableOverrideLoginPageInput(), ILIAS\Authentication\Form\ApacheAuthSettingsForm\buildEnableAuthInput(), and ILIAS\Authentication\Form\ApacheAuthSettingsForm\buildLdapEnableInput().

+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCtrlInterface ILIAS\Authentication\Form\ApacheAuthSettingsForm::$ctrl
private

Definition at line 43 of file ApacheAuthSettingsForm.php.

◆ $lng

ilLanguage ILIAS\Authentication\Form\ApacheAuthSettingsForm::$lng
private

Definition at line 40 of file ApacheAuthSettingsForm.php.

◆ $rbac_review

ilRbacReview ILIAS\Authentication\Form\ApacheAuthSettingsForm::$rbac_review
private

◆ $rbac_system

ilRbacSystem ILIAS\Authentication\Form\ApacheAuthSettingsForm::$rbac_system
private

◆ $ui_factory

UIFactory ILIAS\Authentication\Form\ApacheAuthSettingsForm::$ui_factory
private

◆ $ui_field

FieldFactory ILIAS\Authentication\Form\ApacheAuthSettingsForm::$ui_field
private

Definition at line 44 of file ApacheAuthSettingsForm.php.


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