ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
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 global $DIC; /* @var \ILIAS\DI\Container $DIC */
48
49 if (isset($usrId)) {
50 return $this->access->checkAccessOfUser(
51 $usrId,
52 'write',
53 '',
54 $this->object->getRefId(),
55 $this->object->getType(),
56 $this->object->getId()
57 );
58 } else {
59 return $this->access->checkAccess(
60 'write',
61 '',
62 $this->object->getRefId(),
63 $this->object->getType(),
64 $this->object->getId()
65 );
66 }
67 }
68
72 public function hasEditPermissionsAccess($usrId = null)
73 {
74 global $DIC; /* @var \ILIAS\DI\Container $DIC */
75
76 if (isset($usrId)) {
77 return $this->access->checkAccessOfUser(
78 $usrId,
79 'edit_permission',
80 '',
81 $this->object->getRefId(),
82 $this->object->getType(),
83 $this->object->getId()
84 );
85 } else {
86 return $this->access->checkAccess(
87 'edit_permission',
88 '',
89 $this->object->getRefId(),
90 $this->object->getType(),
91 $this->object->getId()
92 );
93 }
94 }
95
99 public function hasOutcomesAccess($usrId = null)
100 {
101 global $DIC; /* @var \ILIAS\DI\Container $DIC */
102
103 if (isset($usrId)) {
104 return $this->access->checkAccessOfUser(
105 $usrId,
106 'read_outcomes',
107 '',
108 $this->object->getRefId(),
109 $this->object->getType(),
110 $this->object->getId()
111 );
112 } else {
113 return $this->access->checkAccess(
114 'read_outcomes',
115 '',
116 $this->object->getRefId(),
117 $this->object->getType(),
118 $this->object->getId()
119 );
120 }
121 }
122
126 public function hasStatementsAccess()
127 {
128 if ($this->object->isStatementsReportEnabled()) {
129 return true;
130 }
131
132 return false;
133 }
134
138 public function hasHighscoreAccess()
139 {
140 if ($this->object->getHighscoreEnabled()) {
141 return true;
142 }
143
144 return false;
145 }
146
151 public static function getInstance(ilObjCmiXapi $object)
152 {
153 return new self($object);
154 }
155}
An exception for terminatinating execution or to throw for unit testing.
__construct(ilObjCmiXapi $object)
ilCmiXapiAccess constructor.
hasOutcomesAccess($usrId=null)
hasEditPermissionsAccess($usrId=null)
static getInstance(ilObjCmiXapi $object)
hasWriteAccess($usrId=null)
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress
$DIC
Definition: xapitoken.php:46