public function executeDeleteSubscribers(sfWebRequest $request)
 {
     $minyanUserIds = $request->getParameter('minyanUserIds');
     if (is_array($minyanUserIds)) {
         foreach ($minyanUserIds as $id) {
             $minyanUser = Doctrine::getTable('MinyanUser')->find($id);
             if (SecurityManager::verify($minyanUser)) {
                 $minyanUser->delete();
             }
         }
     }
     $this->getUser()->setFlash('subscribersSuccess', 'Deleted selected users successfully.');
     echo Utils::ajaxResponse(true);
     return sfView::NONE;
 }
Exemple #2
0
 public static function extractDomainObjectFromRequest($request, $table, $param = null, $doSecurity = false)
 {
     if ($param == null) {
         $param = $table . "Id";
         $param[0] = strtolower($param[0]);
     }
     self::requireParam($request, $param);
     $obj = Doctrine::getTable($table)->find($request->getParameter($param));
     if ($obj) {
         if ($doSecurity && !SecurityManager::verify($obj)) {
             if (sfContext::getInstance()->getUser()->isAuthenticated()) {
                 throw new Exception("User tried to access a {$table} that doesnt belong to it! userId=" . sfContext::getInstance()->getUser()->getId());
             } else {
                 sfContext::getInstance()->getController()->redirect("login/index");
             }
         }
         return $obj;
     } else {
         throw new Exception("Could not find {$table} with id=" . $request->getParameter($param));
     }
 }