ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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
5include_once("./Services/Object/classes/class.ilObjectAccess.php");
6require_once('./Services/WebAccessChecker/interfaces/interface.ilWACCheckingClass.php');
7
16{
29 static function _getCommands()
30 {
31 $commands = array
32 (
33 array("permission" => "read", "cmd" => "preview", "lang_var" => "show", "default" => true),
34 array("permission" => "write", "cmd" => "render", "lang_var" => "edit"),
35 array("permission" => "contribute", "cmd" => "render", "lang_var" => "edit"),
36 array("permission" => "write", "cmd" => "edit", "lang_var" => "settings"),
37 array("permission" => "write", "cmd" => "export", "lang_var" => "export_html")
38 );
39
40 return $commands;
41 }
42
46 static function _checkGoto($a_target)
47 {
48 global $ilAccess;
49
50 $t_arr = explode("_", $a_target);
51
52 if(substr($a_target, -3) == "wsp")
53 {
54 include_once "Services/PersonalWorkspace/classes/class.ilSharedResourceGUI.php";
55 return ilSharedResourceGUI::hasAccess($t_arr[1]);
56 }
57
58 if ($t_arr[0] != "blog" || ((int) $t_arr[1]) <= 0)
59 {
60 return false;
61 }
62
63 // #12648
64 if ($ilAccess->checkAccess("read", "", $t_arr[1]))
65 {
66 return true;
67 }
68 return false;
69 }
70
76 public function canBeDelivered(ilWACPath $ilWACPath) {
77 global $ilUser, $ilAccess;
78
79 if(preg_match("/\\/blog_([\\d]*)\\//uism", $ilWACPath->getPath(), $results))
80 {
81 $obj_id = $results[1];
82
83 // personal workspace
84 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
85 $tree = new ilWorkspaceTree(0);
86 $node_id = $tree->lookupNodeId($obj_id);
87 if($node_id)
88 {
89 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
90 $access_handler = new ilWorkspaceAccessHandler($tree);
91 if ($access_handler->checkAccessOfUser($tree, $ilUser->getId(), "read", "view", $node_id, "blog")) {
92 return true;
93 }
94 }
95 // repository (RBAC)
96 else
97 {
98 $ref_ids = ilObject::_getAllReferences($obj_id);
99 foreach($ref_ids as $ref_id)
100 {
101 if ($ilAccess->checkAccessOfUser($ilUser->getId(), "read", "view", $ref_id, "blog", $obj_id))
102 {
103 return true;
104 }
105 }
106 }
107 }
108
109 return false;
110 }
111}
112
113?>
An exception for terminatinating execution or to throw for unit testing.
Class ilObjBlogAccess.
static _getCommands()
get commands
canBeDelivered(ilWACPath $ilWACPath)
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)
Class ilWACPath.
Access handler for personal workspace.
Tree handler for personal workspace.
Class ilWACCheckingClass.
$ref_id
Definition: sahs_server.php:39
$results
$ilUser
Definition: imgupload.php:18