层次群组成员(组内组)

For our running club, I’m coordinating a year-long challenge that has a team component. For each 10-year age-group team, I’m creating a Discourse group so they can be @mentioned and potentially have their own conversations, though I very much doubt anyone will figure that out. So I have seven groups for each of the age-group teams, and I have to update those manually as people register.

I also want to have an uber-group that contains all the people who are participating in the challenge. It would be a LOT easier if I could have the larger Challengers group merely contain the sub-groups for 19-and-under, 20-29, 30-39, and so on. That way I could just manage the sub-groups and have the changes flow through to the uber-group.

Is there (or could there be) a way to do this, or am I stuck having to manually type in every username from the sub-groups? (I think this will be several hundred people all told, and a weekly task.)

6 个赞

You should be same to use Bulk Add to Group, which will save you a lot of typing!

I don’t think we have plans to implement full hierarchical group membership resolution.

2 个赞

I keep being confused by references Bulk Add to Group, since it doesn’t appear in the UI as far as I can tell—the screenshots from the 2015 topic you linked to don’t match with what I see now. Is it just the same as using the Add Members dialog within a group?

And how can I copy a list of members of one group to be able to bulk add to another? The best workflow I can come up with at the moment is to copy the text of the Members page and use a style-savvy grep (in Nisus Writer Pro) to copy the usernames. Doable, but not exactly easy.

1 个赞

There are quite a few references to the “bulk add to group” feature here on Meta, but I don’t see it active anymore at https://discourse.example.org/admin/groups/bulk, just a blank page (I checked a couple different sites where I have admin rights). Do you see anything there @adamengst?

1 个赞

Sorry for the delay—missed the notification. No, I don’t have a page at

https://forum.fingerlakesrunners.org/admin/groups/bulk at all (404), and the main groups page is at FLRC Forum

No mention of Bulk Add anywhere that I can find.

1 个赞

I guess this is a bit of a hidden feature, but you can use the bulk invite feature to add existing users to groups. Just prep a csv with the email address and group as explained in the modal, and upload it. The users will not be emailed.

2 个赞

@tobiaseigen Aha! Do you happen to know if that would handle group updates for existing users if the email address in question already has an account?

Yes. That is precisely what I mean by this:

This feature seems to be doing double duty and we can improve the UI. I will propose something.

3 个赞

Awesome, thanks! Off to LibreOffice Calc I go! :keyboard:

1 个赞

Thanks! That’s getting closer, although I’ll note that keying off email address often works poorly for me because lots of people have multiple addresses, so I have to verify ahead of time whether I’m inviting the one that’s associated with an account or another one that will be confusing (and potentially set them up with a second account).

I don’t know how the underlying foundation works, but it would seem simplest to allow groups to contain references to other groups.

1 个赞

You could always do a user export and then use the exported CSV to create a new list to import back using the bulk invite feature. Sounds like you just need to do this once to get the system set up with your existing users, then manually when new people join or make a change to their age bracket.

Maye there’s a case for custom code to semi-automate this for your community - you could post a request in marketplace if you have a budget.

1 个赞

Good point on the user export—I wasn’t thinking about that as a way to populate the list with accounts to start. I’ll keep noodling on this and see how it works out.

1 个赞

分层组(组作为组的成员)还有一个额外的好处,即可以自动从继承的组中删除成员。

要“手动”实现此类功能,您必须记住组成员身份是继承自分层更高的组还是直接设置的。

您能否评论一下使用外部用户目录服务 (ldap) 来实现分层组功能?

2 个赞

@angus 我想知道 GroupAssociatedGroup 是否已经实现了此帖子的意图。

不,该功能与外部服务上的群组与 Discourse 群组的同步有关,而不是群组层级。

1 个赞

自从我发起这个帖子以来,我想我应该进来发表一下我的看法,我的分层群组请求仍然完全相关。

“批量邀请加入群组”功能根本不起作用,因为在我的例子中,我将人员添加到基于年龄的特定群组以及一个包含所有基于年龄的群组的总体群组中,这些群组在四个月的时间范围内随着他们在另一个系统中注册而添加。

我将看看我的开发人员今年是否可以自动化这个过程,因为我现在知道每周手动完成这个过程是多么的乏味。

1 个赞

@adamengst 在这方面有什么进展吗?

是的,事实上,我的开发人员能够将我们用于比赛注册的 Webscorer 的数据与 Discourse 群组同步。这要求姓名匹配,但他构建了一个显示不匹配的管理员页面。

因此,没有层级结构,但我们正在自动填充多个群组,这消除了我的主要需求。

这是开源代码,如果有人有兴趣了解它的工作原理,我大概可以分享。

3 个赞

我也收到了一个直接的请求,所以如果有人想看看 @SteveDesmond.ca 编写 Discourse 群组的代码,可以在以下网址找到:

Steve 说他很乐意回答有关此代码的问题。

2 个赞

这是亚当之前提到的特定代码的大纲:

  1. (L36) 获取外部系统中的所有用户
  2. (L37) 获取 Discourse 中的所有用户
  3. (L38-39) 获取相关组成员(在这种情况下,“global”是“超级组”)
  4. (L46-78) 对于外部系统中的每个用户,检查他们是否存在于 Discourse 中,并映射他们已属于哪些组以及需要添加到哪些组
1 个赞