ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilLTIConsumerAccess.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 
15 {
20  protected $object;
21 
27  {
28  $this->object = $object;
29  }
30 
35  protected function checkAccess($permission)
36  {
37  global $DIC; /* @var \ILIAS\DI\Container $DIC */
38 
39  return $DIC->access()->checkAccess(
40  $permission,
41  '',
42  $this->object->getRefId(),
43  $this->object->getType(),
44  $this->object->getId()
45  );
46  }
47 
48  public function hasWriteAccess()
49  {
50  global $DIC; /* @var \ILIAS\DI\Container $DIC */
51 
52  return $this->checkAccess('write');
53  }
54 
55  public function hasOutcomesAccess()
56  {
57  if ($this->checkAccess('read_outcomes')) {
58  return true;
59  }
60 
61  return false;
62  }
63 
64  public function hasEditPermissionsAccess()
65  {
66  return $this->checkAccess('edit_permission');
67  }
68 
72  public function hasLearningProgressAccess()
73  {
74  return ilLearningProgressAccess::checkAccess($this->object->getRefId());
75  }
76 
80  public function hasStatementsAccess()
81  {
82  if (!$this->object->getUseXapi()) {
83  return false;
84  }
85 
86  if ($this->object->isStatementsReportEnabled()) {
87  return true;
88  }
89 
90  return $this->hasOutcomesAccess();
91  }
92 
96  public function hasHighscoreAccess()
97  {
98  if (!$this->object->getUseXapi()) {
99  return false;
100  }
101 
102  if ($this->object->getHighscoreEnabled()) {
103  return true;
104  }
105 
106  return $this->hasOutcomesAccess();
107  }
108 
113  public static function getInstance(ilObjLTIConsumer $object)
114  {
115  return new self($object);
116  }
117 
121  public static function hasCustomProviderCreationAccess()
122  {
123  global $DIC; /* @var \ILIAS\DI\Container $DIC */
124 
125  return $DIC->rbac()->system()->checkAccess(
126  'add_consume_provider',
128  );
129  }
130 }
static getInstance(ilObjLTIConsumer $object)
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress
static lookupLTISettingsRefId()
Lookup ref_id.
global $DIC
Definition: goto.php:24
__construct(ilObjLTIConsumer $object)
ilLTIConsumerAccess constructor.