Can't Edit Category or Add Subcategories To It

Summary

On editing a restricted parent category or trying to add a new subcategory to a parent category, server returns “422: Unprocessable Entity”

Environment

  • Currently v2.3.0.beta7 +7 but problem first noticed several weeks back after being told there was a major update (which may have needed to be installed via command line and not via web interface?)

  • CentOS Linux release 7.6.1810

Discussion

This may be related to Unable to set up permissions on parent/subcategory and it’s definitely popped up fairly recently. As described in that post, I have a top-level category that is set for a group to see only. It’s really a container for the subcategories. Unlike their setup, my see group isn’t everyone. It’s a specific group that encompasses all the members of the subcategory groups (who can see, reply, and create).

Unless I set the parent container now to include everyone see, if I try to add a subcategory to the parent or edit something about the parent, I inevitably will get a 422: Unprocessable Entity. If I add everyone see into the parent category, it suddenly works.

I don’t have everyone see as a permission because sign-in is managed by OAUTH via another product. Anyone who can sign-in there should not be able to see anything on my Discourse unless they’re in a specific group, so I don’t use everyone almost anywhere.

I suspect I can add everyone see to the parent category to make changes/add new subcategories, and then remove it when I’m done. I’ll try testing that. In any case, the error message (which I also see pop up at other times) is particularly uninformative and the logs didn’t seem to show anything obvious I could see.

2 Likes

So if you add the same permissions as the parent prior to creation it fails?

1 Like

Does this make it clearer?

  • Parent category has see permissions for a group called MyOwnEveryone;
  • Subcategory is being added with create, reply, see permissions for a group called SomeGroup A.
  • MyOwnEveryone includes all members of SomeGroup A, SomeGroup B, SomeGroup C, etc, but is not the predefined everyone group for reasons mentioned in my original post.

So Discourse fails to recognize that SomeGroup B is a subset of MyOwnEveryone. This isn’t completely surprising, I suppose, but it’s inconvenient, and it was working before. :-o

That’s correct, Discourse doesn’t enumerate group memberships.

This is by design. Subcategories can’t have permissions that are less restrictive than their parents. A check was added for this during the recent betas:

:white_check_mark: Do not allow saving a category if child permissions are LESS restrictive than parent: Subcategories do not inherit permissions from parent category @maja

Source: Discourse 2.3 notes

This is why I asked:

It’s not a category creation error, you’re just using categories in a way that isn’t intended. Had you tried what I asked it would have worked.

4 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.