ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 

Static Public Member Functions

static _getCommands ()
 get commands More...
 
static _lookupOnline ($a_id)
 check wether learning module is online 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. More...
 
static _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data. More...
 

Protected Attributes

 $user
 
 $lng
 
 $rbacsystem
 
 $access
 

Detailed Description

Class ilObjGlossaryAccess.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilObjGlossaryAccess::__construct ( )

Constructor.

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

References $DIC, and user().

44  {
45  global $DIC;
46 
47  $this->user = $DIC->user();
48  $this->lng = $DIC->language();
49  $this->rbacsystem = $DIC->rbac()->system();
50  $this->access = $DIC->access();
51  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
+ 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

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

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

67  {
69  $lng = $this->lng;
71  $ilAccess = $this->access;
72 
73  if ($a_user_id == "") {
74  $a_user_id = $ilUser->getId();
75  }
76 
77  switch ($a_permission) {
78  case "read":
80  && !$rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id)) {
81  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
82  return false;
83  }
84  break;
85 
86  case "visible":
87  if (!ilObjGlossaryAccess::_lookupOnline($a_obj_id) &&
88  (!$rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id))) {
89  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
90  return false;
91  }
92  break;
93  }
94 
95 
96  return true;
97  }
const IL_NO_OBJECT_ACCESS
static _lookupOnline($a_id)
check wether learning module is online
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjGlossaryAccess::_checkGoto (   $a_target)
static

check whether goto script will succeed

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

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

149  {
150  global $DIC;
151 
152  $ilAccess = $DIC->access();
153 
154  $t_arr = explode("_", $a_target);
155 
156  if (($t_arr[0] != "glo" && $t_arr[0] != "git") || ((int) $t_arr[1]) <= 0) {
157  return false;
158  }
159 
160  if ($t_arr[0] == "glo") {
161  if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
162  $ilAccess->checkAccess("visible", "", $t_arr[1])) {
163  return true;
164  }
165  }
166 
167  if ($t_arr[0] == "git") {
168  if ($t_arr[2] > 0) {
169  $ref_ids = array($t_arr[2]);
170  } else {
171  // determine learning object
172  require_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
173  $glo_id = ilGlossaryTerm::_lookGlossaryID($t_arr[1]);
174  $ref_ids = ilObject::_getAllReferences($glo_id);
175  }
176  // check read permissions
177  foreach ($ref_ids as $ref_id) {
178  // Permission check
179  if ($ilAccess->checkAccess("read", "", $ref_id)) {
180  return true;
181  }
182  }
183  }
184 
185  return false;
186  }
global $DIC
Definition: saml.php:7
static _getAllReferences($a_id)
get all reference ids of object
Create styles array
The data for the language used.
static _lookGlossaryID($term_id)
get glossary id form term id
+ 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"), );

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

References array.

Referenced by ilObjGlossaryListGUI\init().

112  {
113  $commands = array(
114  array("permission" => "read", "cmd" => "view", "lang_var" => "show",
115  "default" => true),
116  array("permission" => "write", "cmd" => "edit", "lang_var" => "edit_content"),
117  array("permission" => "edit_content", "cmd" => "edit", "lang_var" => "edit_content"), // #11099
118  array("permission" => "write", "cmd" => "properties", "lang_var" => "settings")
119  );
120 
121  return $commands;
122  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ _lookupOnline()

static ilObjGlossaryAccess::_lookupOnline (   $a_id)
static

check wether learning module is online

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

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

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

132  {
133  global $DIC;
134 
135  $ilDB = $DIC->database();
136 
137  $q = "SELECT * FROM glossary WHERE id = " .
138  $ilDB->quote($a_id, "integer");
139  $lm_set = $ilDB->query($q);
140  $lm_rec = $ilDB->fetchAssoc($lm_set);
141 
142  return ilUtil::yn2tf($lm_rec["is_online"]);
143  }
global $DIC
Definition: saml.php:7
$lm_set
global $ilDB
static yn2tf($a_yn)
convert "y"/"n" to true/false
+ 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 37 of file class.ilObjGlossaryAccess.php.

Referenced by _checkAccess().

◆ $lng

ilObjGlossaryAccess::$lng
protected

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

Referenced by _checkAccess().

◆ $rbacsystem

ilObjGlossaryAccess::$rbacsystem
protected

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

Referenced by _checkAccess().

◆ $user

ilObjGlossaryAccess::$user
protected

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

Referenced by _checkAccess().


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