YII中You are not authorized to perform this action的解决方法

编程知识 更新时间:2023-04-29 04:47:06

当访问:TblOrders/listdetial时

YII中出现You are not authorized to perform this action的提示,是因为当前用户没有访问这个控制器下面的actionlistdetial的权限,只要在accessRules下设置一下该action的访问控制就可以了。

代码如下:

public function accessRules()
	{
		return array(
			array('allow',  // allow all users to perform 'index' and 'view' actions
				'actions'=>array('index','view'),
				'users'=>array('*'),
			),
			array('allow', // allow authenticated user to perform 'create' and 'update' actions
				'actions'=>array('create','update','listdetial'),
				'users'=>array('@'),
			),
			array('allow', // allow admin user to perform 'admin' and 'delete' actions
				'actions'=>array('admin','delete'),
				'users'=>array('admin','@'),
			),
			array('deny',  // deny all users
				'users'=>array('*'),
			),
		);
	}

更多推荐

YII中You are not authorized to perform this action的解决方法

本文发布于:2023-04-21 18:58:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/0521ee8e3201e348a3c4d2ed694ebb39.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:解决方法   authorized   YII   action   perform

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!

  • 93829文章数
  • 23780阅读数
  • 0评论数