ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjWikiAccess Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilObjWikiAccess:
+ Collaboration diagram for ilObjWikiAccess:

Public Member Functions

 __construct ()
 
 _checkAccess (string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id=null)
 
- Public Member Functions inherited from ilObjectAccess
 _checkAccess (string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id=null)
 Checks whether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess) More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 

Static Public Member Functions

static _getCommands ()
 
static _checkGoto (string $target)
 
static _lookupOnline (int $a_id)
 
static _lookupOnlineStatus (array $a_ids)
 see legacyOnlineFilter in ilContainer More...
 
static _lookupPublicFiles (int $a_id)
 Check wether files should be public. More...
 
- Static Public Member Functions inherited from ilObjectAccess
static _getCommands ()
 get commands More...
 
static _checkGoto (string $target)
 check whether goto script will succeed More...
 
static _isOffline (int $obj_id)
 Type-specific implementation of general status, has to be overwritten if object type does not support centralized offline handling. More...
 
static _preloadData (array $obj_ids, array $ref_ids)
 Preload data. More...
 

Protected Attributes

ilObjUser $user
 
ilLanguage $lng
 
ilRbacSystem $rbacsystem
 
ilAccessHandler $access
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 22 of file class.ilObjWikiAccess.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjWikiAccess::__construct ( )

Definition at line 29 of file class.ilObjWikiAccess.php.

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

