English 中文(简体)
CakePHP Acl 自动检查
原标题:CakePHP Acl auto checking

我对卡纳克民阵框架进行了创新。 我对卡纳克民阵没有足够了解。 因此,我的问题是:法律协会是否自动运作,或者我是否需要人工检查?

最佳回答

我在最近一次与阿盟合作开展的CakePHP1.3项目主计长中这样做,在CakePHP 2.1中应相当相似。

function beforeFilter() {
    // ACL Check
    if($this->name !=  Pages  && !$this->Acl->check(array( model  =>  User ,  foreign_key  => $this->Session->read( Auth.User.id )), $this->name .  /  . $this->params[ action ])) {
        CakeLog::write( auth ,  ACL DENY:   . $this->Session->read( Auth.User.name ) .   tried to access   . $this->name .  /  . $this->params[ action ] .  . );
        $this->render( /pages/forbidden );
        exit; // Make sure we halt here, otherwise the forbidden message is just shown above the content.
    }
}

除页码控制器外,所有控制器/行动都经过了ACL检查,如果用户不能进入,则使用页/暗中的观点代替,记录条目则写给下。 记录也存档(选择,但我当时倾向于这样做)。

问题回答

If you ve configured it correctly, the AclComponent automagically checks if a user has access to an action.

资料来源:我在CakePHP1.3方面的经验。





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签