ILIAS  release_8 Revision v8.24
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)
 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)
 
 canBeDelivered (ilWACPath $ilWACPath)
 

Static Public Member Functions

static _getCommands ()
 get commands More...
 
static _lookupOnline (int $a_id)
 
static _lookupOnlineStatus (array $a_ids)
 
static _checkGoto (string $target)
 check whether goto script will succeed 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 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.

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

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

+ 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 
)

Checks whether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess)

Please do not check any preconditions handled by ilConditionHandler here. Also don't do any RBAC checks.

Reimplemented from ilObjectAccess.

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

41 : bool
42 {
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="")
$ilUser
Definition: imgupload.php:34
$ref_id
Definition: ltiauth.php:67

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

+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjGlossaryAccess::_checkGoto ( string  $target)
static

check whether goto script will succeed

Reimplemented from ilObjectAccess.

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

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 _lookGlossaryID(int $term_id)
get glossary id form term id
static _getAllReferences(int $id)
get all reference ids for object ID

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

+ Here is the call graph for this function:

◆ _getCommands()

static ilObjGlossaryAccess::_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{permission?:string, cmd?:string, lang_var?:string, default?:bool}[]

Reimplemented from ilObjectAccess.

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

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 }

Referenced by ilObjGlossaryListGUI\init().

+ 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.

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 }
static yn2tf(string $a_yn)
$lm_set

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

Referenced by ilObjGlossaryListGUI\getProperties().

+ 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.

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 }

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

Referenced by ilContainer\legacyOnlineFilter().

+ 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: