/** * Method to test whether a record can be deleted. * * @param object A record object. * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. * @since 1.6 */ protected function canDelete($record) { if (!empty($record->id)) { $user = JFactory::getUser(); // Check that user have access permission to data banks and can delete if ($user->authorise('core.core', $this->option) && parent::canDelete($record)) { // Check that desease not used in these tables $tables = array('dairies', 'fruits', 'sweeteners', 'prescriptions', 'foods', 'compositions'); $db = JFactory::getDbo(); foreach ($tables as $table) { $query = $db->getQuery(true); $query->select("COUNT(s.id) AS scount"); $query->from('#__sibdiet_' . $table . ' AS s'); $query->where("s.compositions LIKE '%\"" . $record->id . "\":%'"); $db->setQuery($query); try { // Execute the query in Joomla 3.0. $compositionUsed = $db->loadResult(); } catch (Exception $e) { // catch any database errors. } if ($compositionUsed) { // echo that item is used $this->setError(JText::sprintf('COM_SIBDIET_ERR_COMPOSITION_USED', $record->title)); return; } } return true; } return; } }
/** * Метод для проверки, может ли пользователь удалять существующую запись. * * @param object $record Объект записи. * * @return boolean True, если разрешено удалять запись. */ protected function canDelete($record) { if (!empty($record->id)) { return JFactory::getUser()->authorise('core.delete', $this->option . '.message.' . (int) $record->id); } else { return parent::canDelete($record); } }
/** * Method to test whether a record can be deleted. * * @param object $record A record object. * * @return boolean True if allowed to delete the record. Defaults to the permission for the component. * * @since 1.0.0 */ protected function canDelete($record) { if (!empty($record->id)) { if ($record->catid) { return JFactory::getUser()->authorise('core.delete', 'com_digicom.discount.' . (int) $record->catid); } return parent::canDelete($record); } }
/** * Method to test whether a record can be deleted. * * @param object $record A record object. * * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. * @since 1.6 */ protected function canDelete($record) { $user = JFactory::getUser(); if ($record->catid) { return $user->authorise('core.delete', 'com_contact.category.' . (int) $record->catid); } else { return parent::canDelete($record); } }
protected function canDelete($record) { if ($record->home) { // default record cannot be deleted return false; } else { return parent::canDelete($record); } }
/** * Method to test whether a record can be deleted. * * @param object A record object. * * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. * @since 1.6 */ protected function canDelete($record) { if (!empty($record->id)) { if ($record->published != -2) { return; } return parent::canDelete($record); } }
protected function canDelete($record) { $user = JFactory::getUser(); if (!empty($record->catid)) { return $user->authorise('core.delete', 'com_phocagallery.phocagalleryco.' . (int) $record->catid); } else { return parent::canDelete($record); } }
protected function canDelete($record) { $user = JFactory::getUser(); /*if ($record->catid) { return $user->authorise('core.delete', 'com_phocagallery.phocagalleryuser'); } else {*/ return parent::canDelete($record); //} }
/** * Method to test whether a record can be deleted. * * @param object $record A record object. * * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. * * @since 3.1 */ protected function canDelete($record) { if (!empty($record->id)) { if ($record->published != -2) { return; } $user = JFactory::getUser(); return parent::canDelete($record); } }
/** * Method to test whether a record can be deleted. * * @param object $record A record object. * * @return boolean True if allowed to delete the record. Defaults to the permission for the component. * * @since 1.6 */ protected function canDelete($record) { if (!empty($record->id)) { if ($record->state != -2) { return; } if ($record->catid) { return JFactory::getUser()->authorise('core.delete', 'com_htraininglogs.category.' . (int) $record->catid); } return parent::canDelete($record); } }
/** * Method to test whether a record can be deleted. * * @param object A record object. * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. * @since 1.6 */ protected function canDelete($record) { if (!empty($record->id)) { if ($record->state != -2) { return; } $user = JFactory::getUser(); if ($record->catid) { return $user->authorise('core.delete', 'com_faqs.category.' . (int) $record->catid); } else { return parent::canDelete($record); } } }
/** * Method to test whether a record can be deleted. * * @param object $record A record object. * * @return boolean True if allowed to delete the record. Defaults to the permission for the component. * * @since 1.0.0 */ protected function canDelete($record) { if (!empty($record->id)) { if ($record->published != -2) { return; } if (!$this->checkOrderExist($record->id)) { return; } if ($record->catid) { return JFactory::getUser()->authorise('core.delete', 'com_digicom.category.' . (int) $record->catid); } return parent::canDelete($record); } }
/** * Method to test whether a record can be deleted. * * @param object $record A record object. * * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. * @since 1.6 */ protected function canDelete($record) { // Check if the access level is being used by any content. if ($this->levelsInUse === null) { // Populate the list once. $this->levelsInUse = array(); $db = $this->getDbo(); $query = $db->getQuery(true)->select('DISTINCT access'); // from is added dynamically // Get all the tables and the prefix $tables = $db->getTableList(); //$fields = $db->getTableFields($tables); $prefix = $db->getPrefix(); foreach ($tables as $table) { // Get all of the columns in the table $fields = $db->getTableColumns($table); // We are looking for the access field. If custom tables are using something other // than the 'access' field they are on their own unfortunately. // Also make sure the table prefix matches the live db prefix (eg, it is not a "bak_" table) if (strpos($table, $prefix) === 0 && isset($fields['access'])) { // Lookup the distinct values of the field. $query->clear('from')->from($db->quoteName($table)); $db->setQuery($query); $values = $db->loadColumn(); $error = $db->getErrorMsg(); // Check for DB error. if ($error) { $this->setError($error); return false; } $this->levelsInUse = array_merge($this->levelsInUse, $values); // TODO Could assemble an array of the tables used by each view level list those, // giving the user a clue in the error where to look. } } // Get uniques. $this->levelsInUse = array_unique($this->levelsInUse); // Ok, after all that we are ready to check the record :) } if (in_array($record->id, $this->levelsInUse)) { $this->setError(JText::sprintf('COM_USERS_ERROR_VIEW_LEVEL_IN_USE', $record->id, $record->title)); return false; } return parent::canDelete($record); }
/** * Method to test whether a record can be deleted. * * @param * object A record object. * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. * @since 1.6 */ protected function canDelete($record) { if (!empty($record->id)) { if ($record->published != -2) { return; } $user = JFactory::getUser(); if (!empty($record->catid)) { $canDelete = $user->authorise('core.delete', 'com_edashboard.category.' . (int) $record->catid); } else { $canDelete = parent::canDelete($record); } } // ABP: Additional check on pub dates: deny if published, only superadmin can change if ($canDelete && !$user->authorise('core.admin') && $record->id) { $item = $this->getItem($record->id); $canDelete = !$this->isPublished($item); } return $canDelete; }
/** * Method to test whether a record can be deleted. * * @param object $record A record object. * * @return boolean True if allowed to delete the record. Defaults to the permission for the component. * * @since 1.6 */ protected function canDelete($record) { if (!empty($record->id)) { if ($record->state != -2) { return; } $user = JFactory::getUser(); // Check that desease not used in given diets $db = JFactory::getDbo(); $query = $db->getQuery(true)->select("q.id")->from('#__testyourself_questions AS q')->where("q.formid = " . $record->id); $db->setQuery($query); try { $used = $db->loadColumn(); } catch (Exception $e) { // catch any database errors. } if (count($used)) { // echo that item is used $this->setError(JText::sprintf('COM_TESTYOURSELF_ERR_FORM_USED', $record->title . ' (' . implode(' - ', $used) . ')')); return; } return parent::canDelete($record); } }
/** * Method to test whether a record can be deleted. * * @param object $record A record object. * * @return boolean True if allowed to delete the record. Defaults to the permission for the component. * * @since 11.1 */ protected function canDelete($record) { if (!empty($record->id)) { $user = JFactory::getUser(); return $user->authorise('core.delete', 'com_visforms.visform.' . (int) $record->id); } else { return parent::canDelete($record); } }
/** * Method to test whether a record can be deleted. * Defaults to the permission set in the component. * * @param object A record object. * * @return boolean True if allowed to delete the record. */ protected function canDelete($record) { if (empty($record->id)) { return parent::canDelete($record); } if ($record->state != -2) { return false; } $user = JFactory::getUser(); if (!$user->authorise('core.admin') && !in_array($record->access, $user->getAuthorisedViewLevels())) { return false; } return $user->authorise('core.delete', 'com_pftasks.tasklist.' . (int) $record->id); }
protected function canDelete($record) { if (!empty($record->id)) { return parent::canDelete($record); } }
/** * Method to test whether a record can be deleted. * Defaults to the permission set in the component. * * @param object A record object. * * @return boolean True if allowed to delete the record. */ protected function canDelete($record) { if (!empty($record->task_id)) { $user = JFactory::getUser(); $asset = 'com_pftasks.task.' . (int) $record->task_id; return $user->authorise('core.delete', $asset); } return parent::canDelete($record); }
protected function canDelete($record) { //$user = JFactory::getUser(); return parent::canDelete($record); }
/** * Method to test whether a record can be deleted. * * @param object $record A record object. * * @return boolean True if allowed to change the state of the record. Defaults to the permission for the component. * * @since 11.1 */ protected function canDelete($record) { if (!empty($record->id) && !empty($record->fid)) { if (!empty($record->restrictions)) { if ($restrictions = self::getRestrictions($record->id)) { foreach ($restrictions as $r => $value) { foreach ($value as $fieldName => $fieldId) { switch ($r) { case 'usedAsEqualTo': $option = JText::_('COM_VISFORMS_EQUAL_TO'); break; case 'usedAsShowWhen': $option = JText::_('COM_VISFORMS_SHOW_WHEN'); break; default: $option = ""; break; } $this->setError(JText::sprintf('COM_VISFORMS_HAS_RESTRICTIONS', $record->name, $option, $fieldName)); } } return false; } } $user = JFactory::getUser(); return $user->authorise('core.delete', 'com_visforms.visform.' . (int) $record->fid . '.visfield.' . (int) $record->id); } else { //use component settings return parent::canDelete($record); } }
/** * Method to test whether a record can be deleted. * * @param object $record A record object. * * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. * * @since 1.6 */ protected function canDelete($record) { if (!empty($record->id)) { if ($record->published != -2) { return false; } $user = JFactory::getUser(); if (!empty($record->catid)) { return $user->authorise('core.delete', 'com_newsfeed.category.' . (int) $record->catid); } else { return parent::canDelete($record); } } return false; }
/** * Method to test whether a record can be deleted. * * @param object A record object. * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. * @since 1.6 */ protected function canDelete($record) { return parent::canDelete($record); }
/** * Method to test whether a record can be deleted. * Defaults to the permission set in the component. * * @param object A record object. * * @return boolean True if allowed to delete the record. */ protected function canDelete($record) { if (!empty($record->id)) { if ($record->state != -2) { return false; } $user = JFactory::getUser(); $asset = 'com_pfdesigns.album.' . (int) $record->id; return $user->authorise('core.delete', $asset); } return parent::canDelete($record); }
protected function canDelete($record) { $rootComment = JUDownloadFrontHelperComment::getRootComment(); if (isset($record->id) && $record->id == $rootComment->id) { return false; } $app = JFactory::getApplication(); if ($app->isSite()) { return JUDownloadFrontHelperPermission::canDeleteComment($record->id); } return parent::canDelete($record); }
/** * Method to test whether a record can be deleted. * Defaults to the permission set in the component. * * @param object A record object. * * @return boolean True if allowed to delete the record. */ protected function canDelete($record) { if (empty($record->id)) { return parent::canDelete($record); } return JFactory::getUser()->authorise('core.delete', 'com_pfrepo.note.' . (int) $record->parent_id); }
/** * Method to test whether a record can be deleted. * * @param object A record object. * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. * @since 1.6 */ protected function canDelete($record) { if (!empty($record->id)) { if ($record->published != -2) { return; } if (!empty($record->catid)) { return User::authorise('core.delete', 'com_newsfeed.category.' . (int) $record->catid); } else { return parent::canDelete($record); } } }