我能够控制我的应用程序使用ACL,一切都完美完成,应用程序正在ACL和Auth.
现在的问题是:
我有两张桌子,users和posts.没有RBAC(基于角色的访问控制).我正在为每个用户设置deny,allow如下所示.
//allow User1 to do everything
$user->id=1;
$this->ACL->allow($user,'controllers');
//allow User2 to add, edit and view the posts
$user->id=2;
$this->Acl->deny($user, 'controllers');
$this->Acl->allow($user, 'controllers/Posts');
Run Code Online (Sandbox Code Playgroud)
但在这里我遇到了一个问题:
user2是获得访问edit该posts的user1.
例:
User1创造了一个post1.
现在User2登录,他可以编辑User1帖子(即post1- /localhost/myApp/posts/edit/1)
问题:如何为此问题设置ACL权限,帖子的所有者只能编辑帖子而其他人不能.
我可以在控制器级别中简单地检查
if($_SESSION['Auth']['User']['id'] == $Post['Post']['user_id']){
// you're the owner, so u can edit
}else{
//u cant edit, this …Run Code Online (Sandbox Code Playgroud) 我试图使用grunt serve命令启动我的角度应用程序,但我得到致命错误:spawn cmd ENOENT.
我使用以下命令生成我的Angular App
npm install -g yo grunt-cli bower
npm install -g generator-angular
yo angular
npm install
bower install
Run Code Online (Sandbox Code Playgroud)
然后我用grunt serve命令启动我的应用程序
但它不起作用.
系统信息:操作系统:Windows 7 64位npm版本:2.11.3
请帮助我,我经历了所有咕噜声的文件,但没有任何线索.