ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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)
 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

Reimplemented from ilObjectAccess.

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

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
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 $lng
Definition: privfeed.php:40
global $ilUser
Definition: imgupload.php:15

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

+ Here is the call graph for this function:

◆ _checkGoto()

ilObjWikiAccess::_checkGoto (   $a_target)

check whether goto script will succeed

Reimplemented from ilObjectAccess.

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

108 {
109 global $ilAccess;
110// echo "-".$a_target."-"; exit;
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 if ((int) $t_arr[3] > 0)
124 {
125 $refs = array((int) $t_arr[3]);
126 }
127 else
128 {
129 $refs = ilObject::_getAllReferences($w_id);
130 }
131 foreach ($refs as $r)
132 {
133 if ($ilAccess->checkAccess("read", "", $r))
134 {
135 return true;
136 }
137 }
138 }
139 else if ($ilAccess->checkAccess("read", "", $t_arr[1]))
140 {
141 return true;
142 }
143 return false;
144 }
static _getAllReferences($a_id)
get all reference ids of object
static lookupWikiId($a_page_id)
Lookup wiki id.
$r
Definition: example_031.php:79

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

+ 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"), );

Reimplemented from ilObjectAccess.

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

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 }

Referenced by ilObjWikiListGUI\init().

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

152 {
153 global $ilDB;
154
155 $q = "SELECT * FROM il_wiki_data WHERE id = ".
156 $ilDB->quote($a_id, "integer");
157 $wk_set = $ilDB->query($q);
158 $wk_rec = $ilDB->fetchAssoc($wk_set);
159
160 return $wk_rec["is_online"];
161 }
global $ilDB

References $ilDB.

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

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

169 {
170 global $ilDB;
171
172 $q = "SELECT * FROM il_wiki_data WHERE id = ".
173 $ilDB->quote($a_id, "integer");
174 $wk_set = $ilDB->query($q);
175 $wk_rec = $ilDB->fetchAssoc($wk_set);
176
177 return $wk_rec["public_files"];
178 }

References $ilDB.


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