TaskProcessing checkGuestAccess() fails with an Error for a deleted user id

未关闭 适合新手
#67,535 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
84/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
php
领域
backend, testing

调研方向

阅读 lib/private/TaskProcessing/Manager.php 中 checkGuestAccess() 附近的代码,并检查 tests/lib/TaskProcessing/TaskProcessingTest.php 中现有的测试。重现 issue 中描述的过期用户 ID 情况,然后为缺失的用户补充测试覆盖。查找操作能够处理 null 用户而不抛出异常,并且测试通过,即表示完成。

由索引模型根据 Issue 内容生成。

描述

bug feature: TaskProcessing good first issue
Bug description

Manager::checkGuestAccess() resolves the user with IUserManager::get() but does not handle null:

https://github.com/nextcloud/server/blob/3a68340a6c806a18cdd0d9667a3b9ec5f096b135/lib/private/TaskProcessing/Manager.php#L1063-L1078

If the user id no longer exists (e.g. a task of a deleted account that is processed or rescheduled, or getAvailableTaskTypes() called with a stale user id), the guests app is installed and ai.taskprocessing_guests is not 'true', this ends in Call to a member function getBackend() on null instead of a clean result.

Steps to reproduce

Found by code reading.

  1. Install the guests app, keep ai.taskprocessing_guests at its default.
  2. Schedule a task for a user, delete the user before the task is processed.
  3. Processing / looking up the task's type calls checkGuestAccess($task->getUserId()) and throws an Error.
Expected behavior

A missing user is handled explicitly (e.g. $user === null → no guest access check / deny), covered by a test in tests/lib/TaskProcessing/TaskProcessingTest.php.

Nextcloud version

master

主要语言
PHP
星标
37.6k
派生
5.4k
平均合并
1 天 20 小时
30 天内合并 PR
605

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

nextcloud/server 的其他 Issue

查看 nextcloud/server 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。