3 declare(strict_types=1);
43 public function __construct($a_data,
int $a_id,
bool $a_call_by_reference)
47 $this->rbac_admin = $DIC->rbac()->admin();
51 $this->
lng->loadLanguageModule(
'rbac');
53 $this->
ctrl->saveParameter($this,
"obj_id");
54 $this->
http = $DIC->http();
62 $next_class = $this->
ctrl->getNextClass($this);
63 $cmd = $this->
ctrl->getCmd();
65 switch ($next_class) {
81 if ($this->creation_mode) {
82 $this->
ctrl->setParameter($this,
"new_type",
'rolt');
85 $form->setFormAction($this->
ctrl->getFormAction($this));
87 if ($a_mode == self::FORM_MODE_CREATE) {
88 $form->setTitle($this->
lng->txt(
'rolt_new'));
89 $form->addCommandButton(
'save', $this->
lng->txt(
'rolt_new'));
91 $form->setTitle($this->
lng->txt(
'rolt_edit'));
92 $form->addCommandButton(
'update', $this->
lng->txt(
'save'));
94 $form->addCommandButton(
'cancel', $this->
lng->txt(
'cancel'));
97 if ($a_mode != self::FORM_MODE_CREATE) {
98 if ($this->
object->isInternalTemplate()) {
99 $title->setDisabled(
true);
104 $title->setMaxLength(70);
105 $title->setRequired(
true);
106 $form->addItem($title);
110 if ($a_mode != self::FORM_MODE_CREATE) {
115 $form->addItem($desc);
117 if ($a_mode != self::FORM_MODE_CREATE) {
120 $form->addItem($ilias_id);
128 $pro->setValue((
string) 1);
129 $form->addItem($pro);
136 if (!$this->rbac_system->checkAccess(
"create_rolt", $this->rolf_ref_id)) {
137 $this->error->raiseError($this->
lng->txt(
"permission_denied"), $this->error->MESSAGE);
139 if ($form === null) {
142 $this->tpl->setContent($form->getHTML());
150 $this->tabs_gui->activateTab(
'settings');
152 if (!$this->rbac_system->checkAccess(
"write", $this->rolf_ref_id)) {
153 $this->error->raiseError($this->
lng->txt(
"msg_no_perm_write"), $this->error->MESSAGE);
156 if ($form === null) {
159 $this->tpl->setContent($form->getHTML());
165 if (!$this->rbac_system->checkAccess(
"write", $this->rolf_ref_id)) {
166 $this->error->raiseError($this->
lng->txt(
"msg_no_perm_modify_rolt"), $this->error->WARNING);
170 if ($form->checkInput()) {
171 if (!$this->
object->isInternalTemplate()) {
172 $this->
object->setTitle($form->getInput(
'title'));
174 $this->
object->setDescription($form->getInput(
'desc'));
175 $this->rbac_admin->setProtected(
178 $form->getInput(
'protected') ?
'y' :
'n' 180 $this->
object->update();
181 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"saved_successfully"),
true);
182 $this->
ctrl->returnToParent($this);
185 $form->setValuesByPost();
191 if (!$this->rbac_system->checkAccess(
"create_rolt", $this->rolf_ref_id)) {
192 $this->
ilias->raiseError($this->
lng->txt(
"msg_no_perm_create_rolt"), $this->
ilias->error_obj->WARNING);
195 if ($form->checkInput()) {
197 $roltObj->setTitle($form->getInput(
'title'));
198 $roltObj->setDescription($form->getInput(
'desc'));
201 $this->rbac_admin->setProtected(
204 $form->getInput(
'protected') ?
'y' :
'n' 207 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"rolt_added"),
true);
209 $this->
ctrl->setParameter($this,
'obj_id', $roltObj->getId());
210 $this->
ctrl->redirect($this,
'perm');
212 $form->setValuesByPost();
218 if (!$this->rbac_system->checkAccess(
'edit_permission', $this->ref_id)) {
219 $this->error->raiseError($this->
lng->txt(
'msg_no_perm_perm'), $this->error->MESSAGE);
222 $this->tabs_gui->activateTab(
'perm');
224 $this->tpl->addBlockFile(
227 'tpl.rbac_template_permissions.html',
228 'Services/AccessControl' 231 $this->tpl->setVariable(
'PERM_ACTION', $this->
ctrl->getFormAction($this));
235 $acc->setId(
'template_perm_' . $this->ref_id);
237 $subs = ilObjRole::getSubObjects(
'root',
false);
239 foreach ($subs as $subtype => $def) {
248 $tbl->setShowChangeExistingObjects(
false);
251 $acc->addItem($def[
'translation'], $tbl->getHTML());
254 $this->tpl->setVariable(
'ACCORDION', $acc->getHTML());
264 $options->setShowOptions(
false);
265 $options->addMultiCommand(
267 $this->
lng->txt(
'save')
271 $this->tpl->setVariable(
'OPTIONS_TABLE', $options->getHTML());
279 if (!$this->rbac_system->checkAccess(
'write', $this->rolf_ref_id)) {
280 $this->error->raiseError($this->
lng->txt(
'msg_no_perm_perm'), $this->error->MESSAGE);
284 $template_permissions = [];
285 if ($this->
http->wrapper()->post()->has(
'template_perm')) {
286 $custom_transformer = $this->
refinery->custom()->transformation(
291 $template_permissions = $this->
http->wrapper()->post()->retrieve(
298 $subs = ilObjRole::getSubObjects(
'root',
false);
300 foreach (array_keys($subs) as $subtype) {
305 foreach ($template_permissions as
$key => $ops_array) {
310 $this->
object->update();
312 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"saved_successfully"),
true);
313 $this->
ctrl->redirect($this,
"perm");
319 if ($this->
http->wrapper()->post()->has(
'adopt')) {
320 $source = $this->
http->wrapper()->post()->retrieve(
326 if (!$this->rbac_system->checkAccess(
'write', $this->rolf_ref_id)) {
327 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_no_perm_perm'),
true);
328 } elseif ($this->obj_id ==
$source) {
329 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"msg_perm_adopted_from_itself"),
true);
331 $this->rbac_admin->deleteRolePermission($this->obj_id, $this->rolf_ref_id);
332 $parentRoles = $this->rbac_review->getParentRoleIds($this->rolf_ref_id,
true);
333 $this->rbac_admin->copyRoleTemplatePermissions(
335 $parentRoles[
$source][
"parent"],
340 $this->
object->update();
344 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_perm_adopted_from1") .
" '" . $title .
"'.<br/>" . $this->
lng->txt(
"msg_perm_adopted_from2"),
true);
346 $this->
ctrl->redirect($this,
"perm");
359 $this->tabs_gui->setBackTarget($this->
lng->txt(
'btn_back'), (string) $this->
ctrl->getParentReturn($this));
361 if ($this->rbac_system->checkAccess(
'write', $this->ref_id)) {
362 $this->tabs_gui->addTab(
364 $this->
lng->txt(
'settings'),
365 $this->
ctrl->getLinkTarget($this,
'edit')
368 if ($this->rbac_system->checkAccess(
'edit_permission', $this->ref_id)) {
369 $this->tabs_gui->addTab(
371 $this->
lng->txt(
'default_perm_settings'),
372 $this->
ctrl->getLinkTarget($this,
'perm')
379 $this->
ctrl->redirectByClass(
"ilobjrolefoldergui",
"view");
387 parent::addAdminLocatorItems(
true);
391 if (
$query->has(
'ref_id')) {
397 $this->
ctrl->getLinkTargetByClass(
"ilobjrolefoldergui",
"view")
401 if (
$query->has(
'obj_id')) {
404 $this->
ctrl->getLinkTarget($this,
'perm')
Interface GlobalHttpState.
addAdminLocatorItems(bool $do_not_add_object=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
prepareOutput(bool $show_sub_objects=true)
createObject()
create new object form
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjId(int $ref_id)
setValue(string $a_value)
static http()
Fetches the global http state from ILIAS.
static _lookupTitle(int $obj_id)
initFormRoleTemplate(int $a_mode=self::FORM_MODE_CREATE)
static _getTranslation(string $a_role_title)
Class ilObjectGUI Basic methods of all Output classes.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
header include for all ilias files.
__construct($a_data, int $a_id, bool $a_call_by_reference)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
This class represents a text area property in a property form.
Class ilObjRoleTemplateGUI.
Class ilRbacAdmin Core functions for role based access control.
static _lookupType(int $id, bool $reference=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
createObject(ilPropertyFormGUI $form=null)
editObject(ilPropertyFormGUI $form=null)
Create new object.