/** * Check if the user has delete access to the item if is not a global module. * * @param Phprojekt_ActiveRecord_Abstract $model The model to save. * @param string $moduleName The current module. * * @return boolean True for a valid right. */ private static function _checkItemRights($model, $moduleName) { $canDelete = false; if ($moduleName == 'Core') { return Phprojekt_Auth::isAdminUser(); } else { if (Phprojekt_Module::saveTypeIsNormal(Phprojekt_Module::getId($moduleName))) { $itemRights = $model->getRights(); if (isset($itemRights['currentUser'])) { if (!$itemRights['currentUser']['delete'] && !$itemRights['currentUser']['admin']) { $canDelete = false; } else { $canDelete = true; } } } else { $canDelete = true; } } return $canDelete; }