ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilObjCloudAccess.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Services/Repository/classes/class.ilObjectPluginAccess.php");
5include_once("class.ilCloudConnector.php");
6include_once("class.ilObjCloud.php");
7
17{
18 protected static $access_cache = array();
19
20 public function _getCommands()
21 {
22 $commands = array
23 (
24 array("permission" => "read", "cmd" => "render", "lang_var" => "show", "default" => true),
25 array("permission" => "write", "cmd" => "editSettings", "lang_var" => "settings")
26 );
27
28 return $commands;
29 }
30
31
40 function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "")
41 {
42 global $ilUser, $rbacsystem, $rbacreview;
43
44 $object = new ilObjCloud($a_ref_id);
45
49 try
50 {
51 ilCloudConnector::checkServiceActive($object->getServiceName());
52 } catch (Exception $e)
53 {
54 return false;
55 }
56
57
58 if ($a_user_id == "")
59 {
60 $a_user_id = $ilUser->getId();
61 }
62
67 if (!ilObjCloudAccess::checkAuthStatus($a_obj_id) && $a_user_id != $object->getOwnerId() && !$rbacreview->isAssigned($a_user_id, 2))
68 {
69 return false;
70 }
71
72 switch ($a_permission)
73 {
74 case "visible":
75 case "read":
76 if (!ilObjCloudAccess::checkOnline($a_obj_id) && !$rbacsystem->checkAccessOfUser($a_user_id, "write", $a_ref_id))
77 {
78 return false;
79 }
80 break;
81 }
82 return true;
83
84 }
85
90 function _checkGoto($a_target)
91 {
92
93 global $ilAccess;
94
95 $t_arr = explode("_", $a_target);
96
97 if ($ilAccess->checkAccess("read", "", $t_arr[1]))
98 {
99 return true;
100 }
101 return false;
102 }
103
108 static function checkOnline($a_id)
109 {
110 global $ilDB;
111
112 if(!isset(self::$access_cache[$a_id]["online"]))
113 {
114 $set = $ilDB->query("SELECT is_online FROM il_cld_data " .
115 " WHERE id = " . $ilDB->quote($a_id, "integer")
116 );
117 $rec = $ilDB->fetchAssoc($set);
118 self::$access_cache[$a_id]["online"] = (boolean)($rec["is_online"]);
119 }
120 return self::$access_cache[$a_id]["online"];
121
122
123 }
124
129 static function checkAuthStatus($a_id)
130 {
131 global $ilDB;
132
133 if (!isset(self::$access_cache[$a_id]["auth_status"]))
134 {
135 $set = $ilDB->query("SELECT auth_complete FROM il_cld_data " .
136 " WHERE id = " . $ilDB->quote($a_id, "integer")
137 );
138 $rec = $ilDB->fetchAssoc($set);
139 self::$access_cache[$a_id]["auth_status"] = (boolean)$rec["auth_complete"];
140 }
141 return self::$access_cache[$a_id]["auth_status"];
142
143 }
144}
145
146
147?>
static checkServiceActive($name)
Class ilObjCloudAccess.
_checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id="")
Class ilObjCloud.
Class ilObjectAccess.
global $ilDB
global $ilUser
Definition: imgupload.php:15