34 protected \ILIAS\UI\Factory
$ui;
38 protected \Psr\Http\Message\RequestInterface
$request;
48 $this->
ui = $DIC->ui()->factory();
49 $this->renderer = $DIC->ui()->renderer();
50 $this->request = $DIC->http()->request();
51 $this->
ctrl = $DIC->ctrl();
52 $this->
lng = $DIC->language();
59 protected function txt(
string $var): string
61 return $this->
lng->txt($var);
64 protected function infoTxt(
string $var): string
66 return $this->
txt($var .
'_info');
71 return $this->renderer->render($this->
form);
76 $field = $this->
ui->input()->field();
77 $custom_trafo = fn (callable
$c) => $this->
refinery->custom()->transformation($c);
79 $read_me_link =
"./Services/AuthShibboleth/README.SHIBBOLETH.txt";
80 $active = $field->checkbox($this->
txt(
'shib_active'), $this->
lng->txt(
"auth_shib_instructions"))
83 $this->
settings->setActive((
bool) $v);
86 $auth_allow_local = $field->checkbox($this->
txt(
'auth_allow_local'))
87 ->withValue($this->
settings->isLocalAuthAllowed())
89 $this->
settings->setAllowLocalAuth((
bool) $v);
92 $admin_must_activate = $field->checkbox(
93 $this->
txt(
'shib_activate_new'),
94 $this->
lng->txt(
"shib_activate_new_info")
97 $custom_trafo(
function ($v):
void {
98 $this->
settings->setAdminMustActivate((
bool) $v);
102 $default_user_role = $field->select($this->
txt(
'shib_user_default_role'), $this->
getRoles())
104 ->withValue($this->
settings->getDefaultRole())
106 $this->
settings->setDefaultRole((
int) $v);
109 $basic_section = $field->section([
112 $admin_must_activate,
114 ], $this->
txt(
'shib'));
117 $federation_name = $field->text($this->
txt(
'shib_federation_name'))
119 ->withValue($this->
settings->getFederationName())
121 $this->
settings->setFederationName((
string) $v);
124 $login_type = $field->switchableGroup([
125 'internal_wayf' => $field->group([
126 $field->textarea(
'', $this->txt(
'shib_idp_list'))
129 $this->
settings->setIdPList((
string) $v);
131 ], $this->
txt(
'shib_login_internal_wayf')),
132 'external_wayf' => $field->group([
133 $field->text(
'', $this->txt(
'shib_login_button'))
136 $this->
settings->setLoginButton((
string) $v);
138 ], $this->
txt(
'shib_login_external_wayf')),
139 'embedded_wayf' => $field->group([], $this->txt(
'shib_login_embedded_wayf'))
140 ->withByline($this->
txt(
'shib_login_embedded_wayf_description')),
141 ], $this->
txt(
'shib_login_type'))
143 ->withValue($this->
settings->getOrganisationSelectionType())
145 $this->
settings->setOrganisationSelectionType($v[0]);
148 $instructions = $field->textarea($this->
txt(
'auth_login_instructions'))
149 ->withValue($this->
settings->get(
'login_instructions',
''))
151 $this->
settings->set(
'login_instructions', htmlspecialchars_decode($v));
154 $data_manipulation = $field->text($this->
txt(
'shib_data_conv'))
155 ->withValue($this->
settings->get(
'data_conv'))
157 $this->
settings->set(
'data_conv', (
string) $v);
160 $federation_section = $field->section([
169 $fields[] = $field->text($this->
txt(
'shib_login'))
170 ->withValue($this->
settings->get(
'shib_login'))
172 ->withAdditionalTransformation($custom_trafo(
function ($v):
void {
173 $this->
settings->set(
'shib_login', (
string) $v);
175 foreach ($this->
settings->getUserFields() as $field_name => $required) {
176 $fields[] = $field->text($this->
txt($field_name))
177 ->withValue($this->
settings->get($field_name))
178 ->withRequired($required)
179 ->withAdditionalTransformation($custom_trafo(
function ($v) use ($field_name):
void {
180 $this->
settings->set($field_name, (
string) $v);
182 $fields[] = $field->checkbox($this->
txt(
'shib_update'))
183 ->withValue((
bool) $this->
settings->get(
'update_' . $field_name))
185 $this->
settings->set(
'update_' . $field_name, (
string) $v);
189 $user_fields = $field->section(
196 $this->
form = $this->
ui->input()->container()->form()->standard(
203 )->withAdditionalTransformation($this->
refinery->custom()->transformation(
function ($v) {
210 $request = $this->request->withParsedBody(array_map(
'htmlspecialchars', $this->request->getParsedBody()));
211 $this->
form = $this->
form->withRequest($request);
216 return $this->
form->getData() ===
true;
235 foreach ($DIC->rbac()->review()->getRolesByFilter($filter) as $role) {
236 $opt[$role[
'obj_id']] = $role[
'title'] .
' (' . $role[
'obj_id'] .
')';
form( $class_path, string $cmd, string $submit_caption="")
Class ilShibbolethSettings.