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

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 _lookupOnline (int $a_id)
 
static _lookupOnlineStatus (array $a_ids)
 
static _checkGoto (string $target)
 
- 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 Class ilObjGlossaryAccess

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

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

Constructor & Destructor Documentation

◆ __construct()

ilObjGlossaryAccess::__construct ( )

Definition at line 31 of file class.ilObjGlossaryAccess.php.

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

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

Member Function Documentation

◆ _checkAccess()

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

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

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

41  : bool
42  {
44  $lng = $this->lng;
46  $ilAccess = $this->access;
47 
48  if (is_null($user_id)) {
49  $user_id = $ilUser->getId();
50  }
51 
52  switch ($permission) {
53  case "read":
54  if (!self::_lookupOnline($obj_id)
55  && !$rbacsystem->checkAccessOfUser($user_id, 'write', $ref_id)) {
56  $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
57  return false;
58  }
59  break;
60 
61  case "visible":
62  if (!self::_lookupOnline($obj_id) &&
63  (!$rbacsystem->checkAccessOfUser($user_id, 'write', $ref_id))) {
64  $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
65  return false;
66  }
67  break;
68  }
69 
70 
71  return true;
72  }
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
$ilUser
Definition: imgupload.php:34
+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjGlossaryAccess::_checkGoto ( string  $target)
static

Definition at line 124 of file class.ilObjGlossaryAccess.php.

References $DIC, $ref_id, ilObject\_getAllReferences(), and ilGlossaryTerm\_lookGlossaryID().

124  : bool
125  {
126  global $DIC;
127 
128  $ilAccess = $DIC->access();
129 
130  $t_arr = explode("_", $target);
131 
132  if (($t_arr[0] != "glo" && $t_arr[0] != "git") || ((int) $t_arr[1]) <= 0) {
133  return false;
134  }
135 
136  if ($t_arr[0] == "glo") {
137  if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
138  $ilAccess->checkAccess("visible", "", $t_arr[1])) {
139  return true;
140  }
141  }
142 
143  if ($t_arr[0] == "git") {
144  if ((int) ($t_arr[2] ?? 0) > 0) {
145  $ref_ids = array($t_arr[2]);
146  } else {
147  // determine learning object
148  $glo_id = ilGlossaryTerm::_lookGlossaryID((int) $t_arr[1]);
149  $ref_ids = ilObject::_getAllReferences($glo_id);
150  }
151  // check read permissions
152  foreach ($ref_ids as $ref_id) {
153  // Permission check
154  if ($ilAccess->checkAccess("read", "", $ref_id)) {
155  return true;
156  }
157  }
158  }
159 
160  return false;
161  }
static _getAllReferences(int $id)
get all reference ids for object ID
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67
static _lookGlossaryID(int $term_id)
get glossary id form term id
+ Here is the call graph for this function:

◆ _getCommands()

static ilObjGlossaryAccess::_getCommands ( )
static

Definition at line 74 of file class.ilObjGlossaryAccess.php.

Referenced by ilObjGlossaryListGUI\init().

74  : array
75  {
76  $commands = array(
77  array("permission" => "read", "cmd" => "view", "lang_var" => "show",
78  "default" => true),
79  array("permission" => "write", "cmd" => "edit", "lang_var" => "edit_content"),
80  array("permission" => "edit_content", "cmd" => "edit", "lang_var" => "edit_content"), // #11099
81  array("permission" => "write", "cmd" => "properties", "lang_var" => "settings")
82  );
83 
84  return $commands;
85  }
+ Here is the caller graph for this function:

◆ _lookupOnline()

static ilObjGlossaryAccess::_lookupOnline ( int  $a_id)
static

Definition at line 91 of file class.ilObjGlossaryAccess.php.

References $DIC, $ilDB, $lm_set, and ilUtil\yn2tf().

Referenced by ilObjGlossaryListGUI\getProperties().

91  : bool
92  {
93  global $DIC;
94 
95  $ilDB = $DIC->database();
96 
97  $q = "SELECT * FROM glossary WHERE id = " .
98  $ilDB->quote($a_id, "integer");
99  $lm_set = $ilDB->query($q);
100  if ($lm_rec = $ilDB->fetchAssoc($lm_set)) {
101  return ilUtil::yn2tf($lm_rec["is_online"]);
102  }
103  return false;
104  }
global $DIC
Definition: feed.php:28
$lm_set
static yn2tf(string $a_yn)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupOnlineStatus()

static ilObjGlossaryAccess::_lookupOnlineStatus ( array  $a_ids)
static

Definition at line 106 of file class.ilObjGlossaryAccess.php.

References $DIC, $ilDB, $lm_set, and ilUtil\yn2tf().

Referenced by ilContainer\legacyOnlineFilter().

106  : array
107  {
108  global $DIC;
109 
110  $ilDB = $DIC->database();
111 
112  $q = "SELECT id, is_online FROM glossary WHERE " .
113  $ilDB->in("id", $a_ids, false, "integer");
114  $lm_set = $ilDB->query($q);
115  $status = [];
116  while ($r = $ilDB->fetchAssoc($lm_set)) {
117  $status[$r["id"]] = ilUtil::yn2tf($r["is_online"]);
118  }
119 
120  return $status;
121  }
global $DIC
Definition: feed.php:28
$lm_set
static yn2tf(string $a_yn)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilObjGlossaryAccess::$access
protected

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

Referenced by _checkAccess().

◆ $lng

ilLanguage ilObjGlossaryAccess::$lng
protected

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

Referenced by _checkAccess().

◆ $rbacsystem

ilRbacSystem ilObjGlossaryAccess::$rbacsystem
protected

Definition at line 28 of file class.ilObjGlossaryAccess.php.

Referenced by _checkAccess().

◆ $user

ilObjUser ilObjGlossaryAccess::$user
protected

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

Referenced by _checkAccess().


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