user->findIdentityByAccessToken($accessToken); if ($identity === null) { return []; } /** @noinspection NullPointerExceptionInspection */ $permissions = $identity->getAssignedPermissions(); if (empty($permissions)) { return []; } return array_flip($permissions); } }