/** * Check whether the current user can delete the current ViewNode record * * @throws Exception */ function candelete() { global $DB, $USER, $HUB_SQL, $LNG; api_check_login(); /** CHANGED: If you can edit the map you can remove a node from the map **/ try { $view = new View($this->viewid); $view->canedit(); } catch (Exception $e) { return access_denied_error(); } /*$currentuser = ''; if (isset($USER->userid)) { $currentuser = $USER->userid; } if ($currentuser !== $this->userid) { throw new Exception($LNG->ERROR_ACCESS_DENIED_MESSAGE); } //can delete only if owner of this ViewNode record $params = array(); $params[0] = $this->viewid; $params[1] = $this->nodeid; $params[2] = $currentuser; $resArray = $DB->select($HUB_SQL->DATAMODEL_VIEWNODE_CAN_EDIT, $params); if($resArray !== false){ if (count($resArray) == 0) { throw new Exception($LNG->ERROR_ACCESS_DENIED_MESSAGE); } } else { throw new Exception($LNG->ERROR_ACCESS_DENIED_MESSAGE); } */ }