/** * @param string $a_cmd * @param string $a_permission * @param int $a_ref_id * @param int $a_obj_id * @param string $a_user_id * @return bool */ function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "") { global $ilUser, $rbacsystem; $object = new ilObjCloud($a_ref_id); /** * Check if plugin of object is active */ try { ilCloudConnector::checkServiceActive($object->getServiceName()); } catch (Exception $e) { return false; } if ($a_user_id == "") { $a_user_id = $ilUser->getId(); } /** * Check if authentication is complete. If not, only the owner of the object has access. This prevents the * authentication of an account which does not belong to the owner. */ if (!ilObjCloudAccess::checkAuthStatus($a_obj_id) && $a_user_id != $object->getOwnerId()) { return false; } switch ($a_permission) { case "visible": case "read": if (!ilObjCloudAccess::checkOnline($a_obj_id) && !$rbacsystem->checkAccessOfUser($a_user_id, "write", $a_ref_id)) { return false; } break; } return true; }
/** * @return array */ function getProperties() { global $lng; $props = array(); include_once './Modules/Cloud/classes/class.ilObjCloudAccess.php'; if (!ilObjCloudAccess::checkAuthStatus($this->obj_id)) { $props[] = array("alert" => true, "property" => $lng->txt("status"), "value" => $lng->txt("cld_not_authenticated_offline")); } else { if (!ilObjCloudAccess::checkOnline($this->obj_id)) { $props[] = array("alert" => true, "property" => $lng->txt("status"), "value" => $lng->txt("offline")); } } return $props; }