ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.SkillTreeAccess.php
Go to the documentation of this file.
1 <?php
2 
20 namespace ILIAS\Skill\Access;
21 
27 {
28  protected \ilRbacSystem $access;
29  protected int $ref_id = 0;
30  protected string $obj_type = "";
31  protected int $usr_id = 0;
32 
33  public function __construct(\ilRbacSystem $access, int $ref_id, int $usr_id)
34  {
35  $this->access = $access;
36  $this->ref_id = $ref_id;
37  $this->obj_type = \ilObject::_lookupType($this->ref_id, true);
38  $this->usr_id = $usr_id;
39  }
40 
41  public function hasVisibleTreePermission(int $a_usr_id = 0): bool
42  {
43  if ($a_usr_id == 0) {
44  $a_usr_id = $this->usr_id;
45  }
46  return $this->access->checkAccessOfUser($a_usr_id, "visible", $this->ref_id);
47  }
48 
49  public function hasReadTreePermission(int $a_usr_id = 0): bool
50  {
51  if ($a_usr_id == 0) {
52  $a_usr_id = $this->usr_id;
53  }
54  return $this->access->checkAccessOfUser($a_usr_id, "read", $this->ref_id);
55  }
56 
57  public function hasEditTreeSettingsPermission(int $a_usr_id = 0): bool
58  {
59  if ($a_usr_id == 0) {
60  $a_usr_id = $this->usr_id;
61  }
62  return $this->access->checkAccessOfUser($a_usr_id, "write", $this->ref_id);
63  }
64 
65  public function hasEditTreePermissionsPermission(int $a_usr_id = 0): bool
66  {
67  if ($a_usr_id == 0) {
68  $a_usr_id = $this->usr_id;
69  }
70  return $this->access->checkAccessOfUser($a_usr_id, "edit_permission", $this->ref_id);
71  }
72 
73  public function hasReadCompetencesPermission(int $a_usr_id = 0): bool
74  {
75  if ($a_usr_id == 0) {
76  $a_usr_id = $this->usr_id;
77  }
78  return $this->access->checkAccessOfUser($a_usr_id, "read_comp", $this->ref_id);
79  }
80 
81  public function hasManageCompetencesPermission(int $a_usr_id = 0): bool
82  {
83  if ($a_usr_id == 0) {
84  $a_usr_id = $this->usr_id;
85  }
86  return $this->access->checkAccessOfUser($a_usr_id, "manage_comp", $this->ref_id);
87  }
88 
89  public function hasManageCompetenceTemplatesPermission(int $a_usr_id = 0): bool
90  {
91  if ($a_usr_id == 0) {
92  $a_usr_id = $this->usr_id;
93  }
94  return $this->access->checkAccessOfUser($a_usr_id, "manage_comp_temp", $this->ref_id);
95  }
96 
97  public function hasReadProfilesPermission(int $a_usr_id = 0): bool
98  {
99  if ($a_usr_id == 0) {
100  $a_usr_id = $this->usr_id;
101  }
102  if ($this->obj_type == "crs" || $this->obj_type == "grp") {
103  return $this->access->checkAccessOfUser($a_usr_id, "read", $this->ref_id);
104  }
105  return $this->access->checkAccessOfUser($a_usr_id, "read_profiles", $this->ref_id);
106  }
107 
108  public function hasManageProfilesPermission(int $a_usr_id = 0): bool
109  {
110  if ($a_usr_id == 0) {
111  $a_usr_id = $this->usr_id;
112  }
113  if ($this->obj_type == "crs" || $this->obj_type == "grp") {
114  return $this->access->checkAccessOfUser($a_usr_id, "write", $this->ref_id);
115  }
116  return $this->access->checkAccessOfUser($a_usr_id, "manage_profiles", $this->ref_id);
117  }
118 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(\ilRbacSystem $access, int $ref_id, int $usr_id)
static _lookupType(int $id, bool $reference=false)