ILIAS  release_8 Revision v8.24
class.ilObjBlogAccess.php
Go to the documentation of this file.
1<?php
2
24{
25 protected ilObjUser $user;
27
28 public function __construct()
29 {
30 global $DIC;
31
32 $this->user = $DIC->user();
33 $this->access = $DIC->access();
34 }
35
36 public static function _getCommands(): array
37 {
38 return array(
39 array("permission" => "read", "cmd" => "preview", "lang_var" => "show", "default" => true),
40 array("permission" => "write", "cmd" => "render", "lang_var" => "edit"),
41 array("permission" => "contribute", "cmd" => "render", "lang_var" => "edit"),
42 array("permission" => "write", "cmd" => "edit", "lang_var" => "settings"),
43 array("permission" => "write", "cmd" => "export", "lang_var" => "export_html")
44 );
45 }
46
47 public static function _checkGoto(string $target): bool
48 {
49 global $DIC;
50
51 $ilAccess = $DIC->access();
52
53 $t_arr = explode("_", $target);
54
55 if (substr($target, -3) === "wsp") {
56 return ilSharedResourceGUI::hasAccess($t_arr[1]);
57 }
58
59 if ($t_arr[0] !== "blog" || ((int) $t_arr[1]) <= 0) {
60 return false;
61 }
62
63 // #12648
64 if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
65 $ilAccess->checkAccess("visible", "", $t_arr[1])) {
66 return true;
67 }
68 return false;
69 }
70
71 public function canBeDelivered(ilWACPath $ilWACPath): bool
72 {
74 $ilAccess = $this->access;
75 if (preg_match("/\\/blog_([\\d]*)\\//uim", $ilWACPath->getPath(), $results)) {
76 $obj_id = $results[1];
77 if ($obj_id == "") {
78 return false;
79 }
80
81 // personal workspace
82 $tree = new ilWorkspaceTree(0);
83 $node_id = $tree->lookupNodeId((int) $obj_id);
84 if ($node_id) {
85 $access_handler = new ilWorkspaceAccessHandler($tree);
86 if ($access_handler->checkAccessOfUser($tree, $ilUser->getId(), "read", "view", $node_id, "blog")) {
87 return true;
88 }
89 }
90 // repository (RBAC)
91 else {
92 $ref_ids = ilObject::_getAllReferences((int) $obj_id);
93 foreach ($ref_ids as $ref_id) {
94 if ($ilAccess->checkAccessOfUser($ilUser->getId(), "read", "view", $ref_id, "blog", (int) $obj_id)) {
95 return true;
96 }
97 }
98 }
99 }
100
101 return false;
102 }
103
104 public static function isCommentsExportPossible(int $blog_id): bool
105 {
106 global $DIC;
107
108 $setting = $DIC->settings();
109 $notes = $DIC->notes();
111 if ($setting->get("disable_comments")) {
112 return false;
113 }
114 if (!$privacy->enabledCommentsExport()) {
115 return false;
116 }
117 if (!$notes->domain()->commentsActive($blog_id)) {
118 return false;
119 }
120 return true;
121 }
122}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getCommands()
get commands
static isCommentsExportPossible(int $blog_id)
ilAccessHandler $access
canBeDelivered(ilWACPath $ilWACPath)
static _checkGoto(string $target)
check whether goto script will succeed
User class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getAllReferences(int $id)
get all reference ids for object ID
static hasAccess(int $a_node_id, bool $a_is_portfolio=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
$ilUser
Definition: imgupload.php:34
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:67
$results