yii\rbac\PhpManager::getDirectPermissionsByUser PHP Method

getDirectPermissionsByUser() protected method

Returns all permissions that are directly assigned to user.
Since: 2.0.7
protected getDirectPermissionsByUser ( string | integer $userId ) : Permission[]
$userId string | integer the user ID (see [[\yii\web\User::id]])
return Permission[] all direct permissions that the user has. The array is indexed by the permission names.
    protected function getDirectPermissionsByUser($userId)
    {
        $permissions = [];
        foreach ($this->getAssignments($userId) as $name => $assignment) {
            $permission = $this->items[$assignment->roleName];
            if ($permission->type === Item::TYPE_PERMISSION) {
                $permissions[$name] = $permission;
            }
        }
        return $permissions;
    }