Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

disable action in sonata admin bundle CRUD

IS there a simple way to disable some CRUD actions for given admin class? E.g. I just want a list of users added via front-end without the option to manually add them.

like image 377
Bartosz Rychlicki Avatar asked Aug 17 '13 11:08

Bartosz Rychlicki


1 Answers

In your admin class :

protected function configureRoutes(RouteCollection $collection)
{
    // to remove a single route
    $collection->remove('delete');
    // OR remove all route except named ones
    $collection->clearExcept(array('list', 'show'));
}

Also use routeCollection at top of admin class

use Sonata\AdminBundle\Route\RouteCollection;

Docs : http://sonata-project.org/bundles/admin/master/doc/reference/routing.html#removing-a-single-route

like image 162
rpg600 Avatar answered Nov 19 '22 10:11

rpg600