ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjWikiAccess Class Reference

Class ilObjWikiAccess. More...

+ Inheritance diagram for ilObjWikiAccess:
+ Collaboration diagram for ilObjWikiAccess:

Public Member Functions

 _getCommands ()
 get commands 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...
 
 _checkGoto ($a_target)
 check whether goto script will succeed More...
 
 _lookupOnline ($a_id)
 Check wether wiki cast is online. More...
 
 _lookupPublicFiles ($a_id)
 Check wether files should be public. 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=0)
 check condition More...
 
 _getCommands ()
 get commands More...
 
 _checkGoto ($a_target)
 check whether goto script will succeed More...
 
 _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObjectAccess
static _isOffline ($a_obj_id)
 Type-specific implementation of general status, has to be overwritten. More...
 

Detailed Description

Class ilObjWikiAccess.

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

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

Member Function Documentation

◆ _checkAccess()

ilObjWikiAccess::_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
boolean true, if everything is ok

Definition at line 54 of file class.ilObjWikiAccess.php.

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

55  {
56  global $ilUser, $lng, $rbacsystem, $ilAccess;
57 
58  if ($a_user_id == "")
59  {
60  $a_user_id = $ilUser->getId();
61  }
62 
63  switch ($a_cmd)
64  {
65  case "view":
66 
67  if(!ilObjWikiAccess::_lookupOnline($a_obj_id)
68  && !$rbacsystem->checkAccessOfUser($a_user_id,'write',$a_ref_id))
69  {
70  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
71  return false;
72  }
73  break;
74 
75  // for permission query feature
76  case "infoScreen":
77  if(!ilObjWikiAccess::_lookupOnline($a_obj_id))
78  {
79  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
80  }
81  else
82  {
83  $ilAccess->addInfoItem(IL_STATUS_MESSAGE, $lng->txt("online"));
84  }
85  break;
86 
87  }
88  switch ($a_permission)
89  {
90  case "read":
91  case "visible":
92  if (!ilObjWikiAccess::_lookupOnline($a_obj_id) &&
93  (!$rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id)))
94  {
95  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
96  return false;
97  }
98  break;
99  }
100 
101  return true;
102  }
const IL_NO_OBJECT_ACCESS
_lookupOnline($a_id)
Check wether wiki cast is online.
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ _checkGoto()

ilObjWikiAccess::_checkGoto (   $a_target)

check whether goto script will succeed

Definition at line 107 of file class.ilObjWikiAccess.php.

References $r, ilObject\_getAllReferences(), and ilWikiPage\lookupWikiId().

108  {
109  global $ilAccess;
110 
111  $t_arr = explode("_", $a_target);
112 
113  if ($t_arr[0] != "wiki" || (((int) $t_arr[1]) <= 0) && $t_arr[1] != "wpage")
114  {
115  return false;
116  }
117 
118  if ($t_arr[1] == "wpage")
119  {
120  $wpg_id = (int) $t_arr[2];
121  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
122  $w_id = ilWikiPage::lookupWikiId($wpg_id);
123  $refs = ilObject::_getAllReferences($w_id);
124  foreach ($refs as $r)
125  {
126  if ($ilAccess->checkAccess("read", "", $r))
127  {
128  return true;
129  }
130  }
131  }
132  else if ($ilAccess->checkAccess("read", "", $t_arr[1]))
133  {
134  return true;
135  }
136  return false;
137  }
static _getAllReferences($a_id)
get all reference ids of object
static lookupWikiId($a_page_id)
Lookup wiki id.
$r
+ Here is the call graph for this function:

◆ _getCommands()

ilObjWikiAccess::_getCommands ( )

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 30 of file class.ilObjWikiAccess.php.

Referenced by ilObjWikiListGUI\init().

31  {
32  $commands = array
33  (
34  array("permission" => "read", "cmd" => "view", "lang_var" => "show",
35  "default" => true),
36  array("permission" => "write", "cmd" => "editSettings", "lang_var" => "settings")
37  );
38 
39  return $commands;
40  }
+ Here is the caller graph for this function:

◆ _lookupOnline()

ilObjWikiAccess::_lookupOnline (   $a_id)

Check wether wiki cast is online.

Parameters
int$a_idwiki id

Definition at line 144 of file class.ilObjWikiAccess.php.

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

145  {
146  global $ilDB;
147 
148  $q = "SELECT * FROM il_wiki_data WHERE id = ".
149  $ilDB->quote($a_id, "integer");
150  $wk_set = $ilDB->query($q);
151  $wk_rec = $ilDB->fetchAssoc($wk_set);
152 
153  return $wk_rec["is_online"];
154  }
+ Here is the caller graph for this function:

◆ _lookupPublicFiles()

ilObjWikiAccess::_lookupPublicFiles (   $a_id)

Check wether files should be public.

Parameters
int$a_idwiki id

Definition at line 161 of file class.ilObjWikiAccess.php.

162  {
163  global $ilDB;
164 
165  $q = "SELECT * FROM il_wiki_data WHERE id = ".
166  $ilDB->quote($a_id, "integer");
167  $wk_set = $ilDB->query($q);
168  $wk_rec = $ilDB->fetchAssoc($wk_set);
169 
170  return $wk_rec["public_files"];
171  }

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