我的yii2项目有问题。我使用了RBAC授权,它运行正常。
在下面的代码中,'@'是指登录的用户。它是在不使用RBAC的SiteController中实现的。
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'actions' => ['login', 'error', 'confirm', 'changepassword', 'thongbao', 'request-password-reset', 'reset-password', 'distance',
'nhatram', 'updatediaban', 'leas', 'thongkell', 'thongkells', 'nodetb', 'xemnode', 'bcthang','mailcb'
],
'allow' => true,
],
[
'actions' => ['logout', 'index', 'leaslineall', 'up'],
'allow' => true,
'roles' => ['@'],
],
],
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'logout' => ['post'],
],
],
];
}因此,我只想为名为"Superadmin"的特定用户授权一些操作。
我该怎么办?谢谢!
发布于 2018-03-27 04:06:34
你试过这个推荐信了吗?
这是关于您的RBAC授权非常详细的。
https://www.yiiframework.com/wiki/771/rbac-super-simple-with-admin-and-user
https://stackoverflow.com/questions/49503096
复制相似问题