In Discourse Automation, it would be really useful to be able to add a user to a group automatically, and be removed from a group automatically.
Use cases:
To have the function and access of a group apply to those who have completed a specific task
To enable functional sub-groups. For example, if a user is put in a group of Data Scientists, they are also put in the broader group of IT Professionals. If removed from the IT Professionals group, they are also removed from the Data Scientists group.
To allow the membership of groups to be granted and revoked via SQL (from Badges - this really expands the scope)
Greetings! Very good suggestion, I was just looking for a similar solution, but unfortunately, as I understand Discourse Automation does not support such a function(
That is handy, and meets my 1. and 3. with aplomb!
All that remains is 2. - which I note has recently been requested by someone else:
This of course could be worked around by having a badge with SQL that picks up on the group membership, and then a script that then assigns the other. But that is a bit messy / clunky and results in a collection of redundant badges.
A somewhat related request that I think has come up a few times is to have some way of dealing with AND logic for category security permissions: Identifying users in multiple groups using AND rather than OR?. In the topic I linked to, they want to create a group for people who are in the trust_level_3 and year_2 groups. This could be accomplished with the Automation plugin now with a custom badge query, but as was noted by Nathan, thatâs a messy way of solving the problem. Itâs also limited to sites that are able to add custom badge SQL.
Iâm posting this here because it might be useful to have requests for scripts related to the user_added_to_group and user_removed_from_group triggers in one topic.
Nice spot. Letâs close this topic off as two of the three have been implemented and we can track the remaining one better in the dedicated feature request.