ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
PermissionStandardAdapter.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24{
25 public function __construct(
26 protected \ilAccess $access,
27 protected \ilRbacAdmin $rbacadmin,
28 protected TreeInterface $tree
29 ) {
30 }
31
32 public function checkAccess(string $operation, int $ref_id): bool
33 {
34 return $this->access->checkAccess($operation, "", $ref_id);
35 }
36
37 public function getRefIdsWithoutDeletePermission(array $ids): array
38 {
39 $not_deletable = [];
40 foreach ($ids as $id) {
41 if (!$this->access->checkAccess('delete', "", $id)) {
42 $not_deletable[] = (int) $id;
43 }
44
45 if ($this->tree->isInTree($id)) {
46 $node_data = $this->tree->getNodeData($id);
47 $subtree_nodes = $this->tree->getSubTree($node_data);
48
49 foreach ($subtree_nodes as $node) {
50 if ($node['type'] === 'rolf') {
51 continue;
52 }
53 if (!$this->access->checkAccess('delete', "", $node["child"])) {
54 $not_deletable[] = (int) $node["child"];
55 }
56 }
57 }
58 }
59
60 return array_unique($not_deletable);
61 }
62
63 public function revokePermission(int $ref_id): void
64 {
65 $this->rbacadmin->revokePermission($ref_id);
66 }
67}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
__construct(protected \ilAccess $access, protected \ilRbacAdmin $rbacadmin, protected TreeInterface $tree)
Class ilAccessHandler Checks access for ILIAS objects.
Class ilRbacAdmin Core functions for role based access control.
$ref_id
Definition: ltiauth.php:66
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...