ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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: shib_login.php:22
+ 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, $lng, $rbacsystem, $user, $user_id, ilRbacSystem\checkAccessOfUser(), ilExcRepoObjAssignment\getInstance(), ilAccessInfo\IL_NO_OBJECT_ACCESS, ilAccessInfo\IL_STATUS_MESSAGE, and ilLanguage\txt().

51  : bool
52  {
53  $ilUser = $this->user;
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)
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  switch ($permission) {
82  case "read":
83  case "visible":
84  if (self::_isOffline($obj_id) &&
86  $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
87  return false;
88  }
89 
90  $info = ilExcRepoObjAssignment::getInstance()->getAccessInfo($ref_id, $user_id);
91  if (!$info->isGranted()) {
92  $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, implode(" / ", $info->getNotGrantedReasons()));
93  return false;
94  }
95  break;
96  }
97 
98  return true;
99  }
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:65
ilAccessHandler $access
+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjWikiAccess::_checkGoto ( string  $target)
static

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

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

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

134  : bool
135  {
136  return !self::_isOffline($a_id);
137  }

◆ _lookupOnlineStatus()

static ilObjWikiAccess::_lookupOnlineStatus ( array  $a_ids)
static

see legacyOnlineFilter in ilContainer

Deprecated:

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

References $id.

Referenced by ILIAS\UI\Component\Legacy\Content\Filter\FilterManager\legacyOnlineFilter().

143  : array
144  {
145  $status = [];
146  foreach ($a_ids as $id) {
147  $status[$id] = !self::_isOffline($id);
148  }
149  return $status;
150  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ 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 156 of file class.ilObjWikiAccess.php.

References $DIC, $ilDB, and $q.

156  : bool
157  {
158  global $DIC;
159 
160  $ilDB = $DIC->database();
161 
162  $q = "SELECT * FROM il_wiki_data WHERE id = " .
163  $ilDB->quote($a_id, "integer");
164  $wk_set = $ilDB->query($q);
165  $wk_rec = $ilDB->fetchAssoc($wk_set);
166 
167  return (bool) $wk_rec["public_files"];
168  }
global $DIC
Definition: shib_login.php:22
$q
Definition: shib_logout.php:21

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: