Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Cwebuser::checkaccess() Issue When Used With Bizrule

$
0
0
Hello guys,

I am new to the forum :) and new to Yii as well. I am having some issues when using the CWebUser::checkAccess() method with the $bizRule parameter and hopefully someone could lend a helping hand.

Basically the issue is around if the business rule is invalid (such as having a typo or parse error), I don't get any error logs generated nor any notices from Yii. I looked into the source code and I can see the reason is all warnings are suppressed ('@' is used) when CAuthManager evaluates the business rules in CAuthManager::executeBizRule().

I can see why it does this but I almost pulled my hair off yesterday trying to debug what was going on with my bizrule and at the end I found it was a typo.

For example,

//define business rule and assign the rule to a Role and a User Id
$bizRule = 'return isset($params["blah"]) && $params["blah"]->isUserInRole("owner");';
$auth->assign('member', $row1['user_id'], $bizRule);

//check access
$params = array('blah' => $model);
Yii::app()->user->checkAccess('updateBlah', $params);


The problem is if I modify my $bizRule to
$bizRule = 'return isset($param["blah"]) && $param["blah"]->isUserInRole("owner");'; //missing 's' on $params

It does not generate any warnings.

Could someone give me some suggestions with regards to what's the best way to debug the business rules under these circumstances.


Thanks very much in advance!

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>