16
votes

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.

1

1 Answers

48
votes

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