ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilCmiXapiAccess.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 
16 {
20  protected $object;
21  protected $access;
22 
27  public function __construct(ilObjCmiXapi $object)
28  {
29  global $DIC;
30  $this->object = $object;
31  $this->access = $DIC->access();
32  }
33 
37  public function hasLearningProgressAccess()
38  {
39  return ilLearningProgressAccess::checkAccess($this->object->getRefId());
40  }
41 
45  public function hasWriteAccess($usrId = null)
46  {
47  if (isset($usrId)) {
48  return $this->access->checkAccessOfUser(
49  $usrId,
50  'write',
51  '',
52  $this->object->getRefId(),
53  $this->object->getType(),
54  $this->object->getId()
55  );
56  } else {
57  return $this->access->checkAccess(
58  'write',
59  '',
60  $this->object->getRefId(),
61  $this->object->getType(),
62  $this->object->getId()
63  );
64  }
65  }
66 
70  public function hasEditPermissionsAccess($usrId = null)
71  {
72  if (isset($usrId)) {
73  return $this->access->checkAccessOfUser(
74  $usrId,
75  'edit_permission',
76  '',
77  $this->object->getRefId(),
78  $this->object->getType(),
79  $this->object->getId()
80  );
81  } else {
82  return $this->access->checkAccess(
83  'edit_permission',
84  '',
85  $this->object->getRefId(),
86  $this->object->getType(),
87  $this->object->getId()
88  );
89  }
90  }
91 
95  public function hasOutcomesAccess($usrId = null)
96  {
97  global $DIC; /* @var \ILIAS\DI\Container $DIC */
98 
99  if (isset($usrId)) {
100  return $this->access->checkAccessOfUser(
101  $usrId,
102  'read_outcomes',
103  '',
104  $this->object->getRefId(),
105  $this->object->getType(),
106  $this->object->getId()
107  );
108  } else {
109  return $this->access->checkAccess(
110  'read_outcomes',
111  '',
112  $this->object->getRefId(),
113  $this->object->getType(),
114  $this->object->getId()
115  );
116  }
117  }
118 
122  public function hasStatementsAccess()
123  {
124  if ($this->object->isStatementsReportEnabled()) {
125  return true;
126  }
127 
128  return false;
129  }
130 
134  public function hasHighscoreAccess()
135  {
136  if ($this->object->getHighscoreEnabled()) {
137  return true;
138  }
139 
140  return false;
141  }
142 
147  public static function getInstance(ilObjCmiXapi $object)
148  {
149  return new self($object);
150  }
151 }
static getInstance(ilObjCmiXapi $object)
hasEditPermissionsAccess($usrId=null)
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress
global $DIC
Definition: goto.php:24
hasOutcomesAccess($usrId=null)
__construct(ilObjCmiXapi $object)
ilCmiXapiAccess constructor.
hasWriteAccess($usrId=null)