3 declare(strict_types=1);
54 $this->
lng = $DIC->language();
55 $this->
ctrl = $DIC->ctrl();
56 $this->tpl = $DIC->ui()->mainTemplate();
57 $this->
object = $a_obj;
58 $this->rbacreview = $DIC->rbac()->review();
59 $this->
toolbar = $DIC->toolbar();
62 $this->user_roles = $this->rbacreview->assignedRoles($this->
user->getId());
63 $this->global_roles = $this->rbacreview->getGlobalRoles();
64 $this->valid_roles = $this->rbacreview->getParentRoleIds($this->
object->getRefId());
74 $next_class = $this->
ctrl->getNextClass($this);
76 switch ($next_class) {
77 case 'ilrepositorysearchgui':
79 $this->
ctrl->setReturn($this,
'perminfo');
80 $this->
ctrl->forwardCommand($rep_search);
84 $cmd = $this->
ctrl->getCmd();
96 $tpl =
new ilTemplate(
"tpl.info_layout.html",
false,
false,
"Services/AccessControl");
101 $tpl->
setVariable(
"INFO_REMARK_INTERRUPTED", $this->
lng->txt(
'info_remark_interrupted'));
102 $this->tpl->setVariable(
"ADM_CONTENT", $tpl->
get());
111 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($this,
"perminfo"));
112 $this->
toolbar->addText($this->
lng->txt(
'user'));
115 $login->setDataSource($this->
ctrl->getLinkTargetByClass(array(get_class($this),
116 'ilRepositorySearchGUI' 117 ),
'doUserAutoComplete',
'',
true));
119 $login->setValue($this->
user->getLogin());
120 $this->
toolbar->addInputItem($login);
121 $this->
toolbar->addFormButton($this->
lng->txt(
"info_change_user_view"),
"perminfo");
130 $info->setFormAction($this->
ctrl->getFormAction($this));
132 $info->addSection($this->
lng->txt(
"info_access_and_status_info"));
138 return $info->getHTML();
149 $table->setTitle($this->
lng->txt(
"info_access_permissions"));
151 return $table->getHTML();
163 $table->setTitle($this->
lng->txt(
"info_available_roles"));
165 return $table->getHTML();
173 $assigned_valid_roles = array();
176 foreach ($this->valid_roles as $role) {
177 $role_id = (
int) $role[
"obj_id"];
178 if (in_array($role_id, $this->user_roles)) {
183 foreach ($ops_list as $ops_data) {
184 $ops[] = (
int) $ops_data[
'ops_id'];
189 $role[
'ops'] = $this->rbacreview->getRoleOperationsOnObject(
196 $assigned_valid_roles[] = $role;
210 $objDefinition = $DIC[
'objDefinition'];
212 $class = $objDefinition->getClassName($a_type);
213 $location = $objDefinition->getLocation($a_type);
214 $full_class =
"ilObj" . $class .
"Access";
216 $cmds = call_user_func(array($full_class,
"_getCommands"));
218 $cmds[] = array(
'permission' =>
'visible',
'cmd' =>
'info');
231 if ($DIC->http()->wrapper()->post()->has(
'user_login')) {
232 $user_login = $DIC->http()->wrapper()->post()->retrieve(
234 $DIC->refinery()->kindlyTo()->string()
237 if (!strlen($user_login)) {
243 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'info_err_user_not_exist'));
246 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'info_user_view_changed'));
257 $ilAccess = $DIC[
'ilAccess'];
260 $result_set[0][] = $this->
lng->txt(
'user');
261 $result_set[0][] = $this->
user->getFullname() .
" (#" . $this->
user->getId() .
")";
263 $assigned_valid_roles = array();
266 $assigned_valid_roles[] = $role[
"translation"];
269 $roles_str = implode(
", ", $assigned_valid_roles);
271 $result_set[1][] = $this->
lng->txt(
"roles");
272 $result_set[1][] = $roles_str;
274 $result_set[2][] = $this->
lng->txt(
"status");
277 $ilAccess->checkAccessOfUser(
278 $this->
user->getId(),
281 $this->
object->getRefId(),
282 $this->
object->getType(),
283 $this->
object->getId()
286 $infos = array_merge($infos, $ilAccess->getInfo());
290 foreach ($cmds as $cmd) {
291 if (count($cmd) === 0) {
295 $ilAccess->doStatusCheck(
298 $this->
object->getRefId(),
299 $this->
user->getId(),
300 $this->
object->getId(),
301 $this->
object->getType()
303 $infos = array_merge($infos, $ilAccess->getInfo());
306 $alert =
"il_ItemAlertProperty";
307 $okay =
"il_ItemOkayProperty";
311 $text =
"<span class=\"" . $okay .
"\">" . $this->
lng->txt(
"access") .
"</span><br/> ";
313 foreach ($infos as $info) {
314 switch ($info[
'type']) {
316 $text .=
"<span class=\"" . $okay .
"\">" . $info[
'text'] .
"</span><br/> ";
321 $obj =
$factory->getInstanceByRefId((
int) $info[
'data']);
322 $text .=
"<span class=\"" . $alert .
"\">" . $info[
'text'] .
" (" . $this->
lng->txt(
"obj_" . $obj->getType()) .
" #" . $obj->getId() .
": " . $obj->getTitle() .
")</span><br/> ";
326 $text .=
"<span class=\"" . $alert .
"\">" . $info[
'text'] .
"</span><br/> ";
333 $result_set[2][] = $text;
345 $ilAccess = $DIC[
'ilAccess'];
346 $ilObjDataCache = $DIC[
'ilObjDataCache'];
347 $objDefinition = $DIC[
'objDefinition'];
353 $result_set = array();
356 foreach ($ops_list as $ops) {
357 $access = $ilAccess->doRBACCheck(
360 $this->
object->getRefId(),
361 $this->
user->getId(),
362 $this->
object->getType()
365 $result_set[$counter][
"img"] = $access ? self::IMG_OK : self::IMG_NOT_OK;
367 if (substr($ops[
'operation'], 0, 7) ==
"create_" &&
368 $objDefinition->isPlugin(substr($ops[
'operation'], 7))) {
370 substr($ops[
'operation'], 7),
371 'obj_' . substr($ops[
'operation'], 7)
373 } elseif ($objDefinition->isPlugin($this->object->getType())) {
376 $this->
object->getType() .
"_" . $ops[
'operation']
378 } elseif (substr($ops[
'operation'], 0, 7) ==
'create_') {
379 $result_set[$counter][
"operation"] = $this->
lng->txt(
'rbac_' . $ops[
'operation']);
381 $result_set[$counter][
"operation"] = $this->
lng->txt($this->
object->getType() .
"_" . $ops[
'operation']);
387 if ($this->
user->getId() == $ilObjDataCache->lookupOwner($this->
object->getId())) {
389 (substr($ops[
'operation'], 0, 7) !=
'create_') and
390 ($ops[
'operation'] !=
'edit_permission') and
391 ($ops[
'operation'] !=
'edit_leanring_progress')
393 $list_role[] = $this->
lng->txt(
'info_owner_of_object');
398 if (in_array($ops[
'ops_id'], $role[
'ops'])) {
399 $list_role[] = $role[
'translation'];
403 if (empty($list_role)) {
404 $list_role[] = $this->
lng->txt(
'none');
407 $result_set[$counter][
"role_ownership"] = $list_role;
422 $tree = $DIC[
'tree'];
424 $path = array_reverse($tree->getPathId($this->object->getRefId()));
429 foreach ($this->valid_roles as $role) {
430 $role_id = (
int) $role[
"obj_id"];
431 $result_set[$counter][
"img"] = in_array(
434 ) ? self::IMG_OK : self::IMG_NOT_OK;
436 if (is_subclass_of($this->
object, ilObjectPlugin::class) && $role[
"parent"] == $this->
object->getRefId()) {
448 if ($role[
'role_type'] !=
"linked") {
449 $result_set[$counter][
"effective_from"] =
"";
451 $rolfs = $this->rbacreview->getFoldersAssignedToRole($role_id);
454 foreach (
$path as $node) {
459 if (in_array($node, $rolfs)) {
460 $nodedata = $tree->getNodeData($node);
461 $result_set[$counter][
"effective_from"] = $nodedata[
"title"];
462 $result_set[$counter][
"effective_from_ref_id"] = $node;
468 if (in_array($role[
'obj_id'], $this->global_roles)) {
469 $result_set[$counter][
"original_position"] = $this->
lng->txt(
"global");
470 $result_set[$counter][
"original_position_ref_id"] =
false;
472 $rolf = $this->rbacreview->getFoldersAssignedToRole($role_id,
true);
473 $parent_node = $tree->getNodeData($rolf[0]);
474 if (!array_key_exists(
'ref_id', $parent_node)) {
475 unset($result_set[$counter]);
478 $result_set[$counter][
'original_position'] = $parent_node[
'title'];
479 $result_set[$counter][
'original_position_ref_id'] = $parent_node[
'ref_id'];
getAvailableRolesTableData()
Available Roles Table Data.
getAccessStatusInfoData()
Access Status Info Data.
const IL_NO_PARENT_ACCESS
addToolbar()
Creates Toolbar entries.
static _removeObjectId(string $a_role_title)
$location
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...
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
availableRolesTable()
Available Roles Table.
getCommands(string $a_type)
get Commands
static _lookupId($a_user_str)
setVariable(string $variable, $value='')
Sets the given variable to the given value.
getAccessPermissionTableData()
Access Permissions Table Data.
static _getOperationList(string $a_type='')
get operation list by object type
array $assigned_valid_roles
accessStatusInfo()
Access- and Statusinformation Info.
__construct(ilObject $a_obj)
Constructor public.
static _getTranslation(string $a_role_title)
accessPermissionsTable()
Access Permissions Table.
static lookupTxtById(string $plugin_id, string $lang_var)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
ilGlobalTemplateInterface $tpl
executeCommand()
execute command
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...
getAssignedValidRoles()
get Assigned Valid Roles