I’m new to Yii and I’m having a problem that probably has a simple solution. I’m going to have a simple backend that needs a lgoin. It will be a management tool to update a users (login) table and a simple products table. The front end will just be a few pages, one of which will just display the products.
Most of what I’ve seen involves a complex user system for the whole site. I just need a simple authentication for the backend.
I have modified Yii’s built-in authentication system using the default login to authenticate against a database, but I’m lost at how to apply it to only a backend. Should I create an “admin” module? Or is there a simpler method?
Nobody has a standard setup for this? I was curious because it seems like this would be necessary on quite a few sites - a password protected backend and a public frontend.
This seems like a good plan but it’s not very involved about handling the authentication:
I am basically separating my controllers and views by Admin(back-end) and Site(front-end). When using the GII CRUD Generator you can specify the folder where the controllers need to created. Which means that I have 2 separate USER controllers and set of views. I have one set under the admin folder, and one under the site folder. The model remains pretty much the same. I use scenarios to validate the data.
As per the user log in, i have a roles table which tells me where I need to redirect the user. I am using my own security model though.
All this means that I give the admin user the following url
http://www.site.com/admin/user/login or http://www.site.com/index.php?r=admin/user/login
I give the front-end user
http://www.site.com/site/user/login or http://www.site.com/index.php?r=site/user/login
Hope this helps
I saw that thread Andy. But I couldn’t get a sense of what to try. My concern is the implications further into the project. I just need to dive into the framework more.
JCO, thanks. I’m trying out the cookbook solution of having an admin directory under the protected directory. I’ll see how that goes.