ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilObjGlossaryAccess Class Reference

Class ilObjGlossaryAccess. More...

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

Public Member Functions

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

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.

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

References $ilUser, $lng, _lookupOnline(), and IL_NO_OBJECT_ACCESS.

33  {
34  global $ilUser, $lng, $rbacsystem, $ilAccess;
35 
36  if ($a_user_id == "")
37  {
38  $a_user_id = $ilUser->getId();
39  }
40 
41  switch ($a_permission)
42  {
43  case "read":
45  && !$rbacsystem->checkAccessOfUser($a_user_id,'write',$a_ref_id))
46  {
47  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
48  return false;
49  }
50  break;
51 
52  case "visible":
53  if (!ilObjGlossaryAccess::_lookupOnline($a_obj_id) &&
54  (!$rbacsystem->checkAccessOfUser($a_user_id,'write', $a_ref_id)))
55  {
56  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
57  return false;
58  }
59  break;
60  }
61 
62 
63  return true;
64  }
const IL_NO_OBJECT_ACCESS
static _lookupOnline($a_id)
check wether learning module is online
$ilUser
Definition: imgupload.php:18
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjGlossaryAccess::_checkGoto (   $a_target)
static

check whether goto script will succeed

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

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

115  {
116  global $ilAccess;
117 
118  $t_arr = explode("_", $a_target);
119 
120  if (($t_arr[0] != "glo" && $t_arr[0] != "git") || ((int) $t_arr[1]) <= 0)
121  {
122  return false;
123  }
124 
125  if ($t_arr[0] == "glo")
126  {
127  if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
128  $ilAccess->checkAccess("visible", "", $t_arr[1]))
129  {
130  return true;
131  }
132  }
133 
134  if ($t_arr[0] == "git")
135  {
136  if ($t_arr[2] > 0)
137  {
138  $ref_ids = array($t_arr[2]);
139  }
140  else
141  {
142  // determine learning object
143  require_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
144  $glo_id = ilGlossaryTerm::_lookGlossaryID($t_arr[1]);
145  $ref_ids = ilObject::_getAllReferences($glo_id);
146  }
147  // check read permissions
148  foreach ($ref_ids as $ref_id)
149  {
150  // Permission check
151  if ($ilAccess->checkAccess("read", "", $ref_id))
152  {
153  return true;
154  }
155  }
156  }
157 
158  return false;
159  }
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
$ref_id
Definition: sahs_server.php:39
+ 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 78 of file class.ilObjGlossaryAccess.php.

References array.

Referenced by ilObjGlossaryListGUI\init().

79  {
80  $commands = array
81  (
82  array("permission" => "read", "cmd" => "view", "lang_var" => "show",
83  "default" => true),
84  array("permission" => "write", "cmd" => "edit", "lang_var" => "edit_content"),
85  array("permission" => "edit_content", "cmd" => "edit", "lang_var" => "edit_content"), // #11099
86  array("permission" => "write", "cmd" => "properties", "lang_var" => "settings")
87  );
88 
89  return $commands;
90  }
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 99 of file class.ilObjGlossaryAccess.php.

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

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

100  {
101  global $ilDB;
102 
103  $q = "SELECT * FROM glossary WHERE id = ".
104  $ilDB->quote($a_id, "integer");
105  $lm_set = $ilDB->query($q);
106  $lm_rec = $ilDB->fetchAssoc($lm_set);
107 
108  return ilUtil::yn2tf($lm_rec["is_online"]);
109  }
$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:

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