19 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,
"components/ILIAS/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([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 = [];
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([$full_class,
"_getCommands"]);
218 $cmds[] = [
'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 = [];
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/> ";
332 $result_set[2][] = $text;
344 $ilAccess = $DIC[
'ilAccess'];
345 $ilObjDataCache = $DIC[
'ilObjDataCache'];
346 $objDefinition = $DIC[
'objDefinition'];
355 foreach ($ops_list as $ops) {
356 $access = $ilAccess->doRBACCheck(
359 $this->
object->getRefId(),
360 $this->
user->getId(),
361 $this->
object->getType()
364 $result_set[$counter][
"img"] = $access ? self::IMG_OK : self::IMG_NOT_OK;
366 if (substr($ops[
'operation'], 0, 7) ==
"create_" &&
367 $objDefinition->isPlugin(substr($ops[
'operation'], 7))) {
369 substr($ops[
'operation'], 7),
370 'obj_' . substr($ops[
'operation'], 7)
372 } elseif ($objDefinition->isPlugin($this->object->getType())) {
375 $this->
object->getType() .
"_" . $ops[
'operation']
377 } elseif (substr($ops[
'operation'], 0, 7) ==
'create_') {
378 $result_set[$counter][
"operation"] = $this->
lng->txt(
'rbac_' . $ops[
'operation']);
380 $result_set[$counter][
"operation"] = $this->
lng->txt($this->
object->getType() .
"_" . $ops[
'operation']);
386 if ($this->
user->getId() == $ilObjDataCache->lookupOwner($this->
object->getId())) {
388 (substr($ops[
'operation'], 0, 7) !==
'create_') and
389 ($ops[
'operation'] !==
'edit_permission') and
390 ($ops[
'operation'] !==
'edit_learning_progress')
392 $list_role[] = $this->
lng->txt(
'info_owner_of_object');
397 if (in_array($ops[
'ops_id'], $role[
'ops'])) {
398 $list_role[] = $role[
'translation'];
402 if (empty($list_role)) {
403 $list_role[] = $this->
lng->txt(
'none');
406 $result_set[$counter][
"role_ownership"] = $list_role;
421 $tree = $DIC[
'tree'];
423 $path = array_reverse($tree->getPathId($this->object->getRefId()));
428 foreach ($this->valid_roles as $role) {
429 $role_id = (
int) $role[
"obj_id"];
430 $result_set[$counter][
"img"] = in_array(
433 ) ? self::IMG_OK : self::IMG_NOT_OK;
435 if (is_subclass_of($this->
object, ilObjectPlugin::class) && $role[
"parent"] == $this->
object->getRefId()) {
447 if ($role[
'role_type'] !=
"linked") {
448 $result_set[$counter][
"effective_from"] =
"";
450 $rolfs = $this->rbacreview->getFoldersAssignedToRole($role_id);
453 foreach (
$path as $node) {
458 if (in_array($node, $rolfs)) {
459 $nodedata = $tree->getNodeData($node);
460 $result_set[$counter][
"effective_from"] = $nodedata[
"title"];
461 $result_set[$counter][
"effective_from_ref_id"] = $node;
467 if (in_array($role[
'obj_id'], $this->global_roles)) {
468 $result_set[$counter][
"original_position"] = $this->
lng->txt(
"global");
469 $result_set[$counter][
"original_position_ref_id"] =
false;
471 $rolf = $this->rbacreview->getFoldersAssignedToRole($role_id,
true);
472 $parent_node = $tree->getNodeData($rolf[0]);
473 if (!array_key_exists(
'ref_id', $parent_node)) {
474 unset($result_set[$counter]);
477 $result_set[$counter][
'original_position'] = $parent_node[
'title'];
478 $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)
Table for Acces Permissons in Permission > Permission of User.
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.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
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
Table for Available Roles in Permission > Permission of User.
This class displays the permission status of a user concerning a specific object. ...
getAssignedValidRoles()
get Assigned Valid Roles