ILIAS  release_8 Revision v8.23
ilObjBibliographicAccess 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 ilObjBibliographicAccess:
+ Collaboration diagram for ilObjBibliographicAccess:

Public Member Functions

 _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...
 
- 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 ()
 get commands More...
 
static _checkGoto (string $target)
 
static _lookupOnline (int $a_id)
 Check wether bibliographic is online or not. 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...
 

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 Class ilObjBibliographicAccess

Author
Oskar Truffer ot@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Gabriel Comte gc@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

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

Member Function Documentation

◆ _checkAccess()

ilObjBibliographicAccess::_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)

Definition at line 72 of file class.ilObjBibliographicAccess.php.

References $DIC, $ilUser, $lng, ilAccessInfo\IL_NO_OBJECT_ACCESS, ilAccessInfo\IL_STATUS_MESSAGE, and ilObjBibliographicGUI\P_ENTRY_ID.

72  : bool
73  {
74  global $DIC;
75  $ilUser = $DIC['ilUser'];
76  $lng = $DIC['lng'];
77  $rbacsystem = $DIC['rbacsystem'];
78  $ilAccess = $DIC['ilAccess'];
79  if (is_null($user_id)) {
80  $user_id = $ilUser->getId();
81  }
82 
83  if ($DIC->http()->wrapper()->query()->has(ilObjBibliographicGUI::P_ENTRY_ID)) {
84  $entry_id = $DIC->http()->wrapper()->query()->retrieve(
86  $DIC->refinery()->kindlyTo()->int()
87  );
88  if (!self::checkEntryIdMatch($obj_id, $entry_id)) {
89  return false;
90  }
91  }
92 
93  switch ($cmd) {
94  case "view":
95  if (!self::_lookupOnline($obj_id)
96  && !$rbacsystem->checkAccessOfUser($user_id, 'write', $ref_id)
97  ) {
98  $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
99 
100  return false;
101  }
102  break;
103  // for permission query feature
104  case "infoScreen":
105  if (!self::_lookupOnline($obj_id)) {
106  $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
107  } else {
108  $ilAccess->addInfoItem(ilAccessInfo::IL_STATUS_MESSAGE, $lng->txt("online"));
109  }
110  break;
111  }
112  switch ($permission) {
113  case "read":
114  case "visible":
115  if (!self::_lookupOnline($obj_id)
116  && (!$rbacsystem->checkAccessOfUser($user_id, 'write', $ref_id))
117  ) {
118  $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
119 
120  return false;
121  }
122  break;
123  }
124 
125  return true;
126  }
$lng
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67
$ilUser
Definition: imgupload.php:34

◆ _checkGoto()

static ilObjBibliographicAccess::_checkGoto ( string  $target)
static

Definition at line 56 of file class.ilObjBibliographicAccess.php.

References $DIC.

56  : bool
57  {
58  global $DIC;
59  $ilAccess = $DIC['ilAccess'];
60  $t_arr = explode('_', $target);
61  if ($t_arr[0] != 'bibl' || ((int) $t_arr[1]) <= 0) {
62  return false;
63  }
64  return (bool) $ilAccess->checkAccess('read', '', $t_arr[1]);
65  }
global $DIC
Definition: feed.php:28

◆ _getCommands()

static ilObjBibliographicAccess::_getCommands ( )
static

get commands

this method returns an array of all possible commands/permission combinations

example: $commands = array ( array("permission" => "read", "cmd" => "view", "lang_var" => "show"), array("permission" => "write", "cmd" => "edit", "lang_var" => "edit"), );

Returns
array<int, array<string, string>>|array<int, array<string, string|bool>>

Definition at line 41 of file class.ilObjBibliographicAccess.php.

Referenced by ilObjBibliographicListGUI\init().

41  : array
42  {
43  return array(
44  array(
45  "permission" => "read",
46  "cmd" => "render",
47  "lang_var" => "show",
48  "default" => true,
49  ),
50  array("permission" => "write", "cmd" => "view", "lang_var" => "edit_content"),
51  array("permission" => "write", "cmd" => "edit", "lang_var" => "settings"),
52  );
53  }
+ Here is the caller graph for this function:

◆ _lookupOnline()

static ilObjBibliographicAccess::_lookupOnline ( int  $a_id)
static

Check wether bibliographic is online or not.

Definition at line 146 of file class.ilObjBibliographicAccess.php.

References $DIC, and $ilDB.

Referenced by ilObjBibliographicListGUI\getProperties().

146  : bool
147  {
148  global $DIC;
149  $ilDB = $DIC['ilDB'];
150  $q = "SELECT is_online FROM il_bibl_data WHERE id = " . $ilDB->quote($a_id, "integer");
151  $bibl_set = $ilDB->query($q);
152  $bibl_rec = $ilDB->fetchAssoc($bibl_set);
153 
154  return (bool) $bibl_rec["is_online"] ?? false;
155  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

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