ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilLTIConsumerAccess.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
30{
31 public const GLOBAL_ADMIN_ROLE_ID = 2;
36
41 {
42 $this->object = $object;
43 }
44
45 protected function checkAccess(string $permission): bool
46 {
47 global $DIC; /* @var \ILIAS\DI\Container $DIC */
48
49 return $DIC->access()->checkAccess(
50 $permission,
51 '',
52 $this->object->getRefId(),
53 $this->object->getType(),
54 $this->object->getId()
55 );
56 }
57
58 public function hasWriteAccess(): bool
59 {
60 global $DIC; /* @var \ILIAS\DI\Container $DIC */
61
62 return $this->checkAccess('write');
63 }
64
65 public function hasOutcomesAccess(): bool
66 {
67 return $this->checkAccess('read_outcomes');
68 }
69
70 public function hasEditPermissionsAccess(): bool
71 {
72 return $this->checkAccess('edit_permission');
73 }
74
75 public function hasLearningProgressAccess(): bool
76 {
77 return ilLearningProgressAccess::checkAccess($this->object->getRefId());
78 }
79
80 public function hasStatementsAccess(): bool
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
93 public function hasHighscoreAccess(): bool
94 {
95 // Todo -check
96 if (!$this->object->getUseXapi()) {
97 return false;
98 }
99
100 if ($this->object->getHighscoreEnabled()) {
101 return true;
102 }
103
104 return $this->hasOutcomesAccess();
105 }
106
108 {
109 return new self($object);
110 }
111
112 public static function hasCustomProviderCreationAccess(): bool
113 {
114 global $DIC; /* @var \ILIAS\DI\Container $DIC */
115
116 return $DIC->rbac()->system()->checkAccess(
117 'add_consume_provider',
119 );
120 }
121}
static getInstance(ilObjLTIConsumer $object)
__construct(ilObjLTIConsumer $object)
ilLTIConsumerAccess constructor.
checkAccess(string $permission)
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
static lookupLTISettingsRefId()
Lookup ref_id.
global $DIC
Definition: shib_login.php:26