it basically acts as the command line does, I personally prefer doing
it this way because I think it is easier.
I have attached one of my temporary functions for reference below.
Once you have added it to your users controller and accessed it in
your browser (/users/initDb) it will set the permissions in the
database.
So the code below, I have two groups admin (1), and member (2) and I
have setup the root for all controllers as "controllers" (you should
already have done this at the command line). It is then just a case of
assigning permissions where necessary. I have granted admin all
permissions. I then denied members everything and assigned them access
to things I would like them to access.
Hope this helps, it does take a bit of getting your head around! (code
is below):
// Build permissions function:
// "controllers" is the top level (site), followed by controller,
followed by action.
function initDb() {
// we dont need a view for this action:
$this->autoRender = false;
$group =& $this->User->Group;
// Admins
$group->id = 1;
$this->Acl->allow($group, 'controllers');
// Members
$group->id = 2;
// initially deny everything:
$this->Acl->deny($group, 'controllers');
// Now state exactly what is allowed:
$this->Acl->allow($group, 'controllers/Comments/add');
$this->Acl->allow($group, 'controllers/Comments/edit');
}
On Jul 1, 10:48 am, 0plus1 <david.0pl...@gmail.com> wrote:
> I'm following the tutorial on ACLs and I'm stuck here:http://book.cakephp.org/view/648/Setting-up-permissions
>
> I'm on windows :-( and when I issue this command:
> cake acl grant $aroAlias $acoAlias [create|read|update|delete|'*']
>
> I get this error message in return: "read" is not recognized as a
> command...
>
> Can you tell me why?
>
> On the same topic, when the tutorial says:
>
> To allow with the AclComponent do the following:
>
> $this->Acl->allow($aroAlias, $acoAlias);
>
> I understand that the file is: cake/libs/controller/components/acl.php
>
> Where exatly this line must be put? how does it differs from the
> command line version?
>
> Thank you very much, the more I dwell into cake the more I fall in
> love with it..
>
> David
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment