Add groups to category

AI-generated summary

The discussion is about adding groups to categories. PatrickH wants to add a specified group to a subcategory, allowing everyone to see the parent subcategory while restricting access to the group. dax suggests using category permissions, but PatrickH clarifies that he wants the parent subcategory to be visible to everyone while the group is restricted. dax explains that it’s not possible to have more than one level of subcategories.

PatrickH asks for alternative solutions, and dax recommends using tags instead of sub-sub-categories. huynhthai824 asks about adding a group to multiple subcategories, and later shares a console code snippet to set permissions for specific categories.

We are planning to use the groups more often.
Now we have categories 2 layers deep.
Is it possible to add specified groups categories to the second layer ?

Example:

Maincatagory: Marketing
subcategory: Search engine optimization
add a (closed) group to the subcategory: Search engine optimization: SEO Expert group

Sure, it’s possible through category permissions in the Security tab

Marketing > parent category, “everyone” can Create / Reply / See
Search engine optimization > child category, “SEO expert group” can Create / Reply / See (this means that “everyone” can’t see the subcategory at all, unless you set “everyone” to See or to Reply / See

Yes, i know that, but what if want everyone to see the Search engine optimization group and have a special group under Search engine optimization ?
And that group is the SEO expert group

You mean SEO expert group I think.

It doesn’t matter, the category permissions are superior to everything, so even if a group is set to be seen by “everyone”, “everyone” can only see the public topics, not those of restricted categories.

No,
Marketing > parent category,
Search engine optimization > child category,
Search engine optimization Experts > child, child category,

It is not possible to configure more than one level of sub-categories, our structure is parent category > child category.

ok that’s to bad.
Is it possible to solve this in an other way ?

We use tags instead of sub-sub-categories, see

Hello, discourse
I wanna add a group “level-3” to all sub-category (slug-1 slug-2 slug-3 slug-4) of category
What console can i do it?
Thank you! :slight_smile:

category_ids = [6,7,8,10]

Category.where(id: category_ids).find_each do |category|
category.set_permissions(:staff => :full)
category.save!
end