ILIAS  trunk Revision v11.0_alpha-1843-g9e1fad99175
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
PermissionStandardAdapter.php
Go to the documentation of this file.
1 <?php
2 
19 declare(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  $node_data = $this->tree->getNodeData($id);
46  $subtree_nodes = $this->tree->getSubTree($node_data);
47 
48  foreach ($subtree_nodes as $node) {
49  if ($node['type'] === 'rolf') {
50  continue;
51  }
52  if (!$this->access->checkAccess('delete', "", $node["child"])) {
53  $not_deletable[] = (int) $node["child"];
54  }
55  }
56  }
57  return $not_deletable;
58  }
59 
60  public function revokePermission(int $ref_id): void
61  {
62  $this->rbacadmin->revokePermission($ref_id);
63  }
64 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:65
__construct(protected \ilAccess $access, protected \ilRbacAdmin $rbacadmin, protected TreeInterface $tree)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Class ilRbacAdmin Core functions for role based access control.