19 declare(strict_types=1);
34 public function __construct($a_data, $a_id, $a_call_by_reference =
true, $a_prepare_output =
true)
38 self::initErrorMessages();
45 $lng = $DIC->language();
47 if (count(self::$ERROR_MESSAGE)) {
68 $next_class = $this->
ctrl->getNextClass($this);
69 $cmd = $this->
ctrl->getCmd();
73 if (!$this->rbac_system->checkAccess(
'visible,read', $this->object->getRefId())) {
74 $this->error->raiseError($this->
lng->txt(
'no_permission'), $this->error->WARNING);
77 switch ($next_class) {
78 case 'ilpermissiongui':
79 $this->tabs_gui->setTabActive(
'perm_settings');
81 $this->
ctrl->forwardCommand($perm_gui);
85 if (!$cmd || $cmd ==
'view') {
100 if ($this->rbac_system->checkAccess(
"visible,read", $this->object->getRefId())) {
101 $this->tabs_gui->addTarget(
103 $this->
ctrl->getLinkTarget($this,
"showPrivacy"),
106 $this->tabs_gui->addTarget(
108 $this->
ctrl->getLinkTarget($this,
"showSecurity"),
113 if ($this->rbac_system->checkAccess(
'edit_permission', $this->object->getRefId())) {
114 $this->tabs_gui->addTarget(
116 $this->
ctrl->getLinkTargetByClass(
'ilpermissiongui',
"perm"),
127 $this->tabs_gui->setTabActive(
'show_privacy');
130 $form->setFormAction($this->
ctrl->getFormAction($this));
131 $form->setTitle($this->
lng->txt(
'ps_privacy_protection'));
134 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'ps_warning_modify'));
138 if ($privacy->enabledCourseExport()) {
139 $value[] =
"export_course";
141 if ($privacy->enabledGroupExport()) {
142 $value[] =
"export_group";
144 if ($privacy->courseConfirmationRequired()) {
145 $value[] =
"export_confirm_course";
147 if ($privacy->groupConfirmationRequired()) {
148 $value[] =
"export_confirm_group";
150 if ($privacy->enabledGroupAccessTimes()) {
151 $value[] =
"grp_access_times";
153 if ($privacy->enabledCourseAccessTimes()) {
154 $value[] =
"crs_access_times";
156 if ($privacy->enabledLearningSequenceAccessTimes()) {
157 $value[] =
"lso_access_times";
159 if ($privacy->participantsListInCoursesEnabled()) {
160 $value[] =
'participants_list_courses';
165 $check->setTitle($this->
lng->txt(
'ps_export_course'));
166 $check->setValue(
'export_course');
167 $group->addOption(
$check);
169 $check->setTitle($this->
lng->txt(
'ps_export_groups'));
170 $check->setValue(
'export_group');
171 $group->addOption(
$check);
173 $check->setTitle($this->
lng->txt(
'ps_export_confirm'));
174 $check->setValue(
'export_confirm_course');
175 $group->addOption(
$check);
177 $check->setTitle($this->
lng->txt(
'ps_export_confirm_group'));
178 $check->setValue(
'export_confirm_group');
179 $group->addOption(
$check);
181 $check->setTitle($this->
lng->txt(
'ps_show_grp_access'));
182 $check->setValue(
'grp_access_times');
183 $group->addOption(
$check);
185 $check->setTitle($this->
lng->txt(
'ps_show_crs_access'));
186 $check->setValue(
'crs_access_times');
187 $group->addOption(
$check);
189 $check->setTitle($this->
lng->txt(
'ps_show_lso_access'));
190 $check->setValue(
'lso_access_times');
191 $group->addOption(
$check);
192 $form->addItem($group);
194 $check->setTitle($this->
lng->txt(
'ps_participants_list_courses'));
195 $check->setValue(
'participants_list_courses');
196 $group->addOption(
$check);
205 $form->addCommandButton(
'save_privacy', $this->
lng->txt(
'save'));
219 $this->tpl->setContent($form->getHTML());
229 $this->tabs_gui->setTabActive(
'show_security');
232 $form->setFormAction($this->
ctrl->getFormAction($this));
233 $form->setTitle($this->
lng->txt(
'ps_security_protection'));
240 $this->tpl->setContent($form->getHTML());
245 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
246 $this->error->raiseError($this->
lng->txt(
'no_permission'), $this->error->WARNING);
251 if (!$form->checkInput()) {
255 $profile_protection = $form->getInput(
'profile_protection') ?? [];
259 $old_settings = array(
260 'export_course' => $privacy->enabledCourseExport(),
261 'export_group' => $privacy->enabledGroupExport(),
262 'export_confirm_course' => $privacy->courseConfirmationRequired(),
263 'export_confirm_group' => $privacy->groupConfirmationRequired(),
264 'crs_access_times' => $privacy->enabledCourseAccessTimes(),
265 'grp_access_times' => $privacy->enabledGroupAccessTimes(),
266 'lso_access_times' => $privacy->enabledLearningSequenceAccessTimes(),
267 'participants_list_courses' => $privacy->participantsListInCoursesEnabled()
270 $privacy->enableCourseExport(in_array(
'export_course', $profile_protection));
271 $privacy->enableGroupExport(in_array(
'export_group', $profile_protection));
272 $privacy->setCourseConfirmationRequired(in_array(
'export_confirm_course', $profile_protection));
273 $privacy->setGroupConfirmationRequired(in_array(
'export_confirm_group', $profile_protection));
274 $privacy->showGroupAccessTimes(in_array(
'grp_access_times', $profile_protection));
275 $privacy->showCourseAccessTimes(in_array(
'crs_access_times', $profile_protection));
276 $privacy->showLearningSequenceAccessTimes(in_array(
'lso_access_times', $profile_protection));
278 $privacy->enableParticipantsListInCourses(in_array(
'participants_list_courses', $profile_protection));
281 $code = $privacy->validate();
285 $this->tpl->setOnScreenMessage(
'failure', $msg);
286 $form->setValuesByPost();
290 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
291 $form->setValuesByPost();
298 if (!$old_settings[
'export_course'] && $privacy->enabledCourseExport()) {
301 if (!$do_reset && !$old_settings[
'export_group'] && $privacy->enabledGroupExport()) {
304 if (!$do_reset && !$old_settings[
'export_confirm_course'] && $privacy->courseConfirmationRequired()) {
307 if (!$do_reset && !$old_settings[
'export_confirm_group'] && $privacy->groupConfirmationRequired()) {
310 if (!$do_reset && !$old_settings[
'crs_access_times'] && $privacy->enabledCourseAccessTimes()) {
313 if (!$do_reset && !$old_settings[
'grp_access_times'] && $privacy->enabledGroupAccessTimes()) {
316 if (!$do_reset && !$old_settings[
'lso_access_times'] && $privacy->enabledLearningSequenceAccessTimes()) {
322 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
324 $this->
ctrl->redirect($this,
'showPrivacy');
332 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
333 $this->error->raiseError($this->
lng->txt(
'no_permission'), $this->error->WARNING);
346 self::initErrorMessages();
347 if (array_key_exists($code, self::$ERROR_MESSAGE)) {
348 return self::$ERROR_MESSAGE[$code];
355 switch ($a_form_id) {
361 'ps_export_course' => array($privacy->enabledCourseExport(),
364 'ps_export_confirm' => array($privacy->courseConfirmationRequired(),
367 'ps_show_crs_access' => array($privacy->enabledCourseAccessTimes(),
370 'ps_participants_list_courses' => [$privacy->participantsListInCoursesEnabled(),
375 'ps_profile_export' => [null, null, $subitems]
377 return array(array(
"showPrivacy", $fields));
384 'ps_export_groups' => array($privacy->enabledGroupExport(),
387 'ps_export_confirm_group' => array($privacy->groupConfirmationRequired(),
390 'ps_show_grp_access' => array($privacy->enabledGroupAccessTimes(),
395 'ps_profile_export' => array(null, null, $subitems)
397 return [[
"showPrivacy", $fields]];
showSecurity()
Show Privacy settings.
static array $ERROR_MESSAGE
static initErrorMessages()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const SECURITY_SETTINGS_ERR_CODE_PASSWORD_MIN_LENGTH_MIN2
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
const SECURITY_SETTINGS_ERR_CODE_INVALID_PASSWORD_MIN_LENGTH
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Contructor public.
const SECURITY_SETTINGS_ERR_CODE_INVALID_PASSWORD_MAX_LENGTH
prepareOutput(bool $show_sub_objects=true)
showPrivacy(?ilPropertyFormGUI $form=null)
Show Privacy settings public.
loadLanguageModule(string $a_module)
Load language module.
static int $SECURITY_SETTINGS_ERR_CODE_HTTP_NOT_AVAILABLE
static _reset()
Reset all.
const SECURITY_SETTINGS_ERR_CODE_INVALID_PASSWORD_MAX_AGE
static int $SECURITY_SETTINGS_ERR_CODE_AUTO_HTTPS
static getErrorMessage(int $code)
return error message for error code
Class ilObjectGUI Basic methods of all Output classes.
save_security()
Save security settings.
getAdminTabs()
Get tabs public.
static _hasAgreements()
Check if there is any user agreement.
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
addToExternalSettingsForm(int $a_form_id)
const SECURITY_SETTINGS_ERR_CODE_PASSWORD_MIN_LENGTH_MIN3
getErrorMessage($value)
Get the problem message.
__construct(Container $dic, ilPlugin $plugin)
static int $SECURITY_SETTINGS_ERR_CODE_HTTPS_NOT_AVAILABLE
const SECURITY_SETTINGS_ERR_CODE_INVALID_LOGIN_MAX_ATTEMPTS
const SECURITY_SETTINGS_ERR_CODE_PASSWORD_MIN_LENGTH_MIN1
const SECURITY_SETTINGS_ERR_CODE_PASSWORD_MAX_LENGTH_LESS_MIN_LENGTH
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static _getInstance()
Get instance of ilSecuritySettings.