ILIAS  release_7 Revision v7.30-3-g800a261c036
ilObjGlossaryAccess Class Reference

Class ilObjGlossaryAccess. More...

+ Inheritance diagram for ilObjGlossaryAccess:
+ Collaboration diagram for ilObjGlossaryAccess:

Public Member Functions

 __construct ()
 Constructor. More...
 
 _checkAccess ($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id="")
 checks wether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess) More...
 
- Public Member Functions inherited from ilObjectAccess
 _checkAccess ($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id="")
 Checks wether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess) More...
 
 _checkCondition ($a_obj_id, $a_operator, $a_value, $a_usr_id)
 check condition More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 
Parameters
ilWACPath$ilWACPath
Returns
bool
More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 

Static Public Member Functions

static _getCommands ()
 get commands More...
 
static _lookupOnline ($a_id)
 check wether learning module is online More...
 
static _lookupOnlineStatus ($a_ids)
 Check wether learning module is online (legacy version) More...
 
static _checkGoto ($a_target)
 check whether goto script will succeed More...
 
- Static Public Member Functions inherited from ilObjectAccess
static _getCommands ()
 get commands More...
 
static _checkGoto ($a_target)
 check whether goto script will succeed More...
 
static _isOffline ($a_obj_id)
 Type-specific implementation of general status, has to be overwritten if object type does not support centralized offline handling. More...
 
static _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data. More...
 

Protected Attributes

 $user
 
 $lng
 
 $rbacsystem
 
 $access
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjGlossaryAccess::__construct ( )

Constructor.

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

37 {
38 global $DIC;
39
40 $this->user = $DIC->user();
41 $this->lng = $DIC->language();
42 $this->rbacsystem = $DIC->rbac()->system();
43 $this->access = $DIC->access();
44 }
user()
Definition: user.php:4
global $DIC
Definition: goto.php:24

References $DIC, and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ _checkAccess()

ilObjGlossaryAccess::_checkAccess (   $a_cmd,
  $a_permission,
  $a_ref_id,
  $a_obj_id,
  $a_user_id = "" 
)

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

Parameters
string$a_cmdcommand (not permission!)
string$a_permissionpermission
int$a_ref_idreference id
int$a_obj_idobject id
int$a_user_iduser id (if not provided, current user is taken)
Returns
mixed true, if everything is ok, message (string) when access is not granted

Reimplemented from ilObjectAccess.

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

60 {
64 $ilAccess = $this->access;
65
66 if ($a_user_id == "") {
67 $a_user_id = $ilUser->getId();
68 }
69
70 switch ($a_permission) {
71 case "read":
73 && !$rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id)) {
74 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
75 return false;
76 }
77 break;
78
79 case "visible":
80 if (!ilObjGlossaryAccess::_lookupOnline($a_obj_id) &&
81 (!$rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id))) {
82 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
83 return false;
84 }
85 break;
86 }
87
88
89 return true;
90 }
const IL_NO_OBJECT_ACCESS
static _lookupOnline($a_id)
check wether learning module is online
$ilUser
Definition: imgupload.php:18

References $access, $ilUser, $lng, $rbacsystem, $user, _lookupOnline(), and IL_NO_OBJECT_ACCESS.

+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjGlossaryAccess::_checkGoto (   $a_target)
static

check whether goto script will succeed

Reimplemented from ilObjectAccess.

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

165 {
166 global $DIC;
167
168 $ilAccess = $DIC->access();
169
170 $t_arr = explode("_", $a_target);
171
172 if (($t_arr[0] != "glo" && $t_arr[0] != "git") || ((int) $t_arr[1]) <= 0) {
173 return false;
174 }
175
176 if ($t_arr[0] == "glo") {
177 if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
178 $ilAccess->checkAccess("visible", "", $t_arr[1])) {
179 return true;
180 }
181 }
182
183 if ($t_arr[0] == "git") {
184 if ($t_arr[2] > 0) {
185 $ref_ids = array($t_arr[2]);
186 } else {
187 // determine learning object
188 $glo_id = ilGlossaryTerm::_lookGlossaryID($t_arr[1]);
189 $ref_ids = ilObject::_getAllReferences($glo_id);
190 }
191 // check read permissions
192 foreach ($ref_ids as $ref_id) {
193 // Permission check
194 if ($ilAccess->checkAccess("read", "", $ref_id)) {
195 return true;
196 }
197 }
198 }
199
200 return false;
201 }
static _lookGlossaryID($term_id)
get glossary id form term id
static _getAllReferences($a_id)
get all reference ids of object

References $DIC, 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"), );

Reimplemented from ilObjectAccess.

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

105 {
106 $commands = array(
107 array("permission" => "read", "cmd" => "view", "lang_var" => "show",
108 "default" => true),
109 array("permission" => "write", "cmd" => "edit", "lang_var" => "edit_content"),
110 array("permission" => "edit_content", "cmd" => "edit", "lang_var" => "edit_content"), // #11099
111 array("permission" => "write", "cmd" => "properties", "lang_var" => "settings")
112 );
113
114 return $commands;
115 }

Referenced by ilObjGlossaryListGUI\init().

+ Here is the caller graph for this function:

◆ _lookupOnline()

static ilObjGlossaryAccess::_lookupOnline (   $a_id)
static

check wether learning module is online

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

125 {
126 global $DIC;
127
128 $ilDB = $DIC->database();
129
130 $q = "SELECT * FROM glossary WHERE id = " .
131 $ilDB->quote($a_id, "integer");
132 $lm_set = $ilDB->query($q);
133 $lm_rec = $ilDB->fetchAssoc($lm_set);
134
135 return ilUtil::yn2tf($lm_rec["is_online"]);
136 }
static yn2tf($a_yn)
convert "y"/"n" to true/false
global $ilDB
$lm_set

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

Referenced by _checkAccess(), and ilObjGlossaryListGUI\getProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupOnlineStatus()

static ilObjGlossaryAccess::_lookupOnlineStatus (   $a_ids)
static

Check wether learning module is online (legacy version)

Deprecated:

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

144 {
145 global $DIC;
146
147 $ilDB = $DIC->database();
148
149 $q = "SELECT id, is_online FROM glossary WHERE " .
150 $ilDB->in("id", $a_ids, false, "integer");
151 $lm_set = $ilDB->query($q);
152 $status = [];
153 while ($r = $ilDB->fetchAssoc($lm_set)) {
154 $status[$r["id"]] = ilUtil::yn2tf($r["is_online"]);
155 }
156
157 return $status;
158 }

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

ilObjGlossaryAccess::$access
protected

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

Referenced by _checkAccess().

◆ $lng

ilObjGlossaryAccess::$lng
protected

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

Referenced by _checkAccess().

◆ $rbacsystem

ilObjGlossaryAccess::$rbacsystem
protected

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

Referenced by _checkAccess().

◆ $user

ilObjGlossaryAccess::$user
protected

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

Referenced by _checkAccess().


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