ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilCmiXapiAccess.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
31{
34
39 {
40 global $DIC;
41 $this->object = $object;
42 $this->access = $DIC->access();
43 }
44
45 public function hasLearningProgressAccess(): bool
46 {
47 return ilLearningProgressAccess::checkAccess($this->object->getRefId());
48 }
49
50 public function hasWriteAccess(?int $usrId = null): bool
51 {
52 if (isset($usrId)) {
53 return $this->access->checkAccessOfUser(
54 $usrId,
55 'write',
56 '',
57 $this->object->getRefId(),
58 $this->object->getType(),
59 $this->object->getId()
60 );
61 } else {
62 return $this->access->checkAccess(
63 'write',
64 '',
65 $this->object->getRefId(),
66 $this->object->getType(),
67 $this->object->getId()
68 );
69 }
70 }
71
72 public function hasEditPermissionsAccess(?int $usrId = null): bool
73 {
74 if (isset($usrId)) {
75 return $this->access->checkAccessOfUser(
76 $usrId,
77 'edit_permission',
78 '',
79 $this->object->getRefId(),
80 $this->object->getType(),
81 $this->object->getId()
82 );
83 } else {
84 return $this->access->checkAccess(
85 'edit_permission',
86 '',
87 $this->object->getRefId(),
88 $this->object->getType(),
89 $this->object->getId()
90 );
91 }
92 }
93
94 public function hasOutcomesAccess(?int $usrId = null): bool
95 {
96 if (isset($usrId)) {
97 return $this->access->checkAccessOfUser(
98 $usrId,
99 'read_outcomes',
100 '',
101 $this->object->getRefId(),
102 $this->object->getType(),
103 $this->object->getId()
104 );
105 } else {
106 return $this->access->checkAccess(
107 'read_outcomes',
108 '',
109 $this->object->getRefId(),
110 $this->object->getType(),
111 $this->object->getId()
112 );
113 }
114 }
115
116 public function hasStatementsAccess(): bool
117 {
118 if ($this->object->isStatementsReportEnabled()) {
119 return true;
120 }
121 return false;
122 }
123
124 public function hasHighscoreAccess(): bool
125 {
126 if ($this->object->getHighscoreEnabled()) {
127 return true;
128 }
129 return false;
130 }
131
133 {
134 return new self($object);
135 }
136}
hasWriteAccess(?int $usrId=null)
__construct(ilObjCmiXapi $object)
ilCmiXapiAccess constructor.
ilAccessHandler $access
static getInstance(ilObjCmiXapi $object)
hasOutcomesAccess(?int $usrId=null)
hasEditPermissionsAccess(?int $usrId=null)
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
global $DIC
Definition: shib_login.php:26