23use Psr\Http\Message\RequestInterface;
34 protected ?StandardForm
$form =
null;
40 protected UIFactory
$ui;
45 private readonly
object $parentObject,
47 protected readonly
string $action,
48 protected readonly
string $show_command =
''
51 $this->
ctrl = $DIC->ctrl();
52 $this->
lng = $DIC->language();
53 $this->rbac_review =
$DIC->rbac()->review();
55 $this->
renderer = $DIC->ui()->renderer();
56 $this->request =
$DIC->http()->request();
57 $this->
ui = $DIC->ui()->factory();
58 $this->rbac_system =
$DIC->rbac()->system();
63 protected function txt(
string $var): string
65 return $this->
lng->txt($var);
68 protected function infoTxt(
string $var): string
70 return $this->
txt($var .
'_info');
80 $field = $this->
ui->input()->field();
83 $active = $field->checkbox($this->
txt(
'shib_active'), $this->
lng->txt(
"auth_shib_instructions"))
84 ->withValue($this->
settings->isActive())
85 ->withAdditionalTransformation($custom_trafo(
function ($v):
void {
86 $this->
settings->setActive((
bool) $v);
89 $auth_allow_local = $field->checkbox($this->
txt(
'auth_allow_local'))
90 ->withValue($this->
settings->isLocalAuthAllowed())
91 ->withAdditionalTransformation($custom_trafo(
function ($v):
void {
92 $this->
settings->setAllowLocalAuth((
bool) $v);
95 $account_creation = $field->switchableGroup(
99 $this->lng->txt(
"shib_account_creation_enabled"),
100 $this->lng->txt(
"shib_account_creation_enabled_info")
104 $this->lng->txt(
"shib_account_creation_with_approval"),
105 $this->lng->txt(
"shib_account_creation_with_approval_info")
109 $this->lng->txt(
"shib_account_creation_disabled"),
110 $this->lng->txt(
"shib_account_creation_disabled_info")
113 $this->lng->txt(
"shib_account_creation"),
114 $this->lng->txt(
"shib_account_creation_info")
116 $this->
settings->getAccountCreation()
119 )->withAdditionalTransformation($custom_trafo(
function ($v):
void {
120 $this->
settings->setAccountCreation((
string) $v[0]);
123 $default_user_role = $field->select($this->
txt(
'shib_user_default_role'), $this->
getRoles())
125 ->withValue($this->
settings->getDefaultRole())
126 ->withAdditionalTransformation($custom_trafo(
function ($v):
void {
127 $this->
settings->setDefaultRole((
int) $v);
130 $basic_section = $field->section([
135 ], $this->
txt(
'shib'));
138 $federation_name = $field->text($this->
txt(
'shib_federation_name'))
140 ->withValue($this->
settings->getFederationName())
141 ->withAdditionalTransformation($custom_trafo(
function ($v):
void {
142 $this->
settings->setFederationName((
string) $v);
145 $login_type = $field->switchableGroup([
146 'internal_wayf' => $field->group([
147 $field->textarea(
'', $this->txt(
'shib_idp_list'))
148 ->withValue($this->settings->getIdPList())
149 ->withAdditionalTransformation($custom_trafo(
function ($v):
void {
150 $this->
settings->setIdPList((
string) $v);
152 ], $this->
txt(
'shib_login_internal_wayf')),
153 'external_wayf' => $field->group([
154 $field->text(
'', $this->txt(
'shib_login_button'))
155 ->withValue($this->settings->getLoginButton())
156 ->withAdditionalTransformation($custom_trafo(
function ($v):
void {
157 $this->
settings->setLoginButton((
string) $v);
159 ], $this->
txt(
'shib_login_external_wayf')),
160 'embedded_wayf' => $field->group([], $this->txt(
'shib_login_embedded_wayf'))
161 ->withByline($this->txt(
'shib_login_embedded_wayf_description')),
162 ], $this->txt(
'shib_login_type'))
164 ->withValue($this->
settings->getOrganisationSelectionType())
165 ->withAdditionalTransformation($custom_trafo(
function ($v):
void {
166 $this->
settings->setOrganisationSelectionType($v[0]);
169 $instructions = $field->textarea($this->
txt(
'auth_login_instructions'))
170 ->withValue($this->
settings->get(
'login_instructions',
''))
171 ->withAdditionalTransformation($custom_trafo(
function ($v):
void {
172 $this->
settings->set(
'login_instructions', htmlspecialchars_decode($v));
175 $data_manipulation = $field->text($this->
txt(
'shib_data_conv'))
176 ->withValue($this->
settings->get(
'data_conv'))
177 ->withAdditionalTransformation($custom_trafo(
function ($v):
void {
178 $this->
settings->set(
'data_conv', (
string) $v);
181 $federation_section = $field->section([
190 $fields[] = $field->text($this->
txt(
'shib_login'))
191 ->withValue($this->
settings->get(
'shib_login'))
193 ->withAdditionalTransformation($custom_trafo(
function ($v):
void {
194 $this->
settings->set(
'shib_login', (
string) $v);
196 foreach ($this->
settings->getUserFields() as $field_name => $required) {
197 $fields[] = $field->text($this->
txt($field_name))
198 ->withValue($this->
settings->get($field_name))
199 ->withRequired($required)
200 ->withAdditionalTransformation($custom_trafo(
function ($v) use ($field_name):
void {
201 $this->
settings->set($field_name, (
string) $v);
203 $fields[] = $field->checkbox($this->
txt(
'shib_update'))
204 ->withValue((
bool) $this->
settings->get(
'update_' . $field_name))
205 ->withAdditionalTransformation($custom_trafo(
function ($v) use ($field_name):
void {
206 $this->
settings->set(
'update_' . $field_name, (
string) $v);
210 $user_fields = $field->section(
216 $access = $this->rbac_system->checkAccess(
'write', $this->ref_id);
218 $basic_section = $basic_section->withDisabled(
true);
219 $federation_section = $federation_section->withDisabled(
true);
220 $user_fields = $user_fields->withDisabled(
true);
223 $this->
form = $this->
ui->input()->container()->form()->standard(
224 $this->
ctrl->getFormAction($this->parentObject, $access ? $this->action : $this->show_command),
233 $this->
form = $this->
form->withSubmitLabel($this->
lng->txt(
'refresh'));
239 $request = $this->request->withParsedBody(array_map(
'htmlspecialchars', $this->request->getParsedBody()));
240 $this->
form = $this->
form->withRequest($request);
245 return $this->
form->getData() !==
null;
263 foreach ($this->rbac_review->getRolesByFilter($filter) as $role) {
264 $opt[$role[
'obj_id']] = $role[
'title'] .
' (' . $role[
'obj_id'] .
')';
Builds a Color from either hex- or rgb values.
Class ilCtrl provides processing control methods.
class ilRbacReview Contains Review functions of core Rbac.
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const ACCOUNT_CREATION_ENABLED
const ACCOUNT_CREATION_DISABLED
const ACCOUNT_CREATION_WITH_APPROVAL
An entity that renders components to a string output.
form(?array $class_path, string $cmd, string $submit_caption="")