douju9847 2011-01-04 11:27
浏览 39
已采纳

CakePHP中的Auth问题

I've been using CakePHP for some time now. But I still fail to solve some issues on my own. Its been difficult to understand how Cake Auth works but in these past few weeks I've managed to work with it.

Now to my issue: I have 2 separate tables(Say for Admin Users and Normal Users). Both have different Controllers (Lets say they are AdminsController and UsersController). Now I have completed Users module without any trouble. Users login and Admin Login are different views. As I dont want any normal User to be able to get their hands on Admin login page I've kept it separate from normal user login.

Users login works fine with Auth. But now I want to use another Auth for AdminController for some reason I am unable to make use the second Auth from AdminController and control automatically transfers to the Users Login

It would be great if someone could point in the correct direction. Please!

Thank You. In advance!!

P.S : I've also tried using Auth->userModel

  • 写回答

1条回答 默认 最新

  • doumian3780 2011-01-04 14:38
    关注

    Sorry everyone I was using Auth->userModel slightly wrong way. I was adding it to my Admin Controller but not in User Controller so if you came here looking for an answer please use

    $this->Auth->userModel="User";

    in every controller in beforeFilter()

    enjoy.......

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!