disable action in sonata admin bundle CRUD

前端 未结 1 1380
小鲜肉
小鲜肉 2021-01-01 20:46

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条回答
  •  借酒劲吻你
    2021-01-01 21:27

    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

    0 讨论(0)
提交回复
热议问题