[5.x]: Team group saved without name and handle, so project-config/apply fails
维护者通常 1 天内回复
评估
调研方向
先阅读 UserGroups::getTeamGroup()、UserPermissions::saveGroupPermissions() 和 UserGroups::handleChangedUserGroup();issue 指出项目配置中缺少 name 和 handle 是故障原因。按照提供的 craft exec 步骤重现故障,然后运行 php craft project-config/apply --force,检查报告的问题是否已解决,以及 Team 组配置是否包含这两个字段。
由索引模型根据 Issue 内容生成。
描述
What happened?
Description
On Craft 5.12.1 (Team), UserGroups::getTeamGroup() creates the Team group in the database only, not in the project config. It's also called from User::afterSave(). If permissions are then saved with UserPermissions::saveGroupPermissions(), the project config gets users.groups.<uid> with only permissions. The next project-config/apply (for example during a deploy) then fails.
Saving the Team permissions in Settings → Users is fine, because the controller calls saveGroup() first.
Steps to reproduce
-
On a Team install, run this with
craft exec:$pc = Craft::$app->getProjectConfig(); $pc->remove('users.groups.c55ca0a9-4bd6-409b-afd8-c1884dafecd0'); // fresh state: no Team group $group = Craft::$app->getUserGroups()->getTeamGroup(); Craft::$app->getUserPermissions()->saveGroupPermissions($group->id, ['viewusers']);The
remove()simulates a Team install where the group exists only in the database. -
Look at
config/project/users/groups/<uid>.yaml: it only haspermissions. -
Run
php craft project-config/apply --force.
Expected behavior
The Team group in the project config always has its name and handle, for example because getTeamGroup() saves the group through saveGroup(), or because saveGroupPermissions() makes sure the group exists in the project config. project-config/apply succeeds.
Actual behavior
project-config/apply fails with Undefined array key "name" in UserGroups::handleChangedUserGroup() (UserGroups.php:347).
Craft CMS version
5.12.1 (Team)
PHP version
8.5.12
Operating system and version
Debian GNU/Linux 13 (trixie), DDEV
Database type and version
MySQL 8.0.46
Image driver and version
Imagick 3.8.1 (ImageMagick 7.1.1-43)
Installed plugins and versions
- 主要语言
- PHP
- 星标
- 3.6k
- 派生
- 714
- 平均合并
- 13 小时 20 分钟
- 30 天内合并 PR
- 471
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
craftcms/cms 的其他 Issue
-
repo:cms
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
repo:cms
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
[5.x]: “Save and send activation email” doesn’t send the email for users with only “Moderate users”未关闭bug repo:cms
难度 1/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
bug repo:cms
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
bug repo:cms
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 3 天内回复
-
sync-en
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
[Sync EN] Formatting improvements to "Large Objects (LOBs)" docs (#6056)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭sync-en
难度 1/5 1 小时以内 新手友好度 74/100
维护者通常 1 天内回复
-
Перевод устарел
难度 2/5 1-3 小时 新手友好度 73/100
维护者通常 1 天内回复
-
项目日志弹出窗尺寸可拉伸功能未关闭
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复