Group Assignment SQL Query


(Thomas Purchas) #1

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.


Any way to programmatically add to groups?
(Sam Saffron) #2

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.


Default Custom Group
(Thomas Purchas) #3

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.


(SigurĂ°ur GuĂ°brandsson) #4

Full list of hooks right here:


(Kane York) #5

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


(Thomas Purchas) #7

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?


(Kane York) #8

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


(SigurĂ°ur GuĂ°brandsson) #9

Well, there we go… I created a PR with 3 user hooks, user_created, user_updated and user_deleted.

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


(Thomas Purchas) #10

Thanks for that @sigurdur!