示例#1
0
 protected function configureRoutes(RouteCollectionBuilder $routes)
 {
     $routes->addRoute(new Route('/', ['_controller' => 'kernel:indexAction']));
     //todo: Implement admin role restriction for the following routes
     $routes->addRoute((new Route('/user', ['_controller' => 'kernel:createUserAction']))->setMethods(['POST']));
     $routes->addRoute((new Route('/user/{username}', ['_controller' => 'kernel:createUserAction']))->setMethods(['PUT']));
     $routes->addRoute((new Route('/user/{username}', ['_controller' => 'kernel:deleteUserAction']))->setMethods(['DELETE']));
     $routes->addRoute((new Route('/group', ['_controller' => 'kernel:createGroupAction']))->setMethods(['POST']));
     $routes->addRoute((new Route('/group/{id}', ['_controller' => 'kernel:deleteGroupAction']))->setMethods(['DELETE']));
     $routes->addRoute((new Route('/user-group', ['_controller' => 'kernel:createUserGroupAction']))->setMethods(['POST']));
     $routes->addRoute((new Route('/user-group/{username}/{groupId}', ['_controller' => 'kernel:createUserGroupAction']))->setMethods(['PUT']));
     $routes->addRoute((new Route('/user-group/{username}/{groupId}', ['_controller' => 'kernel:deleteUserGroupAction']))->setMethods(['DELETE']));
 }