2011-05-31 145 views
1

我遵循Acl示例中的蛋糕手册。
当成功,我有申请 Acl来我的项目更多的问题
如何限制用户访问他自己的信息

function initDB() { 
    $group = & $this->User->Group; 
    //Allow admins to everything 
    $group->id = 1; 
    $this->Acl->allow($group, 'controllers'); 

    //allow managers to posts and widgets 
    $group->id = 2; 
    $this->Acl->deny($group, 'controllers'); 
    $this->Acl->allow($group, 'controllers/Posts'); 
    $this->Acl->allow($group, 'controllers/Widgets'); 

    //allow users to only add and edit on posts and widgets 
    $group->id = 3; 
    $this->Acl->deny($group, 'controllers'); 
    $this->Acl->allow($group, 'controllers/Posts/add'); 
    $this->Acl->allow($group, 'controllers/Posts/edit'); 
    $this->Acl->allow($group, 'controllers/Widgets/add'); 
    $this->Acl->allow($group, 'controllers/Widgets/edit'); 
    //we add an exit to avoid an ugly "missing views" error message 
    echo "all done"; 
    exit; 
} 

在代码
1.How来限制用户访问自己的
2.我的唯一信息需警惕拒绝用户时访问行动
3.当登录任何角色,我不能接取注销行动

谢谢

回答

0

CakePHP的ACL组件可能有点令人失望。与Zend框架中的ACL组件相比,它似乎非常缺乏。

我从来没有试过dogmatic69引用的插件。在我的应用程序中,我决定使用ACL来处理ACL的优势,并在需要限制对行和其他内容的访问(而不是使用插件)的情况下查找其他权限检查方式。

我现在唯一关心的是如何使用插件,CakePHP 2.0现在作为Alpha发布,如果您选择使用此插件,可能会延迟/阻碍您的升级。然而,这个插件的开发似乎相当活跃,所以很有可能它将被更新为与2.0一起工作(如果有问题开始的话)。

+0

之间的不同,这是我的第一个蛋糕的项目。你可以指导我的Acl使用或不 – bubbleman 2011-05-31 14:47:00

相关问题