How to check user can access controller/action

In yii v.1.x can use Yii::app()->user->checkAccess(‘customer/list’) ,

but it not work in yii2,

I try to use Yii::app()->user->can()

it work only for permission , not work for cortroller/action

I don’t think you can do what you want directly. You would need to use the name of the permission used in the action rather than the name of the action itself. In many cases, I would expect the permissions to largely match the action names so this shouldn’t be too much of a problem. e.g. Post/Create permission name might be post-create.

Thank you very much