我想将我的日志消息存储在单独的日志文件中,而不是默认的/protected/runtime/application.log文件中.
我的config/main.php文件就像
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'CFileLogRoute',
'levels'=>'error, warning,info,trace',
'categories'=>'system.*',
),
Run Code Online (Sandbox Code Playgroud)
我的日志消息功能在这里使用
public function changeLanguage($localLanguage)
{
$currentLanguage=yii::app()->language;
yii::app()->language=$localLanguage;
$message='langusge changed from '.$currentLanguage.' to '.$localLanguage;
$level='info';
$category='system.web.CController';
Yii::log($message, $level, $category);
}
Run Code Online (Sandbox Code Playgroud)
此日志消息存储在application.log中,同时还有很多其他消息.所以我想要更改语言功能日志的单独文件.
我已经在“管理客户”中为标签定义了ACL
<acl>
<resources>
<all>
<title>Allow Everything</title>
</all>
<admin>
<children>
<customer>
<children>
<manage>
<children>
<managepoint translate="title">
<title>Manage Point</title>
<sort_order>100</sort_order>
</managepoint>
</children>
</manage>
</children>
</customer>
</children>
</admin>
</resources>
</acl>
Run Code Online (Sandbox Code Playgroud)
使用此代码
public function canShowTab(){
if(!Mage::getSingleton('admin/session')->isAllowed('customer/manage/managepoint'))
return false;
return true;
}
Run Code Online (Sandbox Code Playgroud)
据推测,默认情况下,除管理员角色Mage :: getSingleton('admin / session')-> isAllowed('customer / manage / managepoint')以外的所有用户角色下的所有用户均应返回FALSE,但实际上返回TRUE,但是如果我选中然后取消选中此ACL的垂直角色,然后ACL开始按预期工作。
谁能告诉我为什么Mage :: getSingleton('admin / session')-> isAllowed('customer / manage / managepoint')默认返回FALSE。