ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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

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

Constructor & Destructor Documentation

◆ __construct()

ilObjGlossaryAccess::__construct ( )

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

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

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 36 of file class.ilObjGlossaryAccess.php.

36 : bool
37 {
38 $ilUser = $this->user;
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:66

References $access, $lng, $rbacsystem, $ref_id, $user, $user_id, 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 102 of file class.ilObjGlossaryAccess.php.

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 _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 69 of file class.ilObjGlossaryAccess.php.

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 }

Referenced by ilObjGlossaryListGUI\init().

+ 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 }
static _isOffline(int $obj_id)
Type-specific implementation of general status, has to be overwritten if object type does not support...

References ilObjectAccess\_isOffline().

+ Here is the call graph for this function:

◆ _lookupOnlineStatus()

static ilObjGlossaryAccess::_lookupOnlineStatus ( array  $a_ids)
static

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

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

References $id, and ilObjectAccess\_isOffline().

Referenced by ILIAS\Container\Content\Filter\FilterManager\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 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: