ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilObjBlogAccess.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
11{
15 protected $user;
16
20 protected $access;
21
22
26 public function __construct()
27 {
28 global $DIC;
29
30 $this->user = $DIC->user();
31 $this->access = $DIC->access();
32 }
33
46 public static function _getCommands()
47 {
48 $commands = array(
49 array("permission" => "read", "cmd" => "preview", "lang_var" => "show", "default" => true),
50 array("permission" => "write", "cmd" => "render", "lang_var" => "edit"),
51 array("permission" => "contribute", "cmd" => "render", "lang_var" => "edit"),
52 array("permission" => "write", "cmd" => "edit", "lang_var" => "settings"),
53 array("permission" => "write", "cmd" => "export", "lang_var" => "export_html")
54 );
55
56 return $commands;
57 }
58
62 public static function _checkGoto($a_target)
63 {
64 global $DIC;
65
66 $ilAccess = $DIC->access();
67
68 $t_arr = explode("_", $a_target);
69
70 if (substr($a_target, -3) == "wsp") {
71 return ilSharedResourceGUI::hasAccess($t_arr[1]);
72 }
73
74 if ($t_arr[0] != "blog" || ((int) $t_arr[1]) <= 0) {
75 return false;
76 }
77
78 // #12648
79 if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
80 $ilAccess->checkAccess("visible", "", $t_arr[1])) {
81 return true;
82 }
83 return false;
84 }
85
91 public function canBeDelivered(ilWACPath $ilWACPath)
92 {
94 $ilAccess = $this->access;
95
96 if (preg_match("/\\/blog_([\\d]*)\\//uism", $ilWACPath->getPath(), $results)) {
97 $obj_id = $results[1];
98
99 // personal workspace
100 $tree = new ilWorkspaceTree(0);
101 $node_id = $tree->lookupNodeId($obj_id);
102 if ($node_id) {
103 $access_handler = new ilWorkspaceAccessHandler($tree);
104 if ($access_handler->checkAccessOfUser($tree, $ilUser->getId(), "read", "view", $node_id, "blog")) {
105 return true;
106 }
107 }
108 // repository (RBAC)
109 else {
110 $ref_ids = ilObject::_getAllReferences($obj_id);
111 foreach ($ref_ids as $ref_id) {
112 if ($ilAccess->checkAccessOfUser($ilUser->getId(), "read", "view", $ref_id, "blog", $obj_id)) {
113 return true;
114 }
115 }
116 }
117 }
118
119 return false;
120 }
121}
user()
Definition: user.php:4
An exception for terminatinating execution or to throw for unit testing.
Class ilObjBlogAccess.
static _getCommands()
get commands
canBeDelivered(ilWACPath $ilWACPath)
__construct()
Constructor.
static _checkGoto($a_target)
check whether goto script will succeed
Class ilObjectAccess.
static _getAllReferences($a_id)
get all reference ids of object
static hasAccess($a_node_id, $a_is_portfolio=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Access handler for personal workspace.
Tree handler for personal workspace.
Class ilWACCheckingClass.
$results
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46