2013-03-19 4 views
2

나는 zfcUser/login, zfcUser/register 등과 같은 기본 경로를 비활성화 할 수 있는지 궁금해서 그걸 노출하고 싶지 않기 때문에 zfcUser을 사용하고 있습니다.기본 zfcUser 경로를 비활성화 하시겠습니까?

나는 zfcuser.global.php을 보았지만 그러한 옵션이없는 것 같습니다.

감사

답변

3

당신은 단순히 널 컨트롤러 또는 필적하기 라우팅 구성을 설정하여 구성을 대체 할 수 있습니다.

해결 방법 1 :

// YourApp\Module#getConfig() or config/autoload/zfcuser.override.global.php 

return array(
    'controllers' => array(
     'invokables' => array(
      'zfcuser' => null, 
     ), 
    ), 
); 

해결 방법 2 :

// YourApp\Module#getConfig() or config/autoload/zfcuser.override.global.php 

return array(
    'router' => array(
     'routes' => array(
      'zfcuser' => array(
       // changing to hostname route - using an unreachable hostname 
       'type' => 'Hostname', 
       // minimum possible priority - all other routes come first. 
       'priority' => ~PHP_INT_MAX, 
       'options' => array(
        // foo.bar does not exist - never matched 
        'route' => 'foo.bar', 
        'defaults' => array(
         'controller' => null, 
         'action' => 'index', 
        ), 
       ), 

       // optional - just if you want to override single child routes: 
       'child_routes' => array(
        'login' => array(
         'options' => array(
          'defaults' => array(
           'controller' => null, 
          ), 
         ), 
        ), 
        'authenticate' => array(
         'options' => array(
          'defaults' => array(
           'controller' => null, 
          ), 
         ), 
        ), 
        'logout' => array(
         'options' => array(
          'defaults' => array(
           'controller' => null, 
          ), 
         ), 
        ), 
        'register' => array(
         'options' => array(
          'defaults' => array(
           'controller' => null, 
          ), 
         ), 
        ), 
        'changepassword' => array(
         'options' => array(
          'defaults' => array(
           'controller' => null, 
          ), 
         ), 
        ), 
        'changeemail' => array(
         'options' => array(
          'defaults' => array(
           'controller' => null, 
          ), 
         ), 
        ), 
       ), 
      ), 
     ), 
    ), 
); 
+0

는 것 같다 : 당신의 자신의 경로 설정을 (해키, 낙담)를 사용하여 구성을 라우팅 무시 zfcuser 컨트롤러 호출 가능한를 오버라이드 (override) 당신의 대답은 짧게 끝났습니다. NullRoute 제안을 다시 게시 할 수 있습니까? – KaiserJohaan

+0

@KaiserJohaan 'NullRoute'제안은 실제로 너무 해커입니다. 길이가 길고 위에 게시 된 솔루션과 비교할 때 이점이 없기 때문에 마음을 고쳐서 제거했습니다. – Ocramius

+0

참고로, 첫 번째 해결책은 기본적으로 zfcuser 컨트롤러를 완전히 제거하므로 안전해야합니다. – Ocramius

관련 문제