ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilObjBlogAccess.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once("./Services/Object/classes/class.ilObjectAccess.php");
6 require_once('./Services/WebAccessChecker/interfaces/interface.ilWACCheckingClass.php');
7 
16 {
20  protected $user;
21 
25  protected $access;
26 
27 
31  public function __construct()
32  {
33  global $DIC;
34 
35  $this->user = $DIC->user();
36  $this->access = $DIC->access();
37  }
38 
51  public static function _getCommands()
52  {
53  $commands = array(
54  array("permission" => "read", "cmd" => "preview", "lang_var" => "show", "default" => true),
55  array("permission" => "write", "cmd" => "render", "lang_var" => "edit"),
56  array("permission" => "contribute", "cmd" => "render", "lang_var" => "edit"),
57  array("permission" => "write", "cmd" => "edit", "lang_var" => "settings"),
58  array("permission" => "write", "cmd" => "export", "lang_var" => "export_html")
59  );
60 
61  return $commands;
62  }
63 
67  public static function _checkGoto($a_target)
68  {
69  global $DIC;
70 
71  $ilAccess = $DIC->access();
72 
73  $t_arr = explode("_", $a_target);
74 
75  if (substr($a_target, -3) == "wsp") {
76  include_once "Services/PersonalWorkspace/classes/class.ilSharedResourceGUI.php";
77  return ilSharedResourceGUI::hasAccess($t_arr[1]);
78  }
79 
80  if ($t_arr[0] != "blog" || ((int) $t_arr[1]) <= 0) {
81  return false;
82  }
83 
84  // #12648
85  if ($ilAccess->checkAccess("read", "", $t_arr[1])) {
86  return true;
87  }
88  return false;
89  }
90 
96  public function canBeDelivered(ilWACPath $ilWACPath)
97  {
99  $ilAccess = $this->access;
100 
101  if (preg_match("/\\/blog_([\\d]*)\\//uism", $ilWACPath->getPath(), $results)) {
102  $obj_id = $results[1];
103 
104  // personal workspace
105  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
106  $tree = new ilWorkspaceTree(0);
107  $node_id = $tree->lookupNodeId($obj_id);
108  if ($node_id) {
109  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
110  $access_handler = new ilWorkspaceAccessHandler($tree);
111  if ($access_handler->checkAccessOfUser($tree, $ilUser->getId(), "read", "view", $node_id, "blog")) {
112  return true;
113  }
114  }
115  // repository (RBAC)
116  else {
117  $ref_ids = ilObject::_getAllReferences($obj_id);
118  foreach ($ref_ids as $ref_id) {
119  if ($ilAccess->checkAccessOfUser($ilUser->getId(), "read", "view", $ref_id, "blog", $obj_id)) {
120  return true;
121  }
122  }
123  }
124  }
125 
126  return false;
127  }
128 }
Class ilObjBlogAccess.
global $DIC
Definition: saml.php:7
Access handler for personal workspace.
canBeDelivered(ilWACPath $ilWACPath)
Class ilWACPath.
user()
Definition: user.php:4
static _getAllReferences($a_id)
get all reference ids of object
Tree handler for personal workspace.
$ilUser
Definition: imgupload.php:18
static hasAccess($a_node_id, $a_is_portfolio=false)
static _checkGoto($a_target)
check whether goto script will succeed
Class ilWACCheckingClass.
Create styles array
The data for the language used.
static _getCommands()
get commands
Class ilObjectAccess.
$results
Definition: svg-scanner.php:47
__construct()
Constructor.