Well, this is also a way to do it. However, you technically doing
twice the work in this approach too. Rather than having separate
'admin_' actions and regular actions, put the admin activities with in
the regular functions. Let me clarify what I mean by this.
Say you have PostsController which is
class PostsController extends AppController{
var $name = 'Posts';
function edit()
{
// Do the ACL Access check here, check if it is
// user who is allowed to edit or it is the Admin here
// otherwise redirect to other page
}
// no need of having separate admin_edit() as you are
// taking care of admin actions in edit itself.
}
in your view for posts_edit action.
if ($isAdmin) {
// Show admin action urls, otherwise don't show it.
}
By following above strategy, you would not have to have two separate
actions in Controller and two separate views. In just one view and one
action, you have both admin as well as regular user functionality. And
of course, using ACL, will obviously give more finer control.
Cheers,
Ketan
keymaster wrote:
> I also use a single app for both front and backend.
>
> When the user logs in with an account flagged as having admin
> privileges, I show an "admin" link in the page footer. Non-admin users
> never see that link.
>
> Clicking the "admin" link brings up the admin panel, which sets a
> different layout.
>
> All actions invoked from the admin layout are preceded by "admin_".
>
> In my appController, I have a check to determine if the requested
> action is prefixed by "admin_", and if so redirect anyone who is not
> logged in as admin to the login page.
>
> Is this how other people who use a single app do it?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---