dongpu1879 2013-03-07 15:23
浏览 7
已采纳

CakePHP - 路由到管理员

Noob question!

I have a complete admin setup: login, authentication an so on, it's working. So, now i need a new controller to another situation and then i create the controller named PressDownloadsController and the correct views to every action inside this new controller.

I also created the following route:

Router::connect('/pressdownloads', array('controller' => 'pressdownloads', 'action' => 'downloads'));

Inside the pressDownloads controller, there's some redirect between some actions.

When i try to open the url /pressdownloads/downloads or just /pressdownloads it just goes to admin controller and i need to login in before acess the pressdownloads area.

Why?

The Auth Settings inside UsersController (admin):

Ok. I get it. So the auth settings:

      public $components = array(

    'Session',

    'Auth' => array(

        'loginAction' => array(

            'controller' => 'users',

            'action' => 'login',

            'prefix' => 'admin',

        ),

        'loginRedirect' => '/admin/events',

        'logoutRedirect' => '/admin',

        'authError' => 'Acesso negado',

        'flash' => array(

            'element' => 'admin/messages/error',

            'key' => 'auth',

            'params' => array()

        ),

        'authorize' => array('Controller'),

        'authenticate' => array(

            'Form' => array(

                'fields' => array('username' => 'email')

            )

        )

    )

);
  • 写回答

2条回答 默认 最新

  • dongzhuo1733 2013-03-07 15:33
    关注

    I recommend to check Auth component settings and how you split admin area from non-admin. Also, you may specify in your routing not to use admin prefix like this:

    Router::connect('/pressdownloads', array('controller' => 'pressdownloads', 'action' => 'downloads', 'admin' => false));
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何在node.js中或者java中给wav格式的音频编码成sil格式呢
  • ¥15 不小心不正规的开发公司导致不给我们y码,
  • ¥15 我的代码无法在vc++中运行呀,错误很多
  • ¥50 求一个win系统下运行的可自动抓取arm64架构deb安装包和其依赖包的软件。
  • ¥60 fail to initialize keyboard hotkeys through kernel.0000000000
  • ¥30 ppOCRLabel导出识别结果失败
  • ¥15 Centos7 / PETGEM
  • ¥15 csmar数据进行spss描述性统计分析
  • ¥15 各位请问平行检验趋势图这样要怎么调整?说标准差差异太大了
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题