ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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

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

Constructor & Destructor Documentation

◆ __construct()

ilObjGlossaryAccess::__construct ( )

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

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

27  {
28  global $DIC;
29 
30  $this->user = $DIC->user();
31  $this->lng = $DIC->language();
32  $this->rbacsystem = $DIC->rbac()->system();
33  $this->access = $DIC->access();
34  }
global $DIC
Definition: shib_login.php:22
+ 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 36 of file class.ilObjGlossaryAccess.php.

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

36  : bool
37  {
38  $ilUser = $this->user;
39  $lng = $this->lng;
41  $ilAccess = $this->access;
42 
43  if (is_null($user_id)) {
44  $user_id = $ilUser->getId();
45  }
46 
47  switch ($permission) {
48  case "read":
49  if (!self::_lookupOnline($obj_id)
51  $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
52  return false;
53  }
54  break;
55 
56  case "visible":
57  if (!self::_lookupOnline($obj_id) &&
59  $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
60  return false;
61  }
62  break;
63  }
64 
65 
66  return true;
67  }
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
+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjGlossaryAccess::_checkGoto ( string  $target)
static

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

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

102  : bool
103  {
104  global $DIC;
105 
106  $ilAccess = $DIC->access();
107 
108  $t_arr = explode("_", $target);
109 
110  if (($t_arr[0] != "glo" && $t_arr[0] != "git") || ((int) $t_arr[1]) <= 0) {
111  return false;
112  }
113 
114  if ($t_arr[0] == "glo") {
115  if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
116  $ilAccess->checkAccess("visible", "", $t_arr[1])) {
117  return true;
118  }
119  }
120 
121  if ($t_arr[0] == "git") {
122  if ((int) ($t_arr[2] ?? 0) > 0) {
123  $ref_ids = array($t_arr[2]);
124  } else {
125  // determine learning object
126  $glo_id = ilGlossaryTerm::_lookGlossaryID((int) $t_arr[1]);
127  $ref_ids = ilObject::_getAllReferences($glo_id);
128  }
129  // check read permissions
130  foreach ($ref_ids as $ref_id) {
131  // Permission check
132  if ($ilAccess->checkAccess("read", "", $ref_id)) {
133  return true;
134  }
135  }
136  }
137 
138  return false;
139  }
static _getAllReferences(int $id)
get all reference ids for object ID
$ref_id
Definition: ltiauth.php:65
global $DIC
Definition: shib_login.php:22
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 69 of file class.ilObjGlossaryAccess.php.

Referenced by ilObjGlossaryListGUI\init().

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

◆ _lookupOnline()

static ilObjGlossaryAccess::_lookupOnline ( int  $a_id)
static

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

86  : bool
87  {
88  return !self::_isOffline($a_id);
89  }

◆ _lookupOnlineStatus()

static ilObjGlossaryAccess::_lookupOnlineStatus ( array  $a_ids)
static

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

References $id.

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

91  : array
92  {
93  $status = [];
94  foreach ($a_ids as $id) {
95  $status[$id] = !self::_isOffline($id);
96  }
97 
98  return $status;
99  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilObjGlossaryAccess::$access
protected

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

Referenced by _checkAccess().

◆ $lng

ilLanguage ilObjGlossaryAccess::$lng
protected

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

Referenced by _checkAccess().

◆ $rbacsystem

ilRbacSystem ilObjGlossaryAccess::$rbacsystem
protected

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

Referenced by _checkAccess().

◆ $user

ilObjUser ilObjGlossaryAccess::$user
protected

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

Referenced by _checkAccess().


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