Group Assignment SQL Query

Before I get to my feature request, I would like to take the time to thank the Discourse team for their work. Discourse is an epic piece of software, and so far everyone I have introduced it to has nothing but high praise for it.

Feature

Would it be possible to extend the Badge Query options to groups.

Currently groups can either be assigned by email domain or manually. Adding SQL queries would extend that to support anything an admin can imagine.

Use Case

I currently use SSO to integrate discourse into the rest of our society’s site. Our society’s site manages a number of things such as rotas, POS and film schedules.

To do this our site used groups to assign rights to various members. I would like to extend these groups over to discourse.

Currently I am using the custom_fields provided by SSO and SQL queries to assign badges to people based on their roles. Adding SQL queries to groups would also allow me to assign groups based on their roles.

This then allows me to create private categories so that teams can discuss topics that are only pertinent to that team.

1 Like

That is a massive change that is not on the roadmap, instead I would strongly recommend you look into writing a plugin to achieve your goal, we are totally open to adding more hooks as needed.

Is their a comprehensive list of hooks anywhere? I’ve been looking around and there are a couple of topics that list them, but I can’t seem to find a canonical list anywhere.

Full list of hooks right here:
https://meta.discourse.org/t/making-discourse-more-pluggable-by-adding-more-callback-triggers/25579

I think (adding) a user_verified hook would work here, as @thomaspurchas likely only wants to deal with users that have legit emails.

Also a user_edited hook :smile:

As my users are created my SSO would the user_verified hook get called as there is no explicit email validation stage?

1 Like

Yeah, I was thinking a on_save trigger that checks if activated transitioned from false to true.

Well, there we go… I created a PR with 3 user hooks, user_created, user_updated and user_deleted.
https://github.com/discourse/discourse/pull/3237

I’ll be using those triggers in my plugin, but it looks like @thomaspurchas will be able to use it as well… :smile:

2 Likes

Thanks for that @sigurdur!

Continued here: