ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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

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

Static Public Member Functions

static _getCommands ()
 get commands More...
 
static _checkGoto ($a_target)
 check whether goto script will succeed More...
 
static _lookupOnline ($a_id)
 Check wether wiki cast is online. More...
 
static _lookupOnlineStatus ($a_ids)
 Check wether learning module is online (legacy version) More...
 
static _lookupPublicFiles ($a_id)
 Check wether files should be public. 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

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.

Constructor & Destructor Documentation

◆ __construct()

ilObjWikiAccess::__construct ( )

Constructor.

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

References $DIC, and user().

42  {
43  global $DIC;
44 
45  $this->user = $DIC->user();
46  $this->lng = $DIC->language();
47  $this->rbacsystem = $DIC->rbac()->system();
48  $this->access = $DIC->access();
49  }
user()
Definition: user.php:4
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

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

References $access, $ilUser, $lng, $rbacsystem, $user, _lookupOnline(), ilExcRepoObjAssignment\getInstance(), IL_NO_OBJECT_ACCESS, and IL_STATUS_MESSAGE.

88  {
90  $lng = $this->lng;
92  $ilAccess = $this->access;
93 
94  if ($a_user_id == "") {
95  $a_user_id = $ilUser->getId();
96  }
97 
98  switch ($a_cmd) {
99  case "view":
100 
101  if (!ilObjWikiAccess::_lookupOnline($a_obj_id)
102  && !$rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id)) {
103  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
104  return false;
105  }
106  break;
107 
108  // for permission query feature
109  case "infoScreen":
110  if (!ilObjWikiAccess::_lookupOnline($a_obj_id)) {
111  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
112  } else {
113  $ilAccess->addInfoItem(IL_STATUS_MESSAGE, $lng->txt("online"));
114  }
115  break;
116 
117  }
118  switch ($a_permission) {
119  case "read":
120  case "visible":
121  if (!ilObjWikiAccess::_lookupOnline($a_obj_id) &&
122  (!$rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id))) {
123  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
124  return false;
125  }
126 
127  include_once("./Modules/Exercise/RepoObjectAssignment/classes/class.ilExcRepoObjAssignment.php");
128  $info = ilExcRepoObjAssignment::getInstance()->getAccessInfo($a_ref_id, $a_user_id);
129  if (!$info->isGranted()) {
130  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, implode(" / ", $info->getNotGrantedReasons()));
131  return false;
132  }
133  break;
134  }
135 
136  return true;
137  }
static getInstance()
Get instance.
const IL_NO_OBJECT_ACCESS
const IL_STATUS_MESSAGE
$ilUser
Definition: imgupload.php:18
static _lookupOnline($a_id)
Check wether wiki cast is online.
+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjWikiAccess::_checkGoto (   $a_target)
static

check whether goto script will succeed

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

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

143  {
144  global $DIC;
145 
146  $ilAccess = $DIC->access();
147  // echo "-".$a_target."-"; exit;
148  $t_arr = explode("_", $a_target);
149 
150  if ($t_arr[0] != "wiki" || (((int) $t_arr[1]) <= 0) && $t_arr[1] != "wpage") {
151  return false;
152  }
153 
154  if ($t_arr[1] == "wpage") {
155  $wpg_id = (int) $t_arr[2];
156  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
157  $w_id = ilWikiPage::lookupWikiId($wpg_id);
158  if ((int) $t_arr[3] > 0) {
159  $refs = array((int) $t_arr[3]);
160  } else {
161  $refs = ilObject::_getAllReferences($w_id);
162  }
163  foreach ($refs as $r) {
164  if ($ilAccess->checkAccess("read", "", $r) ||
165  $ilAccess->checkAccess("visible", "", $r) ) {
166  return true;
167  }
168  }
169  } elseif ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
170  $ilAccess->checkAccess("visible", "", $t_arr[1])) {
171  return true;
172  }
173  return false;
174  }
static _getAllReferences($a_id)
get all reference ids of object
static lookupWikiId($a_page_id)
Lookup wiki id.
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ _getCommands()

static ilObjWikiAccess::_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 64 of file class.ilObjWikiAccess.php.

Referenced by ilObjWikiListGUI\init().

65  {
66  $commands = array(
67  array("permission" => "read", "cmd" => "view", "lang_var" => "show",
68  "default" => true),
69  array("permission" => "write", "cmd" => "editSettings", "lang_var" => "settings")
70  );
71 
72  return $commands;
73  }
+ Here is the caller graph for this function:

◆ _lookupOnline()

static ilObjWikiAccess::_lookupOnline (   $a_id)
static

Check wether wiki cast is online.

Parameters
int$a_idwiki id

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

References $DIC, and $ilDB.

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

182  {
183  global $DIC;
184 
185  $ilDB = $DIC->database();
186 
187  $q = "SELECT * FROM il_wiki_data WHERE id = " .
188  $ilDB->quote($a_id, "integer");
189  $wk_set = $ilDB->query($q);
190  $wk_rec = $ilDB->fetchAssoc($wk_set);
191 
192  return $wk_rec["is_online"];
193  }
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ _lookupOnlineStatus()

static ilObjWikiAccess::_lookupOnlineStatus (   $a_ids)
static

Check wether learning module is online (legacy version)

Deprecated:

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

References $DIC, $ilDB, and $lm_set.

Referenced by ilContainer\legacyOnlineFilter().

201  {
202  global $DIC;
203 
204  $ilDB = $DIC->database();
205 
206  $q = "SELECT id, is_online FROM il_wiki_data WHERE " .
207  $ilDB->in("id", $a_ids, false, "integer");
208  $lm_set = $ilDB->query($q);
209  $status = [];
210  while ($r = $ilDB->fetchAssoc($lm_set)) {
211  $status[$r["id"]] = $r["is_online"];
212  }
213  return $status;
214  }
$lm_set
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ _lookupPublicFiles()

static ilObjWikiAccess::_lookupPublicFiles (   $a_id)
static

Check wether files should be public.

Parameters
int$a_idwiki id

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

References $DIC, and $ilDB.

223  {
224  global $DIC;
225 
226  $ilDB = $DIC->database();
227 
228  $q = "SELECT * FROM il_wiki_data WHERE id = " .
229  $ilDB->quote($a_id, "integer");
230  $wk_set = $ilDB->query($q);
231  $wk_rec = $ilDB->fetchAssoc($wk_set);
232 
233  return $wk_rec["public_files"];
234  }
global $ilDB
$DIC
Definition: xapitoken.php:46

Field Documentation

◆ $access

ilObjWikiAccess::$access
protected

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

Referenced by _checkAccess().

◆ $lng

ilObjWikiAccess::$lng
protected

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

Referenced by _checkAccess().

◆ $rbacsystem

ilObjWikiAccess::$rbacsystem
protected

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

Referenced by _checkAccess().

◆ $user

ilObjWikiAccess::$user
protected

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

Referenced by _checkAccess().


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