In Yii2 we can check access of current user for any permissions by yii\web\User::can()
as follow:
if (\Yii::$app->user->can('createPost')) { // user_id=1
// create post
}
How can we check access for another users such as user_id = 5
in yii2?
Like this:
if (\Yii::$app->authManager->checkAccess($user_id, 'createPost')) {}