30  {
31  global $DIC;
32 
33  $this->user = $DIC->user();
34  $this->lng = $DIC->language();
35  $this->rbacsystem = $DIC->rbac()->system();
36  $this->access = $DIC->access();
37  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ _checkAccess()

ilObjWikiAccess::_checkAccess ( string  $cmd,
string  $permission,
int  $ref_id,
int  $obj_id,
?int  $user_id = null 
)

Definition at line 51 of file class.ilObjWikiAccess.php.

References $access, $ilUser, $lng, $rbacsystem, $user, ilRbacSystem\checkAccessOfUser(), ilExcRepoObjAssignment\getInstance(), ilAccessInfo\IL_NO_OBJECT_ACCESS, ilAccessInfo\IL_STATUS_MESSAGE, and ilLanguage\txt().

51  : bool
52  {
54  $lng = $this->lng;
56  $ilAccess = $this->access;
57 
58  if (is_null($user_id)) {
59  $user_id = $ilUser->getId();
60  }
61 
62  switch ($cmd) {
63  case "view":
64 
65  if (!self::_lookupOnline($obj_id)
66  && !$rbacsystem->checkAccessOfUser($user_id, 'write', $ref_id)) {
67  $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
68  return false;
69  }
70  break;
71 
72  // for permission query feature
73  case "infoScreen":
74  if (!self::_lookupOnline($obj_id)) {
75  $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
76  } else {
77  $ilAccess->addInfoItem(ilAccessInfo::IL_STATUS_MESSAGE, $lng->txt("online"));
78  }
79  break;
80 
81  }
82  switch ($permission) {
83  case "read":
84  case "visible":
85  if (!self::_lookupOnline($obj_id) &&
86  (!$rbacsystem->checkAccessOfUser($user_id, 'write', $ref_id))) {
87  $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
88  return false;
89  }
90 
91  $info = ilExcRepoObjAssignment::getInstance()->getAccessInfo($ref_id, $user_id);
92  if (!$info->isGranted()) {
93  $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, implode(" / ", $info->getNotGrantedReasons()));
94  return false;
95  }
96  break;
97  }
98 
99  return true;
100  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
checkAccessOfUser(int $a_user_id, string $a_operations, int $a_ref_id, string $a_type="")
$ref_id
Definition: ltiauth.php:67
ilAccessHandler $access
$ilUser
Definition: imgupload.php:34
+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjWikiAccess::_checkGoto ( string  $target)
static

Definition at line 102 of file class.ilObjWikiAccess.php.

References $DIC, ilObject\_getAllReferences(), ILIAS\Repository\int(), and ilWikiPage\lookupWikiId().

102  : bool
103  {
104  global $DIC;
105 
106  $ilAccess = $DIC->access();
107  // echo "-".$target."-"; exit;
108  $t_arr = explode("_", $target);
109 
110  if ($t_arr[0] !== "wiki" || (((int) $t_arr[1]) <= 0) && $t_arr[1] !== "wpage") {
111  return false;
112  }
113 
114  if ($t_arr[1] === "wpage") {
115  $wpg_id = (int) $t_arr[2];
116  $w_id = ilWikiPage::lookupWikiId($wpg_id);
117  if ((int) ($t_arr[3] ?? 0) > 0) {
118  $refs = array((int) $t_arr[3]);
119  } else {
120  $refs = ilObject::_getAllReferences($w_id);
121  }
122  foreach ($refs as $r) {
123  if ($ilAccess->checkAccess("read", "", (int) $r) ||
124  $ilAccess->checkAccess("visible", "", (int) $r)) {
125  return true;
126  }
127  }
128  } elseif ($ilAccess->checkAccess("read", "", (int) $t_arr[1]) ||
129  $ilAccess->checkAccess("visible", "", (int) $t_arr[1])) {
130  return true;
131  }
132  return false;
133  }
static _getAllReferences(int $id)
get all reference ids for object ID
static lookupWikiId(int $a_page_id)
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

◆ _getCommands()

static ilObjWikiAccess::_getCommands ( )
static

Definition at line 40 of file class.ilObjWikiAccess.php.

Referenced by ilObjWikiListGUI\init().

40  : array
41  {
42  $commands = array(
43  array("permission" => "read", "cmd" => "view", "lang_var" => "show",
44  "default" => true),
45  array("permission" => "write", "cmd" => "editSettings", "lang_var" => "settings")
46  );
47 
48  return $commands;
49  }
+ Here is the caller graph for this function:

◆ _lookupOnline()

static ilObjWikiAccess::_lookupOnline ( int  $a_id)
static

Definition at line 135 of file class.ilObjWikiAccess.php.

References $DIC, and $ilDB.

Referenced by ilObjWikiListGUI\getProperties().

135  : bool
136  {
137  global $DIC;
138 
139  $ilDB = $DIC->database();
140 
141  $q = "SELECT * FROM il_wiki_data WHERE id = " .
142  $ilDB->quote($a_id, "integer");
143  $wk_set = $ilDB->query($q);
144  $wk_rec = $ilDB->fetchAssoc($wk_set);
145 
146  return (bool) $wk_rec["is_online"];
147  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ _lookupOnlineStatus()

static ilObjWikiAccess::_lookupOnlineStatus ( array  $a_ids)
static

see legacyOnlineFilter in ilContainer

Deprecated:

Definition at line 153 of file class.ilObjWikiAccess.php.

References $DIC, $ilDB, and $lm_set.

Referenced by ilContainer\legacyOnlineFilter().

153  : array
154  {
155  global $DIC;
156 
157  $ilDB = $DIC->database();
158 
159  $q = "SELECT id, is_online FROM il_wiki_data WHERE " .
160  $ilDB->in("id", $a_ids, false, "integer");
161  $lm_set = $ilDB->query($q);
162  $status = [];
163  while ($r = $ilDB->fetchAssoc($lm_set)) {
164  $status[$r["id"]] = (bool) $r["is_online"];
165  }
166  return $status;
167  }
global $DIC
Definition: feed.php:28
$lm_set
+ Here is the caller graph for this function:

◆ _lookupPublicFiles()

static ilObjWikiAccess::_lookupPublicFiles ( int  $a_id)
static

Check wether files should be public.

Definition at line 173 of file class.ilObjWikiAccess.php.

References $DIC, and $ilDB.

173  : bool
174  {
175  global $DIC;
176 
177  $ilDB = $DIC->database();
178 
179  $q = "SELECT * FROM il_wiki_data WHERE id = " .
180  $ilDB->quote($a_id, "integer");
181  $wk_set = $ilDB->query($q);
182  $wk_rec = $ilDB->fetchAssoc($wk_set);
183 
184  return (bool) $wk_rec["public_files"];
185  }
global $DIC
Definition: feed.php:28

Field Documentation

◆ $access

ilAccessHandler ilObjWikiAccess::$access
protected

Definition at line 27 of file class.ilObjWikiAccess.php.

Referenced by _checkAccess().

◆ $lng

ilLanguage ilObjWikiAccess::$lng
protected

Definition at line 25 of file class.ilObjWikiAccess.php.

Referenced by _checkAccess().

◆ $rbacsystem

ilRbacSystem ilObjWikiAccess::$rbacsystem
protected

Definition at line 26 of file class.ilObjWikiAccess.php.

Referenced by _checkAccess().

◆ $user

ilObjUser ilObjWikiAccess::$user
protected

Definition at line 24 of file class.ilObjWikiAccess.php.

Referenced by _checkAccess().


The documentation for this class was generated from the following file: