# 更改父/子类别关系时，类别安全设置被重置

**URL:** https://meta.discourse.org/t/category-security-settings-reset-when-changing-parent-subcategory-relationship/399976
**Category:** Bug
**Created:** [2026年四月5日 11:16 UTC](https://meta.discourse.org/t/category-security-settings-reset-when-changing-parent-subcategory-relationship/399976 "2026-04-05T11:16:57Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [2026年四月5日 11:16 UTC](https://meta.discourse.org/t/category-security-settings-reset-when-changing-parent-subcategory-relationship/399976/1 "2026-04-05T11:16:58Z")

</div>

重现步骤：

1. 启用即将推出的变更“[启用简化的分类创建](https://meta.discourse.org/t/simplified-category-setup/394971)”
2. 创建一个分类“测试分类”
3. 创建一个分类“测试子分类”
4. 启用“高级设置”并进入“安全”选项卡
5. 为子分类的安全权限添加一个用户组，并从“所有人”中移除回复和创建的权限
6. 保存更改并刷新以确认已应用
7. 返回“常规”选项卡，从“子分类归属”设置中移除该分类
8. 保存更改并再次检查安全设置

**预期结果** ：之前配置的安全设置应保持不变，与禁用“启用简化的分类创建”设置时的行为一致。  
**实际结果** ：安全设置被无警告地重置，导致“所有人”再次可以创建和回复主题。

**注意** ：当将分类转换为子分类或更改其父分类时，也会出现相同的权限重置问题。

---

<div class="post-metadata">

### Author: ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)
#### Post date: [2026年四月5日 12:09 UTC](https://meta.discourse.org/t/category-security-settings-reset-when-changing-parent-subcategory-relationship/399976/2 "2026-04-05T12:09:11Z")

</div>

感谢提供详细的报告。

我之前遇到过类似的情况，但以为已经修复了。我们会进一步查看。

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [2026年四月8日 17:59 UTC](https://meta.discourse.org/t/category-security-settings-reset-when-changing-parent-subcategory-relationship/399976/9 "2026-04-08T17:59:53Z")

</div>

感谢反馈！我们在 Meta 也曾遇到过这个问题。

我刚刚合并了一项更新，只要可能，该更新将保留类别的权限。因此，现在只有当父类别需要时，类别权限才会更改（更严格的父类别也要求子类别具有相同的基本限制）。

> <https://github.com/discourse/discourse/pull/38225>
>
> Applies when \`enable\_simplified\_category\_creation\` is true. 
> 
> When changing a …parent of an existing category, we were inheriting the parent's permissions even in cases we didn't need to. This makes it easy to mistakenly open up private categories when they're moved to a public parent category. 
> 
> This update checks the permissions before changing them based on a new parent so:
> 
> \* New category: inherits parents permissions (current behavior)
> \* Editing category: if the new parent is more permissive than the previous parent... we can keep restrictive subcategory permissions unchanged
> \* Editing category: if the new parent is more restrictive than the previous parent... we must change the subcategory permissions to match 
> 
> Includes tests for various mixes of permissions.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2026年四月12日 22:00 UTC](https://meta.discourse.org/t/category-security-settings-reset-when-changing-parent-subcategory-relationship/399976/10 "2026-04-12T22:00:15Z")

</div>

此主题已在 3 天后自动关闭。不再允许新回复。
