如何限制用户只能访问自己的信息 [英] How to limit user for access only the information of his own

查看:213
本文介绍了如何限制用户只能访问自己的信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照手册中的Acl示例。
成功后,我有更多问题可以申请
Acl到我的项目

I follow Acl example in manual of cake .
When success I have more question for apply Acl to My project

 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.如何限制用户只访问他的自己的信息_
2.我需要警告时拒绝用户访问操作
3.当以任何角色登录时我无法接受注销操作

In code
1.How to limit user to access only the information of his own
2.I need to alert when deny user access to action
3.when login as any role I can't acess to logout action

感谢您

推荐答案

您需要基于行的acl您已显示的基于操作的操作 http://jmcneese.wordpress.com/2009/04/07/update-row-level-model-access-control-for-cakephp/

you need row based acl, not the action based one you have shown http://jmcneese.wordpress.com/2009/04/07/update-row-level-model-access-control-for-cakephp/

这篇关于如何限制用户只能访问自己的信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