19 declare(strict_types=1);
34 private \ilGlobalTemplateInterface
$tpl;
46 $this->tpl = $DIC->ui()->mainTemplate();
48 $this->
ctrl = $DIC->ctrl();
49 $this->rbacSystem = $DIC->rbac()->system();
50 $this->rbacReview = $DIC->rbac()->review();
51 $this->ilErr = $DIC[
'ilErr'];
52 $this->
lng = $DIC->language();
53 $this->
lng->loadLanguageModule(
'registration');
54 $this->
lng->loadLanguageModule(
'auth');
56 $this->renderer = $DIC->ui()->renderer();
57 $this->factory = $DIC->ui()->factory();
59 $this->ref_id = $a_auth_ref_id;
71 $next_class = $this->
ctrl->getNextClass($this);
72 $cmd = $this->
ctrl->getCmd(
"settings");
74 if (!$this->rbacSystem->checkAccess(
"visible,read", $this->ref_id)) {
75 $this->ilErr->raiseError($this->
lng->txt(
'msg_no_perm_read'), $this->ilErr->WARNING);
78 switch ($next_class) {
91 $this->
lng->loadLanguageModule(
'auth');
94 $form->setFormAction($this->
ctrl->getFormAction($this));
96 $form->setTitle($this->
lng->txt(
'auth_cas_auth'));
98 $has_write_permissions = $this->rbacSystem->checkAccess(
'write', $this->ref_id);
100 $drop_in_replacements_url =
'https://github.com/ILIAS-eLearning/ILIAS/tree/trunk/components/ILIAS/HTTP#dropinreplacements';
101 $drop_in_replacements_link = $this->factory->link()->standard(
102 $this->
lng->txt(
"auth_cas_auth_desc"),
103 $drop_in_replacements_url
105 $form->setDescription($this->renderer->render(
106 $drop_in_replacements_link
111 $check->setDisabled(!$has_write_permissions);
117 $text->setDisabled(!$has_write_permissions);
119 $text->setRequired(
true);
120 $text->setInfo($this->
lng->txt(
'auth_cas_server_desc'));
122 $text->setMaxLength(255);
123 $form->addItem(
$text);
126 $port->setDisabled(!$has_write_permissions);
127 $port->setValue((
string) $this->
getSettings()->getPort());
128 $port->setRequired(
true);
129 $port->setMinValue(0);
130 $port->setMaxValue(65535);
132 $port->setMaxLength(5);
133 $port->setInfo($this->
lng->txt(
'auth_cas_port_desc'));
134 $form->addItem($port);
137 $text->setDisabled(!$has_write_permissions);
139 $text->setRequired(
true);
140 $text->setInfo($this->
lng->txt(
'auth_cas_uri_desc'));
142 $text->setMaxLength(255);
143 $form->addItem(
$text);
151 $sync->setRequired(
true);
152 $form->addItem($sync);
156 $this->
lng->txt(
'disabled'),
157 (string) self::SYNC_DISABLED,
160 $dis->setDisabled(!$has_write_permissions);
161 $sync->addOption($dis);
165 $this->
lng->txt(
'auth_sync_cas'),
166 (string) self::SYNC_CAS,
169 $rad->setDisabled(!$has_write_permissions);
170 $rad->setInfo($this->
lng->txt(
'auth_sync_cas_info'));
171 $sync->addOption($rad);
175 $select->setValue($this->
getSettings()->getDefaultRole());
176 $select->setDisabled(!$has_write_permissions);
177 $rad->addSubItem($select);
183 if (count($server_ids)) {
185 $this->
lng->txt(
'auth_css_ldap'),
189 $ldap->setDisabled(!$has_write_permissions);
190 $ldap->setInfo($this->
lng->txt(
'auth_cas_ldap_info'));
191 $sync->addOption($ldap);
193 $ldap_server_select =
new ilSelectInputGUI($this->
lng->txt(
'auth_ldap_server_ds'),
'ldap_sid');
194 $ldap_server_select->
setDisabled(!$has_write_permissions);
195 $options[0] = $this->
lng->txt(
'select_one');
196 foreach ($server_ids as $ldap_sid) {
198 $options[$ldap_sid] = $ldap_server->getName();
200 $ldap_server_select->setOptions($options);
201 $ldap_server_select->setRequired(
true);
203 $ldap_server_select->setValue($ds);
205 $ldap->addSubItem($ldap_server_select);
220 $instruction->setRows(6);
221 $instruction->setDisabled(!$has_write_permissions);
222 $instruction->setValue($this->
getSettings()->getLoginInstruction());
223 $form->addItem($instruction);
226 $create->setInfo($this->
lng->txt(
'auth_cas_allow_local_desc'));
227 $create->setChecked($this->
getSettings()->isLocalAuthenticationEnabled());
228 $create->setValue(
"1");
229 $create->setDisabled(!$has_write_permissions);
230 $form->addItem($create);
232 if ($this->rbacSystem->checkAccess(
'write', $this->ref_id)) {
233 $form->addCommandButton(
'save', $this->
lng->txt(
'save'));
242 $this->tpl->setContent($form->getHTML());
247 if (!$this->rbacSystem->checkAccess(
'write', $this->ref_id)) {
248 $this->ilErr->raiseError($this->
lng->txt(
'permission_denied'), $this->ilErr->WARNING);
252 if ($form->checkInput()) {
253 $this->
getSettings()->setActive((
bool) $form->getInput(
'active'));
254 $this->
getSettings()->setServer($form->getInput(
'server'));
255 $this->
getSettings()->setPort((
int) $form->getInput(
'port'));
256 $this->
getSettings()->setUri($form->getInput(
'uri'));
257 $this->
getSettings()->setDefaultRole((
int) $form->getInput(
'role'));
258 $this->
getSettings()->enableLocalAuthentication((
bool) $form->getInput(
'local'));
259 $this->
getSettings()->setLoginInstruction($form->getInput(
'instruction'));
263 switch ((
int) $form->getInput(
'sync')) {
270 if (!(
int) $form->getInput(
'ldap_sid')) {
271 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
281 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
282 $this->
ctrl->redirect($this,
'settings');
285 $form->setValuesByPost();
286 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_ceck_input'));
287 $this->tpl->setContent($form->getHTML());
293 $this->rbacReview->getGlobalRoles(),
299 $select[0] = $this->
lng->txt(
'links_select_one');
300 foreach ($global_roles as $role_id) {
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static disableDataSourceForAuthMode(int $a_authmode)
Disable data source.
static getDataSource(int $a_auth_mode)
__construct(int $a_auth_ref_id)
static getAvailableDataSources(int $a_auth_mode)
static toggleDataSource(int $a_ldap_server_id, int $a_auth_mode, int $a_status)
Toggle Data Source.
ilGlobalTemplateInterface $tpl
static isDataSourceActive(int $a_auth_mode)
Check if a data source is active for a specific auth mode.
static _lookupTitle(int $obj_id)
static _sortIds(array $a_ids, string $a_table, string $a_field, string $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.
This class represents a text area property in a property form.
ILIAS UI Factory $factory
static getInstance()
Get singleton instance.
ILIAS UI Renderer $renderer