/**
  * @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;
 }
Esempio n. 2
0
 /**
  * $return integer
  */
 public function getOwnerId()
 {
     include_once "./Modules/Cloud/classes/class.ilObjCloud.php";
     $cloud_object = new ilObjCloud($this->getObjId(), false);
     return $cloud_object->getOwnerId();
 }